Compare commits

...

1 Commits
main ... hlt

Author SHA1 Message Date
Kartik K. Agaram ae4058add3 halt until exception when waiting for keyboard
This reduces CPU consumption from 180% to 2% when running Qemu.

Many thanks to Fabian of https://copy.sh for this suggestion.
2023-12-07 21:48:47 -08:00
1 changed files with 2 additions and 0 deletions

View File

@ -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