diff options
author | Kartik Agaram <vc@akkartik.com> | 2019-07-12 11:26:10 -0700 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2019-07-12 11:26:50 -0700 |
commit | e150e6e46e783d7c1b6e3986204980263ef62713 (patch) | |
tree | 3d7d18e7514a83e15c660285cace6099c256b7cb | |
parent | 38a314d320c78dbb080a012d96207631bce78169 (diff) | |
download | mu-e150e6e46e783d7c1b6e3986204980263ef62713.tar.gz |
the pseudocode is pretty long, so add an outline
-rw-r--r-- | subx/apps/survey.subx | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/subx/apps/survey.subx b/subx/apps/survey.subx index 9a1b1df1..c7f7b0a9 100644 --- a/subx/apps/survey.subx +++ b/subx/apps/survey.subx @@ -335,6 +335,15 @@ compute-offsets:segment-tmp: # slice == code compute-offsets: # in : (address buffered-file), segments : (address stream {string, segment-info}), labels : (address stream {string, label-info}) + # skeleton: + # for lines in 'in' + # for words in line + # switch word + # case 1 + # case 2 + # ... + # default + # # pseudocode: # curr-segment-name : (address string) = 0 # var line = new-stream(512, 1) @@ -710,7 +719,7 @@ $compute-offsets:case-label: 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP # . if (EAX == 0) goto next case 3d/compare-EAX-and 0/imm32 - 74/jump-if-equal $compute-offsets:case-final/disp8 + 74/jump-if-equal $compute-offsets:case-default/disp8 # strip trailing ':' from word-slice ff 1/subop/decrement 1/mod/*+disp8 2/rm32/EDX . . . . 4/disp8 . # decrement *(EDX+4) # x/EAX = get-or-insert-slice(labels, word-slice, row-size=16) @@ -755,7 +764,7 @@ $compute-offsets:case-label: 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0x14/imm32 # add to ESP # continue e9/jump $compute-offsets:word-loop/disp32 -$compute-offsets:case-final: +$compute-offsets:case-default: # width/EAX = compute-width-of-slice(word-slice) # . . push args 52/push-EDX |