From c56d803cd8a0e3f28328f91aa1d457905a68641a Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Fri, 30 Nov 2018 09:43:49 -0800 Subject: 4796 --- html/subx/051test.subx.html | 93 ++++++++++++++++++++++----------------------- 1 file changed, 46 insertions(+), 47 deletions(-) (limited to 'html/subx/051test.subx.html') diff --git a/html/subx/051test.subx.html b/html/subx/051test.subx.html index 724ddbdd..65c34e54 100644 --- a/html/subx/051test.subx.html +++ b/html/subx/051test.subx.html @@ -15,12 +15,11 @@ body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color a { color:#eeeeee; text-decoration: none; } a:hover { text-decoration: underline; } * { font-size: 12pt; font-size: 1em; } +.subxComment { color: #005fff; } .LineNr { color: #444444; } -.Delimiter { color: #800080; } +.CommentedCode { color: #6c6c6c; } .Constant { color: #00a0a0; } .Special { color: #c00000; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } --> @@ -55,91 +54,91 @@ if ('onhashchange' in window) {
- 1 # Rudimentary test harness
+ 1 # Rudimentary test harness
  2 
  3 == code
- 4 # instruction                     effective address                                                   operand     displacement    immediate
- 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
+ 4 # instruction                     effective address                                                   operand     displacement    immediate
+ 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 # main:  (manual test if this is the last file loaded)
- 9   # check-ints-equal(34, 34)
+ 8 # main:  (manual test if this is the last file loaded)
+ 9   # check-ints-equal(34, 34)
 10   68/push  "error in check-ints-equal"/imm32
 11   68/push  34/imm32
 12   68/push  34/imm32
 13   e8/call  check-ints-equal/disp32
-14   81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               0xc/imm32         # add to ESP
-15   # syscall(exit, 0)
+14   81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               0xc/imm32         # add to ESP
+15   # syscall(exit, 0)
 16   bb/copy-to-EBX  0/imm32
 17   b8/copy-to-EAX  1/imm32
 18   cd/syscall  0x80/imm8
 19 
-20 # print msg to stderr if a != b, otherwise print "."
-21 check-ints-equal:  # (a : int, b : int, msg : (address array byte)) -> boolean
-22   # prolog
+20 # print msg to stderr if a != b, otherwise print "."
+21 check-ints-equal:  # (a : int, b : int, msg : (address array byte)) -> boolean
+22   # prolog
 23   55/push-EBP
-24   89/copy                         3/mod/direct    5/rm32/EBP    .           .             .           4/r32/ESP   .               .                 # copy ESP to EBP
-25   # save registers
+24   89/copy                         3/mod/direct    5/rm32/EBP    .           .             .           4/r32/ESP   .               .                 # copy ESP to EBP
+25   # save registers
 26   51/push-ECX
 27   53/push-EBX
-28   # load first 2 args into EAX and EBX
-29   8b/copy                         1/mod/*+disp8   4/rm32/sib    5/base/EBP  4/index/none  .           0/r32/EAX   0x8/disp8       .                 # copy *(EBP+8) to EAX
-30   8b/copy                         1/mod/*+disp8   4/rm32/sib    5/base/EBP  4/index/none  .           3/r32/EBX   0xc/disp8       .                 # copy *(EBP+12) to EBX
-31   # if EAX == b/EBX
-32   39/compare                      3/mod/direct    0/rm32/EAX    .           .             .           3/r32/EBX   .               .                 # compare EAX and EBX
+28   # load first 2 args into EAX and EBX
+29   8b/copy                         1/mod/*+disp8   4/rm32/sib    5/base/EBP  4/index/none  .           0/r32/EAX   0x8/disp8       .                 # copy *(EBP+8) to EAX
+30   8b/copy                         1/mod/*+disp8   4/rm32/sib    5/base/EBP  4/index/none  .           3/r32/EBX   0xc/disp8       .                 # copy *(EBP+12) to EBX
+31   # if EAX == b/EBX
+32   39/compare                      3/mod/direct    0/rm32/EAX    .           .             .           3/r32/EBX   .               .                 # compare EAX and EBX
 33   75/jump-if-unequal  $check-ints-equal:else/disp8
-34     # _write(2/stderr, '.')
-35       # push args
+34     # _write(2/stderr, '.')
+35       # push args
 36   68/push  "."/imm32
 37   68/push  2/imm32/stderr
-38       # call
+38       # call
 39   e8/call  _write/disp32
-40       # discard args
-41   81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               8/imm32           # add to ESP
-42     # return
+40       # discard args
+41   81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               8/imm32           # add to ESP
+42     # return
 43   eb/jump  $check-ints-equal:end/disp8
-44   # else:
+44   # else:
 45 $check-ints-equal:else:
-46     # _write(2/stderr, msg)
-47       # push args
-48   8b/copy                         1/mod/*+disp8   4/rm32/sib    5/base/EBP  4/index/none  .           1/r32/ECX   0x10/disp8      .                 # copy *(EBP+16) to ECX
+46     # _write(2/stderr, msg)
+47       # push args
+48   8b/copy                         1/mod/*+disp8   4/rm32/sib    5/base/EBP  4/index/none  .           1/r32/ECX   0x10/disp8      .                 # copy *(EBP+16) to ECX
 49   51/push-ECX
 50   68/push  2/imm32/stderr
-51       # call
+51       # call
 52   e8/call  _write/disp32
-53       # discard args
-54   81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               8/imm32           # add to ESP
-55     # _write(2/stderr, Newline)
-56       # push args
+53       # discard args
+54   81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               8/imm32           # add to ESP
+55     # _write(2/stderr, Newline)
+56       # push args
 57   68/push  Newline/imm32
 58   68/push  2/imm32/stderr
-59       # call
+59       # call
 60   e8/call  _write/disp32
-61       # discard args
-62   81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               8/imm32           # add to ESP
-63     # increment Num-test-failures
-64   ff          0/subop/increment   0/mod/indirect  5/rm32/.disp32            .             .           .           Num-test-failures/disp32          # increment *Num-test-failures
+61       # discard args
+62   81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               8/imm32           # add to ESP
+63     # increment Num-test-failures
+64   ff          0/subop/increment   0/mod/indirect  5/rm32/.disp32            .             .           .           Num-test-failures/disp32          # increment *Num-test-failures
 65 $check-ints-equal:end:
-66   # restore registers
+66   # restore registers
 67   5b/pop-to-EBX
 68   59/pop-to-ECX
-69   # epilog
-70   89/copy                         3/mod/direct    4/rm32/ESP    .           .             .           5/r32/EBP   .               .                 # copy EBP to ESP
+69   # epilog
+70   89/copy                         3/mod/direct    4/rm32/ESP    .           .             .           5/r32/EBP   .               .                 # copy EBP to ESP
 71   5d/pop-to-EBP
 72   c3/return
 73 
 74 == data
 75 
 76 Newline:
-77   # size
+77   # size
 78   01 00 00 00
-79   # data
+79   # data
 80   0a/newline
 81 
 82 Num-test-failures:
 83   00 00 00 00
 84 
-85 # vim:nowrap:textwidth=0
+85 # vim:nowrap:textwidth=0
 
-- cgit 1.4.1-2-gfad0