about summary refs log tree commit diff stats
path: root/linux
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2021-04-05 21:10:45 -0700
committerKartik K. Agaram <vc@akkartik.com>2021-04-05 21:15:06 -0700
commit928fd47d680a5cbdfa798c4a66ee61f693407faf (patch)
tree769ffeaa141867939ed4e80ef41222c0e4430c66 /linux
parent463878a4a4690392455080282287316879a5a649 (diff)
downloadmu-928fd47d680a5cbdfa798c4a66ee61f693407faf.tar.gz
snapshot: stupid debugging session
I spent a while building a little keyboard scancode printer:

  $ ./translate ex1.mu &&  qemu-system-i386 disk.img

..and wondering why up-arrow was 0x48 in hex but 724 in decimal. I ended
up paranoidly poking at a bunch of crap (though there _is_ a cool chromatography-based
debugging technique in 126write-int-decimal.subx) before I realized:

  - 724 just has one extra digit over the correct answer
  - the 0xe0 scan code is a 3-digit number in decimal -- and the final digit is '4'

There's nothing actually wrong.
Diffstat (limited to 'linux')
-rw-r--r--linux/126write-int-decimal.subx3
-rw-r--r--linux/ex1.subx1
2 files changed, 3 insertions, 1 deletions
diff --git a/linux/126write-int-decimal.subx b/linux/126write-int-decimal.subx
index bff585a7..d38e1a17 100644
--- a/linux/126write-int-decimal.subx
+++ b/linux/126write-int-decimal.subx
@@ -167,9 +167,10 @@ test-write-int32-decimal-zero:
     e8/call  clear-stream/disp32
     # . . discard args
     81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               4/imm32           # add to esp
+    b8/copy-to-eax 0x48/imm32
     # write-int32-decimal(_test-stream, 0)
     # . . push args
-    68/push  0/imm32
+    50/push-eax
     68/push  _test-stream/imm32
     # . . call
     e8/call  write-int32-decimal/disp32
diff --git a/linux/ex1.subx b/linux/ex1.subx
index 183c014a..3a8f700c 100644
--- a/linux/ex1.subx
+++ b/linux/ex1.subx
@@ -11,6 +11,7 @@
 == code
 
 Entry:
+e8/call test-write-int32-decimal-zero/disp32
 # exit(42)
 bb/copy-to-ebx  0x2a/imm32  # 42 in hex
 e8/call  syscall_exit/disp32