From ba932346031591e6f5fe687a20771b26d0e03055 Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Tue, 9 Jul 2019 16:32:06 -0700 Subject: 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. --- subx/apps/survey | Bin 37352 -> 37339 bytes subx/apps/survey.subx | 22 ++++++++++------------ 2 files changed, 10 insertions(+), 12 deletions(-) (limited to 'subx/apps') diff --git a/subx/apps/survey b/subx/apps/survey index ee90a577..6b6d3745 100755 Binary files a/subx/apps/survey and b/subx/apps/survey differ diff --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 -- cgit 1.4.1-2-gfad0