5443 - standard library is now self-hosted
Translates 5k lines of input in 26 seconds. I'm not sure why I need to grow the label table. It was already 512 entries long, and I'm only using 373 so far.
This commit is contained in:
parent
f2d6349070
commit
37cf4e0581
BIN
subx/apps/assort
BIN
subx/apps/assort
Binary file not shown.
Binary file not shown.
BIN
subx/apps/hex
BIN
subx/apps/hex
Binary file not shown.
BIN
subx/apps/pack
BIN
subx/apps/pack
Binary file not shown.
|
@ -1,6 +1,6 @@
|
|||
# some common helpers shared by phases of the SubX converter
|
||||
# common helpers shared by phases of the SubX translator
|
||||
|
||||
# - buffer sizes shared by all phases
|
||||
# - some limits on the programs we can translate
|
||||
== data
|
||||
|
||||
# maximum memory available for allocation
|
||||
|
@ -15,6 +15,10 @@ Segment-size:
|
|||
Input-size:
|
||||
0x80000/imm32/512KB
|
||||
|
||||
# maximum size of the 'labels' table in survey.subx
|
||||
Max-labels:
|
||||
0x4000/imm32/1K-labels/16KB
|
||||
|
||||
== code
|
||||
# instruction effective address register displacement immediate
|
||||
# . op subop mod rm32 base index scale r32
|
||||
|
|
BIN
subx/apps/survey
BIN
subx/apps/survey
Binary file not shown.
|
@ -136,16 +136,24 @@ convert: # infile : (address buffered-file), out : (address buffered-file) -> <
|
|||
68/push 0/imm32/read
|
||||
68/push 0/imm32/write
|
||||
89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . . # copy ESP to ECX
|
||||
# var labels/EDX = stream(512 * 16)
|
||||
81 5/subop/subtract 3/mod/direct 4/rm32/ESP . . . . . 0x2000/imm32 # subtract from ESP
|
||||
68/push 0x2000/imm32/length
|
||||
# var labels/EDX = stream(1024 * 16)
|
||||
# . data
|
||||
2b/subtract 0/mod/indirect 5/rm32/.disp32 . . 4/r32/ESP Max-labels/disp32 # subtract *Max-labels from ESP
|
||||
# . length
|
||||
ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Max-labels/disp32 # push *Max-labels
|
||||
# . read
|
||||
68/push 0/imm32/read
|
||||
# . write
|
||||
68/push 0/imm32/write
|
||||
89/copy 3/mod/direct 2/rm32/EDX . . . 4/r32/ESP . . # copy ESP to EDX
|
||||
# var in/ESI = stream(Input-size * 1)
|
||||
# . data
|
||||
2b/subtract 0/mod/indirect 5/rm32/.disp32 . . 4/r32/ESP Input-size/disp32 # subtract *Input-size from ESP
|
||||
# . length
|
||||
ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Input-size/disp32 # push *Input-size
|
||||
# . read
|
||||
68/push 0/imm32/read
|
||||
# . write
|
||||
68/push 0/imm32/write
|
||||
89/copy 3/mod/direct 6/rm32/ESI . . . 4/r32/ESP . . # copy ESP to ESI
|
||||
#? # dump labels->write {{{
|
||||
|
|
BIN
subx/apps/tests
BIN
subx/apps/tests
Binary file not shown.
Loading…
Reference in New Issue