From 8aeb85f04ee68b960a6d326aca1a17dec2f6d019 Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Mon, 9 Dec 2019 01:26:58 -0800 Subject: 5806 --- html/075print-int-decimal.subx.html | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'html/075print-int-decimal.subx.html') diff --git a/html/075print-int-decimal.subx.html b/html/075print-int-decimal.subx.html index ad8fbe98..f79f4d70 100644 --- a/html/075print-int-decimal.subx.html +++ b/html/075print-int-decimal.subx.html @@ -66,7 +66,7 @@ if ('onhashchange' in window) { 5 # . op subop mod rm32 base index scale r32 6 # . 1-3 bytes 3 bits 2 bits 3 bits 3 bits 3 bits 2 bits 2 bits 0/1/2/4 bytes 0/1/2/4 bytes 7 - 8 print-int32-decimal: # out : (address stream), n : int32 + 8 print-int32-decimal: # out : (address stream byte), n : int32 9 # works by generating characters from lowest to highest and pushing them 10 # to the stack, before popping them one by one into the stream 11 # @@ -105,11 +105,11 @@ if ('onhashchange' in window) { 44 52/push-edx 45 53/push-ebx 46 57/push-edi - 47 # ten/ecx = 10 + 47 # const ten/ecx = 10 48 b9/copy-to-ecx 0xa/imm32 49 # push sentinel 50 68/push 0/imm32/sentinel - 51 # eax = abs(n) + 51 # var eax : int = abs(n) 52 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 0/r32/eax 0xc/disp8 . # copy *(ebp+12) to eax 53 3d/compare-eax-with 0/imm32 54 7d/jump-if-greater-or-equal $print-int32-decimal:read-loop/disp8 @@ -135,11 +135,11 @@ if ('onhashchange' in window) { 74 $print-int32-decimal:write: 75 # edi = out 76 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 7/r32/edi 8/disp8 . # copy *(ebp+8) to edi - 77 # w/edx = out->write + 77 # var w/edx : int = out->write 78 8b/copy 0/mod/indirect 7/rm32/edi . . . 2/r32/edx . . # copy *edi to edx - 79 # curr/ecx = &out->data[out->write] + 79 # var curr/ecx : (address byte) = &out->data[out->write] 80 8d/copy-address 1/mod/*+disp8 4/rm32/sib 7/base/edi 2/index/edx . 1/r32/ecx 0xc/disp8 . # copy ebx+edx+12 to ecx - 81 # max/ebx = &out->data[out->length] + 81 # var max/ebx : (address byte) = &out->data[out->length] 82 8b/copy 1/mod/*+disp8 7/rm32/edi . . . 3/r32/ebx 8/disp8 . # copy *(edi+8) to ebx 83 8d/copy-address 1/mod/*+disp8 4/rm32/sib 7/base/edi 3/index/ebx . 3/r32/ebx 0xc/disp8 . # copy edi+ebx+12 to ebx 84 $print-int32-decimal:write-loop: @@ -180,7 +180,7 @@ if ('onhashchange' in window) { 119 68/push "print-int32-decimal: out of space\n"/imm32 120 68/push 2/imm32/stderr 121 # . . call -122 e8/call _write/disp32 +122 e8/call _write/disp32 123 # . . discard args 124 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp 125 # . syscall(exit, 1) @@ -213,7 +213,7 @@ if ('onhashchange' in window) { 152 68/push "9"/imm32 153 68/push _test-stream/imm32 154 # . . call -155 e8/call check-stream-equal/disp32 +155 e8/call check-stream-equal/disp32 156 # . . discard args 157 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32 # add to esp 158 # . end @@ -243,7 +243,7 @@ if ('onhashchange' in window) { 182 68/push "0"/imm32 183 68/push _test-stream/imm32 184 # . . call -185 e8/call check-stream-equal/disp32 +185 e8/call check-stream-equal/disp32 186 # . . discard args 187 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32 # add to esp 188 # . end @@ -273,7 +273,7 @@ if ('onhashchange' in window) { 212 68/push "10"/imm32 213 68/push _test-stream/imm32 214 # . . call -215 e8/call check-stream-equal/disp32 +215 e8/call check-stream-equal/disp32 216 # . . discard args 217 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32 # add to esp 218 # . end @@ -304,7 +304,7 @@ if ('onhashchange' in window) { 268 68/push "-9"/imm32 269 68/push _test-stream/imm32 270 # . . call -271 e8/call check-stream-equal/disp32 +271 e8/call check-stream-equal/disp32 272 # . . discard args 273 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32 # add to esp 274 # . end @@ -334,7 +334,7 @@ if ('onhashchange' in window) { 298 68/push "-10"/imm32 299 68/push _test-stream/imm32 300 # . . call -301 e8/call check-stream-equal/disp32 +301 e8/call check-stream-equal/disp32 302 # . . discard args 303 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32 # add to esp 304 # . end -- cgit 1.4.1-2-gfad0