diff options
author | Kartik Agaram <vc@akkartik.com> | 2019-07-22 17:34:30 -0700 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2019-07-22 17:34:30 -0700 |
commit | d353ec60971d480aa74d92518fdd82c9b1bd4c39 (patch) | |
tree | 7a8016f80491dad8974864aea5f000df8b1f1446 /subx | |
parent | 075bdd9a40f23f312dbcfe94ae0bc9d94eaff000 (diff) | |
download | mu-d353ec60971d480aa74d92518fdd82c9b1bd4c39.tar.gz |
5448
Make the output of the `pack` phase a little easier to read.
Diffstat (limited to 'subx')
-rwxr-xr-x | subx/apps/pack | bin | 46982 -> 47007 bytes | |||
-rw-r--r-- | subx/apps/pack.subx | 20 |
2 files changed, 14 insertions, 6 deletions
diff --git a/subx/apps/pack b/subx/apps/pack index 370ced9b..f3b97218 100755 --- a/subx/apps/pack +++ b/subx/apps/pack Binary files differdiff --git a/subx/apps/pack.subx b/subx/apps/pack.subx index 2715558a..6fef5c37 100644 --- a/subx/apps/pack.subx +++ b/subx/apps/pack.subx @@ -941,6 +941,7 @@ convert-data: # line : (address stream byte), out : (address buffered-file) -> # write-slice-buffered(out, word-slice) # break # if slice-ends-with?(word-slice, ":") # label + # write-buffered(out, "\n") # put labels on their own line # write-stream-data(out, line) # break # if has-metadata?(word-slice, "imm32") @@ -1048,7 +1049,7 @@ $convert-data:check0: 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP # . if (EAX != 0) break 3d/compare-EAX-and 0/imm32 - 0f 85/jump-if-not-equal $convert-data:break/disp32 + 0f 85/jump-if-not-equal $convert-data:end/disp32 $convert-data:check-for-comment: # if (slice-starts-with?(word-slice, "#")) # . start/EDX = word-slice->start @@ -1069,7 +1070,7 @@ $convert-data:comment: # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP # break - 75/jump-if-not-equal $convert-data:break/disp8 + 75/jump-if-not-equal $convert-data:end/disp8 $convert-data:check-for-label: # if (slice-ends-with?(word-slice, ":")) # . end/EDX = word-slice->end @@ -1081,6 +1082,14 @@ $convert-data:check-for-label: 3d/compare-EAX-and 0x3a/imm32/colon 75/jump-if-not-equal $convert-data:check-for-imm32/disp8 $convert-data:label: + # write-buffered(out, "\n") + # . . push args + 68/push "\n"/imm32 + ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0xc/disp8 . # push *(EBP+12) + # . . call + e8/call write-buffered/disp32 + # . . discard args + 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP # write-stream-data(out, line) # . . push args ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 . # push *(EBP+8) @@ -1090,7 +1099,7 @@ $convert-data:label: # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP # break - 75/jump-if-not-equal $convert-data:break/disp8 + 75/jump-if-not-equal $convert-data:end/disp8 $convert-data:check-for-imm32: # if (has-metadata?(word-slice, "imm32")) # . EAX = has-metadata?(ECX, "imm32") @@ -1126,7 +1135,6 @@ $convert-data:single-byte: # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32 # add to ESP e9/jump $convert-data:loop/disp32 -$convert-data:break: $convert-data:end: # . reclaim locals 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP @@ -1287,10 +1295,10 @@ test-convert-data-passes-labels-through: e8/call flush/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP - # . check-stream-equal(_test-output-stream, "ab: # cd", msg) + # . check-stream-equal(_test-output-stream, "\nab: # cd", msg) # . . push args 68/push "F - test-convert-data-passes-labels-through"/imm32 - 68/push "ab: # cd"/imm32 + 68/push "\nab: # cd"/imm32 68/push _test-output-stream/imm32 # . . call e8/call check-stream-equal/disp32 |