From 690fa191f1533379a21ae9f0253f80068ad1a800 Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Mon, 29 Jun 2020 18:01:44 -0700 Subject: 6595 --- 066write-int-hex.subx | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to '066write-int-hex.subx') diff --git a/066write-int-hex.subx b/066write-int-hex.subx index 6746891e..b1909940 100644 --- a/066write-int-hex.subx +++ b/066write-int-hex.subx @@ -263,7 +263,7 @@ test-print-int32: # . end c3/return -print-int32-buffered: # f: (addr buffered-file), n: int +write-int32-hex-buffered: # f: (addr buffered-file), n: int # pseudocode: # write-buffered(f, "0x") # ecx = 28 @@ -282,7 +282,7 @@ print-int32-buffered: # f: (addr buffered-file), n: int 51/push-ecx # ecx = 28 b9/copy-to-ecx 0x1c/imm32 -$print-int32-buffered:print-hex-prefix: +$write-int32-hex-buffered:print-hex-prefix: # write-buffered(f, "0x") # . . push args 68/push "0x"/imm32 @@ -291,10 +291,10 @@ $print-int32-buffered:print-hex-prefix: e8/call write-buffered/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp -$print-int32-buffered:loop: +$write-int32-hex-buffered:loop: # if (ecx < 0) break 81 7/subop/compare 3/mod/direct 1/rm32/ecx . . . . . 0/imm32 # compare ecx - 7c/jump-if-< $print-int32-buffered:end/disp8 + 7c/jump-if-< $write-int32-hex-buffered:end/disp8 # eax = n >> ecx 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 0/r32/eax 0xc/disp8 . # copy *(ebp+12) to eax d3/>>ecx 5/subop/pad-zeroes 3/mod/direct 0/rm32/eax . . . . . . # shift eax right by ecx bits, padding zeroes @@ -311,8 +311,8 @@ $print-int32-buffered:loop: 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp # ecx -= 4 81 5/subop/subtract 3/mod/direct 1/rm32/ecx . . . . . 4/imm32 # subtract from ecx - eb/jump $print-int32-buffered:loop/disp8 -$print-int32-buffered:end: + eb/jump $write-int32-hex-buffered:loop/disp8 +$write-int32-hex-buffered:end: # . restore registers 59/pop-to-ecx 58/pop-to-eax @@ -321,8 +321,8 @@ $print-int32-buffered:end: 5d/pop-to-ebp c3/return -test-print-int32-buffered: - # - check that print-int32-buffered prints the hex textual representation +test-write-int32-hex-buffered: + # - check that write-int32-hex-buffered prints the hex textual representation # setup # . clear-stream(_test-stream) # . . push args @@ -338,12 +338,12 @@ test-print-int32-buffered: e8/call clear-stream/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp - # print-int32-buffered(_test-buffered-file, 0x8899aa) + # write-int32-hex-buffered(_test-buffered-file, 0x8899aa) # . . push args 68/push 0x8899aa/imm32 68/push _test-buffered-file/imm32 # . . call - e8/call print-int32-buffered/disp32 + e8/call write-int32-hex-buffered/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp # flush(_test-buffered-file) @@ -373,7 +373,7 @@ test-print-int32-buffered: #? # }}} # check-stream-equal(_test-stream, "0x008899aa", msg) # . . push args - 68/push "F - test-print-int32-buffered"/imm32 + 68/push "F - test-write-int32-hex-buffered"/imm32 68/push "0x008899aa"/imm32 68/push _test-stream/imm32 # . . call -- cgit 1.4.1-2-gfad0