about summary refs log tree commit diff stats
path: root/102keyboard.subx
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2021-03-15 20:32:26 -0700
committerKartik K. Agaram <vc@akkartik.com>2021-03-15 20:32:26 -0700
commit3a0664e1861643fea4c864d8d48492c9227b4e69 (patch)
treee582526dc404661f2cc09a5e20727a9e0b833e0e /102keyboard.subx
parentbe42a9c3ec444f5ccf84c07a483d442c9967e3f6 (diff)
downloadmu-3a0664e1861643fea4c864d8d48492c9227b4e69.tar.gz
clean up magic constants
Diffstat (limited to '102keyboard.subx')
-rw-r--r--102keyboard.subx17
1 files changed, 8 insertions, 9 deletions
diff --git a/102keyboard.subx b/102keyboard.subx
index df74c8e7..e8d23962 100644
--- a/102keyboard.subx
+++ b/102keyboard.subx
@@ -19,20 +19,19 @@ read-key:  # kbd: (addr keyboard) -> result/eax: byte
     81 7/subop/compare %ecx 0/imm32
     {
       75/jump-if-!= break/disp8
-      # var read/ecx: byte = keyboard buffer's read index
-      8b/-> *0x802c 1/r32/CL  # keyboard-buffer-read
-      # var next-key/eax: byte = *(keyboard buffer + ecx)
-      8a/byte-> *(ecx+0x8030) 0/r32/AL  # keyboard-buffer-data
+      # var buffer-byte-addr/ecx: (addr byte)
+      8b/-> *Keyboard-buffer:read 1/r32/CL
+      81 0/subop/add %ecx Keyboard-buffer:data/imm32
+      # var next-key/eax: byte = *buffer-byte-addr
+      8a/byte-> *ecx 0/r32/AL
       # if (next-key != 0) lock and remove from keyboard buffer
       81 7/subop/compare %eax 0/imm32
       {
         74/jump-if-= break/disp8
-        # TODO: add some instructions in this block to SubX if we ever want to
-        # use bootstrap on baremetal programs
         fa/disable-interrupts
-        c6 0/subop/copy-byte *(ecx+0x8030) 0/imm8  # keyboard-buffer-data
-        ff 0/subop/increment *0x802c  # keyboard-buffer-read
-        81 4/subop/and *0x802c 0xf/imm32  # keyboard-buffer-read
+        c6 0/subop/copy-byte *ecx 0/imm8
+        ff 0/subop/increment *Keyboard-buffer:read
+        81 4/subop/and *Keyboard-buffer:read 0x0f/imm32
         fb/enable-interrupts
       }
       # return