I think I don't need to special-case packing for different segments. That
should massively cut down on the number of tests.
This commit is contained in:
Kartik Agaram 2019-02-13 11:28:21 -08:00
parent a630d7fb96
commit 1ab48a69cc
2 changed files with 6 additions and 8 deletions

Binary file not shown.

View File

@ -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
#