about summary refs log tree commit diff stats
path: root/subx
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2018-11-24 23:12:37 -0800
committerKartik Agaram <vc@akkartik.com>2018-11-24 23:14:21 -0800
commit31ff94214bb9ae2f60b10bb9fa5ea468b141f752 (patch)
tree72fa35382edff6beafa603678045399a611492f2 /subx
parent732cf4e7cc05f00473663855271ec9b6a07d0196 (diff)
downloadmu-31ff94214bb9ae2f60b10bb9fa5ea468b141f752.tar.gz
4774
Simplification.
Diffstat (limited to 'subx')
-rwxr-xr-xsubx/apps/crenshaw2-1bin7149 -> 7048 bytes
-rw-r--r--subx/apps/crenshaw2-1.subx21
-rwxr-xr-xsubx/test_apps4
3 files changed, 2 insertions, 23 deletions
diff --git a/subx/apps/crenshaw2-1 b/subx/apps/crenshaw2-1
index eef31d14..1396ede0 100755
--- a/subx/apps/crenshaw2-1
+++ b/subx/apps/crenshaw2-1
Binary files differdiff --git a/subx/apps/crenshaw2-1.subx b/subx/apps/crenshaw2-1.subx
index 47574d60..3abf7365 100644
--- a/subx/apps/crenshaw2-1.subx
+++ b/subx/apps/crenshaw2-1.subx
@@ -194,9 +194,6 @@ get-num:  # in : (address buffered-file), out : (address stream), err : fd or (a
   # pseudocode:
   #   if !is-digit?(Look) expected(ed, err, "integer")
   #   do
-  #     if Look > 0xff
-  #       write(err, "Error: tried to write too large a value into a single byte\n")
-  #       stop(ed, 1)
   #     if out.write >= out.length
   #       write(err, "Error: too many digits in number\n")
   #       stop(ed, 1)
@@ -258,23 +255,9 @@ $get-num:main:
     # EDX = out->length
   8b/copy                         1/mod/*+disp8   7/rm32/EDI    .           .             .           2/r32/EDX   8/disp8         .                 # copy *(EDI+8) to EDX
 $get-num:loop:
-  # if Look > 0xff error
-  8b/copy                         0/mod/indirect  5/rm32/.disp32            .             .           0/r32/EAX   Look/disp32     .                 # copy *Look to EAX
-  3d/compare-EAX  0xff/imm32
-  7e/jump-if-lesser-or-equal  $get-num:loop-stage2/disp8
-    # error(ed, err, "get-num: tried to write too large a value into a single byte")  # TODO: show value being printed
-      # push args
-  68/push  "get-num: tried to write too large a value into a single byte"/imm32
-  ff          6/subop/push        1/mod/*+disp8   4/rm32/sib    5/base/EBP  4/index/none  .           .           0x10/disp8      .                 # push *(EBP+16)
-  ff          6/subop/push        1/mod/*+disp8   4/rm32/sib    5/base/EBP  4/index/none  .           .           0x14/disp8      .                 # push *(EBP+20)
-      # call
-  e8/call  error/disp32  # never returns
-      # discard args
-  81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               0xc/imm32         # add to ESP
-$get-num:loop-stage2:
   # if out->write >= out->length error
   3b/compare                      3/mod/direct    1/rm32/ECX    .           .             .           2/r32/EDX   .               .                 # compare EDX with ECX
-  7d/jump-if-lesser  $get-num:loop-stage3/disp8
+  7d/jump-if-lesser  $get-num:loop-stage2/disp8
     # error(ed, err, "get-num: too many digits in number")  # TODO: show full number
       # push args
   68/push  "get-num: too many digits in number"/imm32
@@ -284,7 +267,7 @@ $get-num:loop-stage2:
   e8/call  error/disp32  # never returns
       # discard args
   81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               0xc/imm32         # add to ESP
-$get-num:loop-stage3:
+$get-num:loop-stage2:
   # out->data[out->write] = LSB(Look)
   8d/copy-address                 1/mod/*+disp8   4/rm32/sib    7/base/EDI  1/index/ECX   .           3/r32/EBX   0xc/disp8       .                 # copy EDI+ECX+12 to EBX
   8b/copy                         0/mod/indirect  5/rm32/.disp32            .             .           0/r32/EAX   Look/disp32     .                 # copy *Look to EAX
diff --git a/subx/test_apps b/subx/test_apps
index 75bdc6b5..8c97c521 100755
--- a/subx/test_apps
+++ b/subx/test_apps
@@ -143,13 +143,9 @@ test `uname` = 'Linux'  &&  {
 echo crenshaw2-1
 CFLAGS=-g ./subx translate *.subx apps/crenshaw2-1.subx  -o apps/crenshaw2-1
 [ "$1" != record ]  &&  git diff --quiet apps/crenshaw2-1
-CFLAGS=-g ./subx run apps/crenshaw2-1 2>crenshaw2-1.out  ||  true
-test "`cat crenshaw2-1.out`" = 'Error: integer expected'
 CFLAGS=-g ./subx run apps/crenshaw2-1 test
 echo
 test `uname` = 'Linux'  &&  {
-  apps/crenshaw2-1 2>crenshaw2-1.out  ||  true
-  test "`cat crenshaw2-1.out`" = 'Error: integer expected'
   apps/crenshaw2-1 test
   echo
 }