about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2019-07-09 16:32:06 -0700
committerKartik Agaram <vc@akkartik.com>2019-07-09 16:32:06 -0700
commitba932346031591e6f5fe687a20771b26d0e03055 (patch)
tree1b54c8ee2e8d124c29738d135a879dfb841bdc8f
parenteb4b45db40c2bdaef35f3e5b2388b59349ace1b6 (diff)
downloadmu-ba932346031591e6f5fe687a20771b26d0e03055.tar.gz
move 'segment-start' to a global variable as well
It's ugly to have function locals in global variables, but we'll figure
out later how to deal with it.
-rwxr-xr-xsubx/apps/surveybin37352 -> 37339 bytes
-rw-r--r--subx/apps/survey.subx22
2 files changed, 10 insertions, 12 deletions
diff --git a/subx/apps/survey b/subx/apps/survey
index ee90a577..6b6d3745 100755
--- a/subx/apps/survey
+++ b/subx/apps/survey
Binary files differdiff --git a/subx/apps/survey.subx b/subx/apps/survey.subx
index 3e0d7258..b9089417 100644
--- a/subx/apps/survey.subx
+++ b/subx/apps/survey.subx
@@ -332,6 +332,9 @@ compute-offsets:word-slice:
   0/imm32/start
 compute-offsets:word-slice:end:
   0/imm32/end
+compute-offsets:segment-start:
+  0/imm32/start
+  0/imm32/end
 
 == code
 
@@ -568,19 +571,15 @@ $compute-offsets:construct-next-segment:
     3d/compare-EAX-and  1/imm32
     # . if so, abort
     0f 84/jump-if-equal  $compute-offsets:abort/disp32
-    # segment-start/EBX = {0, 0}
-    68/push  0/imm32
-    68/push  0/imm32
-    89/copy                         3/mod/direct    3/rm32/EBX    .           .             .           4/r32/ESP   .               .                 # copy ESP to EBX
-    # next-word(line/ECX, segment-start/EBX)
-    53/push-EBX
+    # next-word(line/ECX, segment-start)
+    68/push  compute-offsets:segment-start/imm32
     51/push-ECX
     e8/call  next-word/disp32
     # . discard args
     81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               8/imm32           # add to ESP
-    # if slice-empty?(segment-start/EBX) abort
-    # . EAX = slice-empty?(segment-start/EBX)
-    53/push-EBX
+    # if slice-empty?(segment-start) abort
+    # . EAX = slice-empty?(segment-start)
+    68/push  compute-offsets:segment-start/imm32
     e8/call  slice-empty?/disp32
     # . . discard args
     81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               4/imm32           # add to ESP
@@ -588,8 +587,6 @@ $compute-offsets:construct-next-segment:
     3d/compare-EAX-and  1/imm32
     # . if so, abort
     0f 84/jump-if-equal  $compute-offsets:abort/disp32
-    # save segment-start/EBX (and prep for parse-hex-int call)
-    53/push-EBX
     # seg/EBX = get-or-insert-slice(segments, curr-segment-name, row-size=16)
     # . . push args
     68/push  0x10/imm32/row-size
@@ -601,8 +598,9 @@ $compute-offsets:construct-next-segment:
     81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               0xc/imm32         # add to ESP
     # . EBX = EAX
     89/copy                         3/mod/direct    3/rm32/EBX    .           .             .           0/r32/EAX   .               .                 # copy EAX to EBX
-    # seg->address = parse-hex-int(segment-start (already on stack))
+    # seg->address = parse-hex-int(segment-start)
     # . EAX = parse-hex-int(segment-start)
+    68/push  compute-offsets:segment-start/imm32
     e8/call  parse-hex-int/disp32
     # . . discard args
     81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               4/imm32           # add to ESP