diff options
author | Kartik Agaram <vc@akkartik.com> | 2020-06-29 18:31:17 -0700 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2020-06-29 18:31:17 -0700 |
commit | 1afc882890399d70926a09036f4e66c33b3972cc (patch) | |
tree | c1e6638aea966b49d5d355fc55acca64e63a55b1 | |
parent | 690fa191f1533379a21ae9f0253f80068ad1a800 (diff) | |
download | mu-1afc882890399d70926a09036f4e66c33b3972cc.tar.gz |
6596
-rw-r--r-- | 075write-int-decimal.subx (renamed from 075print-int-decimal.subx) | 76 | ||||
-rw-r--r-- | 103screen.subx | 8 | ||||
-rwxr-xr-x | apps/assort | bin | 44400 -> 44400 bytes | |||
-rwxr-xr-x | apps/braces | bin | 46263 -> 46263 bytes | |||
-rwxr-xr-x | apps/calls | bin | 50910 -> 50910 bytes | |||
-rwxr-xr-x | apps/crenshaw2-1 | bin | 43741 -> 43741 bytes | |||
-rwxr-xr-x | apps/crenshaw2-1b | bin | 44288 -> 44288 bytes | |||
-rwxr-xr-x | apps/dquotes | bin | 48022 -> 48022 bytes | |||
-rw-r--r-- | apps/dquotes.subx | 8 | ||||
-rwxr-xr-x | apps/factorial | bin | 42844 -> 42844 bytes | |||
-rw-r--r-- | apps/factorial.subx | 4 | ||||
-rwxr-xr-x | apps/hex | bin | 46580 -> 46580 bytes | |||
-rwxr-xr-x | apps/mu | bin | 341142 -> 341142 bytes | |||
-rwxr-xr-x | apps/pack | bin | 56979 -> 56979 bytes | |||
-rwxr-xr-x | apps/sigils | bin | 58632 -> 58632 bytes | |||
-rwxr-xr-x | apps/survey | bin | 54332 -> 54332 bytes | |||
-rwxr-xr-x | apps/tests | bin | 43172 -> 43172 bytes | |||
-rw-r--r-- | html/075write-int-decimal.subx.html (renamed from html/075print-int-decimal.subx.html) | 0 |
18 files changed, 48 insertions, 48 deletions
diff --git a/075print-int-decimal.subx b/075write-int-decimal.subx index f0039cc4..0b980f54 100644 --- a/075print-int-decimal.subx +++ b/075write-int-decimal.subx @@ -5,7 +5,7 @@ # . op subop mod rm32 base index scale r32 # . 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 -print-int32-decimal: # out: (addr stream byte), n: int32 +write-int32-decimal: # out: (addr stream byte), n: int32 # works by generating characters from lowest to highest and pushing them # to the stack, before popping them one by one into the stream # @@ -51,10 +51,10 @@ print-int32-decimal: # out: (addr stream byte), n: int32 # var eax: int = abs(n) 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 0/r32/eax 0xc/disp8 . # copy *(ebp+12) to eax 3d/compare-eax-with 0/imm32 - 7d/jump-if->= $print-int32-decimal:read-loop/disp8 -$print-int32-decimal:negative: + 7d/jump-if->= $write-int32-decimal:read-loop/disp8 +$write-int32-decimal:negative: f7 3/subop/negate 3/mod/direct 0/rm32/eax . . . . . . # negate eax -$print-int32-decimal:read-loop: +$write-int32-decimal:read-loop: # eax, edx = eax / 10, eax % 10 99/sign-extend-eax-into-edx f7 7/subop/idiv 3/mod/direct 1/rm32/ecx . . . . . . # divide edx:eax by ecx, storing quotient in eax and remainder in edx @@ -64,14 +64,14 @@ $print-int32-decimal:read-loop: 52/push-edx # if (eax == 0) break 3d/compare-eax-and 0/imm32 - 7f/jump-if-> $print-int32-decimal:read-loop/disp8 -$print-int32-decimal:read-break: + 7f/jump-if-> $write-int32-decimal:read-loop/disp8 +$write-int32-decimal:read-break: # if (n < 0) push('-') 81 7/subop/compare 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 0/imm32 # compare *(ebp+12) - 7d/jump-if->= $print-int32-decimal:write/disp8 -$print-int32-decimal:push-negative: + 7d/jump-if->= $write-int32-decimal:write/disp8 +$write-int32-decimal:push-negative: 68/push 0x2d/imm32/- -$print-int32-decimal:write: +$write-int32-decimal:write: # edi = out 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 7/r32/edi 8/disp8 . # copy *(ebp+8) to edi # var w/edx: int = out->write @@ -81,27 +81,27 @@ $print-int32-decimal:write: # var max/ebx: (addr byte) = &out->data[out->size] 8b/copy 1/mod/*+disp8 7/rm32/edi . . . 3/r32/ebx 8/disp8 . # copy *(edi+8) to ebx 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 -$print-int32-decimal:write-loop: +$write-int32-decimal:write-loop: # pop into eax 58/pop-to-eax # if (eax == sentinel) break 3d/compare-eax-and 0/imm32/sentinel - 74/jump-if-= $print-int32-decimal:write-break/disp8 + 74/jump-if-= $write-int32-decimal:write-break/disp8 # if (curr >= max) abort 39/compare 3/mod/direct 1/rm32/ecx . . . 3/r32/ebx . . # compare ecx with ebx - 73/jump-if-addr>= $print-int32-decimal:abort/disp8 -$print-int32-decimal:write-char: + 73/jump-if-addr>= $write-int32-decimal:abort/disp8 +$write-int32-decimal:write-char: # *curr = AL 88/copy-byte 0/mod/indirect 1/rm32/ecx . . . 0/r32/AL . . # copy AL to byte at *ecx # ++curr 41/increment-ecx # ++w 42/increment-edx - eb/jump $print-int32-decimal:write-loop/disp8 -$print-int32-decimal:write-break: + eb/jump $write-int32-decimal:write-loop/disp8 +$write-int32-decimal:write-break: # out->write = w 89/copy 0/mod/indirect 7/rm32/edi . . . 2/r32/edx . . # copy edx to *edi -$print-int32-decimal:end: +$write-int32-decimal:end: # . restore registers 5f/pop-to-edi 5b/pop-to-ebx @@ -113,10 +113,10 @@ $print-int32-decimal:end: 5d/pop-to-ebp c3/return -$print-int32-decimal:abort: +$write-int32-decimal:abort: # . _write(2/stderr, error) # . . push args - 68/push "print-int32-decimal: out of space\n"/imm32 + 68/push "write-int32-decimal: out of space\n"/imm32 68/push 2/imm32/stderr # . . call e8/call _write/disp32 @@ -127,7 +127,7 @@ $print-int32-decimal:abort: e8/call syscall_exit/disp32 # never gets here -test-print-int32-decimal: +test-write-int32-decimal: # - check that a single-digit number converts correctly # setup # . clear-stream(_test-stream) @@ -137,17 +137,17 @@ test-print-int32-decimal: e8/call clear-stream/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp - # print-int32-decimal(_test-stream, 9) + # write-int32-decimal(_test-stream, 9) # . . push args 68/push 9/imm32 68/push _test-stream/imm32 # . . call - e8/call print-int32-decimal/disp32 + e8/call write-int32-decimal/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp # check-stream-equal(_test-stream, "9", msg) # . . push args - 68/push "F - test-print-int32-decimal"/imm32 + 68/push "F - test-write-int32-decimal"/imm32 68/push "9"/imm32 68/push _test-stream/imm32 # . . call @@ -157,7 +157,7 @@ test-print-int32-decimal: # . end c3/return -test-print-int32-decimal-zero: +test-write-int32-decimal-zero: # - check that 0 converts correctly # setup # . clear-stream(_test-stream) @@ -167,17 +167,17 @@ test-print-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 - # print-int32-decimal(_test-stream, 0) + # write-int32-decimal(_test-stream, 0) # . . push args 68/push 0/imm32 68/push _test-stream/imm32 # . . call - e8/call print-int32-decimal/disp32 + e8/call write-int32-decimal/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp # check-stream-equal(_test-stream, "0", msg) # . . push args - 68/push "F - test-print-int32-decimal-zero"/imm32 + 68/push "F - test-write-int32-decimal-zero"/imm32 68/push "0"/imm32 68/push _test-stream/imm32 # . . call @@ -187,7 +187,7 @@ test-print-int32-decimal-zero: # . end c3/return -test-print-int32-decimal-multiple-digits: +test-write-int32-decimal-multiple-digits: # - check that a multi-digit number converts correctly # setup # . clear-stream(_test-stream) @@ -197,17 +197,17 @@ test-print-int32-decimal-multiple-digits: e8/call clear-stream/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp - # print-int32-decimal(_test-stream, 10) + # write-int32-decimal(_test-stream, 10) # . . push args 68/push 0xa/imm32 68/push _test-stream/imm32 # . . call - e8/call print-int32-decimal/disp32 + e8/call write-int32-decimal/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp # check-stream-equal(_test-stream, "10", msg) # . . push args - 68/push "F - test-print-int32-decimal-multiple-digits"/imm32 + 68/push "F - test-write-int32-decimal-multiple-digits"/imm32 68/push "10"/imm32 68/push _test-stream/imm32 # . . call @@ -217,7 +217,7 @@ test-print-int32-decimal-multiple-digits: # . end c3/return -test-print-int32-decimal-negative: +test-write-int32-decimal-negative: # - check that a negative single-digit number converts correctly # setup # . clear-stream(_test-stream) @@ -227,12 +227,12 @@ test-print-int32-decimal-negative: e8/call clear-stream/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp - # print-int32-decimal(_test-stream, -9) + # write-int32-decimal(_test-stream, -9) # . . push args 68/push -9/imm32 68/push _test-stream/imm32 # . . call - e8/call print-int32-decimal/disp32 + e8/call write-int32-decimal/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp #? # dump _test-stream {{{ @@ -263,7 +263,7 @@ test-print-int32-decimal-negative: #? # }}} # check-stream-equal(_test-stream, "-9", msg) # . . push args - 68/push "F - test-print-int32-decimal-negative"/imm32 + 68/push "F - test-write-int32-decimal-negative"/imm32 68/push "-9"/imm32 68/push _test-stream/imm32 # . . call @@ -273,7 +273,7 @@ test-print-int32-decimal-negative: # . end c3/return -test-print-int32-decimal-negative-multiple-digits: +test-write-int32-decimal-negative-multiple-digits: # - check that a multi-digit number converts correctly # setup # . clear-stream(_test-stream) @@ -283,17 +283,17 @@ test-print-int32-decimal-negative-multiple-digits: e8/call clear-stream/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp - # print-int32-decimal(_test-stream, -10) + # write-int32-decimal(_test-stream, -10) # . . push args 68/push -0xa/imm32 68/push _test-stream/imm32 # . . call - e8/call print-int32-decimal/disp32 + e8/call write-int32-decimal/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp # check-stream-equal(_test-stream, "-10", msg) # . . push args - 68/push "F - test-print-int32-decimal-negative-multiple-digits"/imm32 + 68/push "F - test-write-int32-decimal-negative-multiple-digits"/imm32 68/push "-10"/imm32 68/push _test-stream/imm32 # . . call diff --git a/103screen.subx b/103screen.subx index f37f994b..5ad27acb 100644 --- a/103screen.subx +++ b/103screen.subx @@ -103,9 +103,9 @@ move-cursor: # row: int, column: int # construct directive in buf (write %ecx Esc) (write %ecx "[") - (print-int32-decimal %ecx *(ebp+8)) + (write-int32-decimal %ecx *(ebp+8)) (write %ecx ";") - (print-int32-decimal %ecx *(ebp+0xc)) + (write-int32-decimal %ecx *(ebp+0xc)) (write %ecx "H") # flush (write-stream 2 %ecx) @@ -198,12 +198,12 @@ start-color: # fg: int, bg: int # . set fg (write %ecx Esc) (write %ecx "[38;5;") - (print-int32-decimal %ecx *(ebp+8)) + (write-int32-decimal %ecx *(ebp+8)) (write %ecx "m") # . set bg (write %ecx Esc) (write %ecx "[48;5;") - (print-int32-decimal %ecx *(ebp+0xc)) + (write-int32-decimal %ecx *(ebp+0xc)) (write %ecx "m") # flush (write-stream 2 %ecx) diff --git a/apps/assort b/apps/assort index 3fa8621a..f57b0183 100755 --- a/apps/assort +++ b/apps/assort Binary files differdiff --git a/apps/braces b/apps/braces index a3946a73..46af2437 100755 --- a/apps/braces +++ b/apps/braces Binary files differdiff --git a/apps/calls b/apps/calls index d8795c37..5adaaa4f 100755 --- a/apps/calls +++ b/apps/calls Binary files differdiff --git a/apps/crenshaw2-1 b/apps/crenshaw2-1 index 001c6697..00cb2e16 100755 --- a/apps/crenshaw2-1 +++ b/apps/crenshaw2-1 Binary files differdiff --git a/apps/crenshaw2-1b b/apps/crenshaw2-1b index 7f0877ea..f9aa2c32 100755 --- a/apps/crenshaw2-1b +++ b/apps/crenshaw2-1b Binary files differdiff --git a/apps/dquotes b/apps/dquotes index e9c0927e..6710aafc 100755 --- a/apps/dquotes +++ b/apps/dquotes Binary files differdiff --git a/apps/dquotes.subx b/apps/dquotes.subx index ba8d3ee0..db93830a 100644 --- a/apps/dquotes.subx +++ b/apps/dquotes.subx @@ -329,12 +329,12 @@ process-string-literal: # string-literal: (addr slice), out: (addr buffered-fil e8/call write/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp - # . print-int32-decimal(out-segment, *Next-string-literal) + # . write-int32-decimal(out-segment, *Next-string-literal) # . . push args ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Next-string-literal/disp32 # push *Next-string-literal ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x10/disp8 . # push *(ebp+16) # . . call - e8/call print-int32-decimal/disp32 + e8/call write-int32-decimal/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp # . write(out-segment, ":\n") @@ -370,12 +370,12 @@ process-string-literal: # string-literal: (addr slice), out: (addr buffered-fil e8/call write-buffered/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp - # . print-int32-decimal(int32-stream, *Next-string-literal) + # . write-int32-decimal(int32-stream, *Next-string-literal) # . . push args ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Next-string-literal/disp32 # push *Next-string-literal 51/push-ecx # . . call - e8/call print-int32-decimal/disp32 + e8/call write-int32-decimal/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp # . write-stream-data(out, int32-stream) diff --git a/apps/factorial b/apps/factorial index 189effed..75195683 100755 --- a/apps/factorial +++ b/apps/factorial Binary files differdiff --git a/apps/factorial.subx b/apps/factorial.subx index d5882887..74e4dd6d 100644 --- a/apps/factorial.subx +++ b/apps/factorial.subx @@ -68,12 +68,12 @@ $run-main: 68/push 0/imm32/read 68/push 0/imm32/write 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx - # print-int32-decimal(buffer, eax) + # write-int32-decimal(buffer, eax) # . . push args 50/push-eax 51/push-ecx # . . call - e8/call print-int32-decimal/disp32 + e8/call write-int32-decimal/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp # write-stream(stderr, buffer) diff --git a/apps/hex b/apps/hex index 6f01b512..c904d808 100755 --- a/apps/hex +++ b/apps/hex Binary files differdiff --git a/apps/mu b/apps/mu index 54f8ac5d..1f9f76ab 100755 --- a/apps/mu +++ b/apps/mu Binary files differdiff --git a/apps/pack b/apps/pack index 01e54834..8819e5dc 100755 --- a/apps/pack +++ b/apps/pack Binary files differdiff --git a/apps/sigils b/apps/sigils index 540e7081..e897306a 100755 --- a/apps/sigils +++ b/apps/sigils Binary files differdiff --git a/apps/survey b/apps/survey index 293afa0c..4226811f 100755 --- a/apps/survey +++ b/apps/survey Binary files differdiff --git a/apps/tests b/apps/tests index ac8d193f..9e93e6a3 100755 --- a/apps/tests +++ b/apps/tests Binary files differdiff --git a/html/075print-int-decimal.subx.html b/html/075write-int-decimal.subx.html index 4227ba21..4227ba21 100644 --- a/html/075print-int-decimal.subx.html +++ b/html/075write-int-decimal.subx.html |