diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2023-12-07 21:48:47 -0800 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2023-12-07 21:48:47 -0800 |
commit | ae4058add3c2002b90f171a1ace40bf21118103e (patch) | |
tree | d7bfb5e655895eb86ba9e239ae245fd65fab00b3 /102keyboard.subx | |
parent | 204589b2ffc8aa16fa2953017eaa6614f7d05eb5 (diff) | |
download | mu-ae4058add3c2002b90f171a1ace40bf21118103e.tar.gz |
halt until exception when waiting for keyboard hlt
This reduces CPU consumption from 180% to 2% when running Qemu. Many thanks to Fabian of https://copy.sh for this suggestion.
Diffstat (limited to '102keyboard.subx')
-rw-r--r-- | 102keyboard.subx | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/102keyboard.subx b/102keyboard.subx index 39788075..f963baa2 100644 --- a/102keyboard.subx +++ b/102keyboard.subx @@ -24,6 +24,8 @@ read-key: # kbd: (addr keyboard) -> result/eax: byte 89/<- %ebp 4/r32/esp # . save registers 51/push-ecx + # wait for an interrupt to save power on Qemu + f4/hlt # result = 0 b8/copy-to-eax 0/imm32 # ecx = keyboard |