From 928fd47d680a5cbdfa798c4a66ee61f693407faf Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Mon, 5 Apr 2021 21:10:45 -0700 Subject: 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. --- linux/126write-int-decimal.subx | 3 ++- linux/ex1.subx | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'linux') 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 -- cgit 1.4.1-2-gfad0