From 2655a4a91d1d2e98cc9ab9c54e70d4eb49c735d6 Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Tue, 30 Jun 2020 14:54:30 -0700 Subject: 6602 --- html/066write-int-hex.subx.html | 78 ++++++++++++++++++++--------------------- 1 file changed, 39 insertions(+), 39 deletions(-) (limited to 'html/066write-int-hex.subx.html') diff --git a/html/066write-int-hex.subx.html b/html/066write-int-hex.subx.html index dac46129..0a68e432 100644 --- a/html/066write-int-hex.subx.html +++ b/html/066write-int-hex.subx.html @@ -2,7 +2,7 @@ -Mu - 066print-int.subx +Mu - 066write-int-hex.subx @@ -57,9 +57,9 @@ if ('onhashchange' in window) { -https://github.com/akkartik/mu/blob/master/066print-int.subx +https://github.com/akkartik/mu/blob/master/066write-int-hex.subx
-  1 # Print the (hex) textual representation of numbers.
+  1 # Write out the (hex) textual representation of numbers.
   2 
   3 == code
   4 #   instruction                     effective address                                                   register    displacement    immediate
@@ -90,7 +90,7 @@ if ('onhashchange' in window) {
  29     c1/shift    5/subop/logic-right 3/mod/direct    0/rm32/eax    .           .             .           .           .               4/imm8            # shift eax right by 4 bits, while padding zeroes
  30     25/and-eax  0xf/imm32
  31     # . AL = to-hex-char(AL)
- 32     e8/call  to-hex-char/disp32
+ 32     e8/call  to-hex-char/disp32
  33     # append-byte(f, AL)
  34     # . . push args
  35     50/push-eax
@@ -103,7 +103,7 @@ if ('onhashchange' in window) {
  42     8b/copy                         1/mod/*+disp8   5/rm32/ebp    .           .             .           0/r32/eax   0xc/disp8       .                 # copy *(ebp+12) to eax
  43     25/and-eax  0xf/imm32
  44     # . AL = to-hex-char(AL)
- 45     e8/call  to-hex-char/disp32
+ 45     e8/call  to-hex-char/disp32
  46     # append-byte(f, AL)
  47     # . . push args
  48     50/push-eax
@@ -135,7 +135,7 @@ if ('onhashchange' in window) {
  74     68/push  0xa/imm32
  75     68/push  _test-stream/imm32
  76     # . . call
- 77     e8/call  append-byte-hex/disp32
+ 77     e8/call  append-byte-hex/disp32
  78     # . . discard args
  79     81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               8/imm32           # add to esp
  80     # check-stream-equal(_test-stream, "0a", msg)
@@ -151,7 +151,7 @@ if ('onhashchange' in window) {
  90     c3/return
  91 
  92 # print the hex representation for the lowest byte of a number
- 93 print-byte-buffered:  # f: (addr buffered-file), n: int
+ 93 write-byte-hex-buffered:  # f: (addr buffered-file), n: int
  94     # . prologue
  95     55/push-ebp
  96     89/copy                         3/mod/direct    5/rm32/ebp    .           .             .           4/r32/esp   .               .                 # copy esp to ebp
@@ -162,7 +162,7 @@ if ('onhashchange' in window) {
 101     c1/shift    5/subop/logic-right 3/mod/direct    0/rm32/eax    .           .             .           .           .               4/imm8            # shift eax right by 4 bits, while padding zeroes
 102     25/and-eax  0xf/imm32
 103     # . AL = to-hex-char(AL)
-104     e8/call  to-hex-char/disp32
+104     e8/call  to-hex-char/disp32
 105     # write-byte-buffered(f, AL)
 106     # . . push args
 107     50/push-eax
@@ -175,7 +175,7 @@ if ('onhashchange' in window) {
 114     8b/copy                         1/mod/*+disp8   5/rm32/ebp    .           .             .           0/r32/eax   0xc/disp8       .                 # copy *(ebp+12) to eax
 115     25/and-eax  0xf/imm32
 116     # . AL = to-hex-char(AL)
-117     e8/call  to-hex-char/disp32
+117     e8/call  to-hex-char/disp32
 118     # write-byte-buffered(f, AL)
 119     # . . push args
 120     50/push-eax
@@ -184,7 +184,7 @@ if ('onhashchange' in window) {
 123     e8/call  write-byte-buffered/disp32
 124     # . . discard args
 125     81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               8/imm32           # add to esp
-126 $print-byte-buffered:end:
+126 $write-byte-hex-buffered:end:
 127     # . restore registers
 128     58/pop-to-eax
 129     # . epilogue
@@ -192,8 +192,8 @@ if ('onhashchange' in window) {
 131     5d/pop-to-ebp
 132     c3/return
 133 
-134 test-print-byte-buffered:
-135     # - check that print-byte-buffered prints the hex textual representation
+134 test-write-byte-hex-buffered:
+135     # - check that write-byte-hex-buffered prints the hex textual representation
 136     # setup
 137     # . clear-stream(_test-stream)
 138     # . . push args
@@ -209,12 +209,12 @@ if ('onhashchange' in window) {
 148     e8/call  clear-stream/disp32
 149     # . . discard args
 150     81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               4/imm32           # add to esp
-151     # print-byte-buffered(_test-buffered-file, 0xa)  # exercises digit, non-digit as well as leading zero
+151     # write-byte-hex-buffered(_test-buffered-file, 0xa)  # exercises digit, non-digit as well as leading zero
 152     # . . push args
 153     68/push  0xa/imm32
 154     68/push  _test-buffered-file/imm32
 155     # . . call
-156     e8/call  print-byte-buffered/disp32
+156     e8/call  write-byte-hex-buffered/disp32
 157     # . . discard args
 158     81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               8/imm32           # add to esp
 159     # flush(_test-buffered-file)
@@ -226,7 +226,7 @@ if ('onhashchange' in window) {
 165     81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               4/imm32           # add to esp
 166     # check-stream-equal(_test-stream, "0a", msg)
 167     # . . push args
-168     68/push  "F - test-print-byte-buffered"/imm32
+168     68/push  "F - test-write-byte-hex-buffered"/imm32
 169     68/push  "0a"/imm32
 170     68/push  _test-stream/imm32
 171     # . . call
@@ -236,7 +236,7 @@ if ('onhashchange' in window) {
 175     # . end
 176     c3/return
 177 
-178 print-int32:  # f: (addr stream byte), n: int
+178 write-int32-hex:  # f: (addr stream byte), n: int
 179     # pseudocode:
 180     #  write(f, "0x")
 181     #  ecx = 28
@@ -255,7 +255,7 @@ if ('onhashchange' in window) {
 194     51/push-ecx
 195     # ecx = 28
 196     b9/copy-to-ecx  0x1c/imm32
-197 $print-int32:print-hex-prefix:
+197 $write-int32-hex:hex-prefix:
 198     # write(f, "0x")
 199     # . . push args
 200     68/push  "0x"/imm32
@@ -264,16 +264,16 @@ if ('onhashchange' in window) {
 203     e8/call  write/disp32
 204     # . . discard args
 205     81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               8/imm32           # add to esp
-206 $print-int32:loop:
+206 $write-int32-hex:loop:
 207     # if (ecx < 0) break
 208     81          7/subop/compare     3/mod/direct    1/rm32/ecx    .           .             .           .           .               0/imm32           # compare ecx
-209     7c/jump-if-<  $print-int32:end/disp8
+209     7c/jump-if-<  $write-int32-hex:end/disp8
 210     # eax = n >> ecx
 211     8b/copy                         1/mod/*+disp8   5/rm32/ebp    .           .             .           0/r32/eax   0xc/disp8       .                 # copy *(ebp+12) to eax
 212     d3/>>ecx    5/subop/pad-zeroes  3/mod/direct    0/rm32/eax    .           .             .           .           .               .                 # shift eax right by ecx bits, padding zeroes
 213     # eax = to-hex-char(AL)
 214     25/and-eax  0xf/imm32
-215     e8/call  to-hex-char/disp32
+215     e8/call  to-hex-char/disp32
 216     # append-byte(f, AL)
 217     # . . push args
 218     50/push-eax
@@ -284,8 +284,8 @@ if ('onhashchange' in window) {
 223     81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               8/imm32           # add to esp
 224     # ecx -= 4
 225     81          5/subop/subtract    3/mod/direct    1/rm32/ecx    .           .             .           .           .               4/imm32           # subtract from ecx
-226     eb/jump  $print-int32:loop/disp8
-227 $print-int32:end:
+226     eb/jump  $write-int32-hex:loop/disp8
+227 $write-int32-hex:end:
 228     # . restore registers
 229     59/pop-to-ecx
 230     58/pop-to-eax
@@ -294,8 +294,8 @@ if ('onhashchange' in window) {
 233     5d/pop-to-ebp
 234     c3/return
 235 
-236 test-print-int32:
-237     # - check that print-int32 prints the hex textual representation
+236 test-write-int32-hex:
+237     # - check that write-int32-hex prints the hex textual representation
 238     # setup
 239     # . clear-stream(_test-stream)
 240     # . . push args
@@ -304,17 +304,17 @@ if ('onhashchange' in window) {
 243     e8/call  clear-stream/disp32
 244     # . . discard args
 245     81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               4/imm32           # add to esp
-246     # print-int32(_test-stream, 0x8899aa)
+246     # write-int32-hex(_test-stream, 0x8899aa)
 247     # . . push args
 248     68/push  0x8899aa/imm32
 249     68/push  _test-stream/imm32
 250     # . . call
-251     e8/call  print-int32/disp32
+251     e8/call  write-int32-hex/disp32
 252     # . . discard args
 253     81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               8/imm32           # add to esp
 254     # check-stream-equal(_test-stream, "0x008899aa", msg)
 255     # . . push args
-256     68/push  "F - test-print-int32"/imm32
+256     68/push  "F - test-write-int32-hex"/imm32
 257     68/push  "0x008899aa"/imm32
 258     68/push  _test-stream/imm32
 259     # . . call
@@ -324,7 +324,7 @@ if ('onhashchange' in window) {
 263     # . end
 264     c3/return
 265 
-266 print-int32-buffered:  # f: (addr buffered-file), n: int
+266 write-int32-hex-buffered:  # f: (addr buffered-file), n: int
 267     # pseudocode:
 268     #  write-buffered(f, "0x")
 269     #  ecx = 28
@@ -343,7 +343,7 @@ if ('onhashchange' in window) {
 282     51/push-ecx
 283     # ecx = 28
 284     b9/copy-to-ecx  0x1c/imm32
-285 $print-int32-buffered:print-hex-prefix:
+285 $write-int32-hex-buffered:hex-prefix:
 286     # write-buffered(f, "0x")
 287     # . . push args
 288     68/push  "0x"/imm32
@@ -352,16 +352,16 @@ if ('onhashchange' in window) {
 291     e8/call  write-buffered/disp32
 292     # . . discard args
 293     81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               8/imm32           # add to esp
-294 $print-int32-buffered:loop:
+294 $write-int32-hex-buffered:loop:
 295     # if (ecx < 0) break
 296     81          7/subop/compare     3/mod/direct    1/rm32/ecx    .           .             .           .           .               0/imm32           # compare ecx
-297     7c/jump-if-<  $print-int32-buffered:end/disp8
+297     7c/jump-if-<  $write-int32-hex-buffered:end/disp8
 298     # eax = n >> ecx
 299     8b/copy                         1/mod/*+disp8   5/rm32/ebp    .           .             .           0/r32/eax   0xc/disp8       .                 # copy *(ebp+12) to eax
 300     d3/>>ecx    5/subop/pad-zeroes  3/mod/direct    0/rm32/eax    .           .             .           .           .               .                 # shift eax right by ecx bits, padding zeroes
 301     # eax = to-hex-char(AL)
 302     25/and-eax  0xf/imm32
-303     e8/call  to-hex-char/disp32
+303     e8/call  to-hex-char/disp32
 304     # write-byte-buffered(f, AL)
 305     # . . push args
 306     50/push-eax
@@ -372,8 +372,8 @@ if ('onhashchange' in window) {
 311     81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               8/imm32           # add to esp
 312     # ecx -= 4
 313     81          5/subop/subtract    3/mod/direct    1/rm32/ecx    .           .             .           .           .               4/imm32           # subtract from ecx
-314     eb/jump  $print-int32-buffered:loop/disp8
-315 $print-int32-buffered:end:
+314     eb/jump  $write-int32-hex-buffered:loop/disp8
+315 $write-int32-hex-buffered:end:
 316     # . restore registers
 317     59/pop-to-ecx
 318     58/pop-to-eax
@@ -382,8 +382,8 @@ if ('onhashchange' in window) {
 321     5d/pop-to-ebp
 322     c3/return
 323 
-324 test-print-int32-buffered:
-325     # - check that print-int32-buffered prints the hex textual representation
+324 test-write-int32-hex-buffered:
+325     # - check that write-int32-hex-buffered prints the hex textual representation
 326     # setup
 327     # . clear-stream(_test-stream)
 328     # . . push args
@@ -399,12 +399,12 @@ if ('onhashchange' in window) {
 338     e8/call  clear-stream/disp32
 339     # . . discard args
 340     81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               4/imm32           # add to esp
-341     # print-int32-buffered(_test-buffered-file, 0x8899aa)
+341     # write-int32-hex-buffered(_test-buffered-file, 0x8899aa)
 342     # . . push args
 343     68/push  0x8899aa/imm32
 344     68/push  _test-buffered-file/imm32
 345     # . . call
-346     e8/call  print-int32-buffered/disp32
+346     e8/call  write-int32-hex-buffered/disp32
 347     # . . discard args
 348     81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               8/imm32           # add to esp
 349     # flush(_test-buffered-file)
@@ -417,7 +417,7 @@ if ('onhashchange' in window) {
 356 +-- 18 lines: #?     # dump line --------------------------------------------------------------------------------------------------------------------------------------------------------
 374     # check-stream-equal(_test-stream, "0x008899aa", msg)
 375     # . . push args
-376     68/push  "F - test-print-int32-buffered"/imm32
+376     68/push  "F - test-write-int32-hex-buffered"/imm32
 377     68/push  "0x008899aa"/imm32
 378     68/push  _test-stream/imm32
 379     # . . call
-- 
cgit 1.4.1-2-gfad0