https://github.com/akkartik/mu/blob/main/102keyboard.subx
1
2
3
4
5
6
7 == code
8
9 read-key:
10
11 55/push-ebp
12 89/<- %ebp 4/r32/esp
13
14 51/push-ecx
15
16 b8/copy-to-eax 0/imm32
17
18 8b/-> *(ebp+8) 1/r32/ecx
19 81 7/subop/compare %ecx 0/imm32
20 {
21 75/jump-if-!= break/disp8
22
23 8b/-> *Keyboard-buffer:read 1/r32/CL
24 81 0/subop/add %ecx Keyboard-buffer:data/imm32
25
26 8a/byte-> *ecx 0/r32/AL
27
28 81 7/subop/compare %eax 0/imm32
29 {
30 74/jump-if-= break/disp8
31 fa/disable-interrupts
32 c6 0/subop/copy-byte *ecx 0/imm8
33 ff 0/subop/increment *Keyboard-buffer:read
34 81 4/subop/and *Keyboard-buffer:read 0x0f/imm32
35 fb/enable-interrupts
36 }
37
38 eb $read-key:end/disp8
39 }
40
41 $read-key:end:
42
43 59/pop-to-ecx
44
45 89/<- %esp 5/r32/ebp
46 5d/pop-to-ebp
47 c3/return