about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rwxr-xr-xsubx/apps/packbin20762 -> 20768 bytes
-rw-r--r--subx/apps/pack.subx14
2 files changed, 6 insertions, 8 deletions
diff --git a/subx/apps/pack b/subx/apps/pack
index ef1f5847..075dc69b 100755
--- a/subx/apps/pack
+++ b/subx/apps/pack
Binary files differdiff --git a/subx/apps/pack.subx b/subx/apps/pack.subx
index 04814d66..07988399 100644
--- a/subx/apps/pack.subx
+++ b/subx/apps/pack.subx
@@ -84,12 +84,12 @@ $main:end:
 
 convert:  # in : (address buffered-file), out : (address buffered-file) -> <void>
     # pseudocode:
-    #   line = new-stream(512, 1)
+    #   var line = new-stream(512, 1)
     #   repeatedly
     #     clear-stream(line)
     #     EAX = read-line(in, line)
     #     if EAX == EOF break
-    #     convert-instruction(line, out, err, ed)
+    #     convert-instruction(line, out)
     #   flush(out)
     #
     # . prolog
@@ -122,14 +122,14 @@ $convert:loop:
     # if EAX == 0xffffffff break
     3d/compare-with-EAX  0xffffffff/imm32
     74/jump-if-equal  $convert:break/disp8
-    # convert-instruction(line, out, err, ed)
+    # convert-instruction(line, out)
     # . . push args
     ff          6/subop/push        1/mod/*+disp8   5/rm32/EBP    .           .             .           .           0xc/disp8       .                 # push *(EBP+12)
     51/push-ECX
     # . . call
     e8/call  convert-instruction/disp32
     # . . discard args
-    81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               0x10/imm32        # add to ESP
+    81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               8/imm32           # add to ESP
 $convert:break:
     # flush(out)
     # . . push args
@@ -139,6 +139,8 @@ $convert:break:
     # . . discard args
     81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               4/imm32           # add to ESP
 $convert:end:
+    # . reclaim locals
+    81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               0x20c/imm32       # add to ESP
     # . restore registers
     59/pop-to-ECX
     # . epilog
@@ -202,10 +204,6 @@ convert-instruction:  # line : (address stream byte), out : (address buffered-fi
     #     write-stream-buffered(out, line)
     #     return
     #   if starts-with(word-slice, '==')
-    #     segment-name = next-word()
-    #     write-stream-buffered(out, line)
-    #     return
-    #   if segment-name != 'code'
     #     write-stream-buffered(out, line)
     #     return
     #