Refactoring and cleanup.
This commit is contained in:
parent
04b021846a
commit
67583716f2
|
|
@ -1,97 +1,97 @@
|
||||||
[word(0),
|
[word(0),
|
||||||
do_offset(_6814),
|
do_offset(_7362),
|
||||||
allocate(_6824,20),
|
allocate(_7372,20),
|
||||||
label(_6814),
|
label(_7362),
|
||||||
mov_imm(0,0),
|
mov_imm(0,0),
|
||||||
store_word(0,0,0),
|
store_word(0,0,0),
|
||||||
mov_imm(0,4096),
|
mov_imm(0,4096),
|
||||||
mov_imm(1,_6886),
|
mov_imm(1,_7434),
|
||||||
mov_imm(2,0),
|
mov_imm(2,0),
|
||||||
mov_imm(3,0),
|
mov_imm(3,0),
|
||||||
store_word(2,0,0),
|
store_word(2,0,0),
|
||||||
label(_6934),
|
label(_7482),
|
||||||
sub_imm(1,1,0),
|
sub_imm(1,1,0),
|
||||||
eq_offset(_6946),
|
eq_offset(_7494),
|
||||||
load_word(4,1,0),
|
load_word(4,1,0),
|
||||||
lsl_imm(5,4,2),
|
lsl_imm(5,4,2),
|
||||||
asr_imm(5,5,17),
|
asr_imm(5,5,17),
|
||||||
eq_offset(_7034),
|
eq_offset(_7610),
|
||||||
add(5,5,1),
|
add(5,5,1),
|
||||||
label(_7034),
|
label(_7610),
|
||||||
load_word(3,5,0),
|
|
||||||
lsl_imm(6,4,17),
|
lsl_imm(6,4,17),
|
||||||
asr_imm(6,6,17),
|
asr_imm(6,6,17),
|
||||||
eq_offset(_7110),
|
eq_offset(_7672),
|
||||||
add(6,6,1),
|
add(6,6,1),
|
||||||
label(_7110),
|
label(_7672),
|
||||||
|
load_word(3,5,0),
|
||||||
mov(1,6),
|
mov(1,6),
|
||||||
asr_imm(6,3,30),
|
asr_imm(6,3,30),
|
||||||
and_imm(6,6,2),
|
and_imm(6,6,2),
|
||||||
sub_imm(6,6,2),
|
sub_imm(6,6,2),
|
||||||
ne_offset(_7198),
|
ne_offset(_7774),
|
||||||
mov_imm_with_shift(6,16383),
|
mov_imm_with_shift(6,16383),
|
||||||
ior_imm(6,6,65535),
|
ior_imm(6,6,65535),
|
||||||
and(6,6,3),
|
and(6,6,3),
|
||||||
do(6),
|
do(6),
|
||||||
label(_7198),
|
label(_7774),
|
||||||
sub_imm(0,0,4),
|
sub_imm(0,0,4),
|
||||||
sub(2,5,0),
|
sub(2,5,0),
|
||||||
hi_offset(_7296),
|
hi_offset(_7872),
|
||||||
and_imm(2,2,32767),
|
and_imm(2,2,32767),
|
||||||
label(_7296),
|
label(_7872),
|
||||||
lsl_imm(2,2,15),
|
lsl_imm(2,2,15),
|
||||||
ior_imm(2,2,4),
|
ior_imm(2,2,4),
|
||||||
label(_7358),
|
label(_7934),
|
||||||
store_word(2,0,0),
|
store_word(2,0,0),
|
||||||
do_offset(_6934),
|
do_offset(_7482),
|
||||||
label(_6946),
|
label(_7494),
|
||||||
do_offset(_6946),
|
do_offset(_7494),
|
||||||
label(_7412),
|
label(_7988),
|
||||||
lsl_imm(6,2,2),
|
lsl_imm(6,2,2),
|
||||||
asr_imm(6,6,17),
|
asr_imm(6,6,17),
|
||||||
eq_offset(_7494),
|
eq_offset(_8070),
|
||||||
add(6,6,0),
|
add(6,6,0),
|
||||||
label(_7494),
|
label(_8070),
|
||||||
lsl_imm(2,2,17),
|
lsl_imm(2,2,17),
|
||||||
asr_imm(2,2,17),
|
asr_imm(2,2,17),
|
||||||
eq_offset(_7556),
|
eq_offset(_8132),
|
||||||
add(2,2,0),
|
add(2,2,0),
|
||||||
label(_7556),
|
label(_8132),
|
||||||
load_word(7,2,0),
|
load_word(7,2,0),
|
||||||
lsl_imm(8,7,2),
|
lsl_imm(8,7,2),
|
||||||
asr_imm(8,8,17),
|
asr_imm(8,8,17),
|
||||||
eq_offset(_7632),
|
eq_offset(_8208),
|
||||||
add(8,8,2),
|
add(8,8,2),
|
||||||
label(_7632),
|
label(_8208),
|
||||||
lsl_imm(9,7,17),
|
lsl_imm(9,7,17),
|
||||||
asr_imm(9,9,17),
|
asr_imm(9,9,17),
|
||||||
eq_offset(_7694),
|
eq_offset(_8270),
|
||||||
add(9,9,2),
|
add(9,9,2),
|
||||||
label(_7694),
|
label(_8270),
|
||||||
sub_imm(0,0,4),
|
sub_imm(0,0,4),
|
||||||
sub_imm(8,8,0),
|
sub_imm(8,8,0),
|
||||||
eq_offset(_7762),
|
eq_offset(_8338),
|
||||||
sub(8,8,0),
|
sub(8,8,0),
|
||||||
and_imm(8,8,32767),
|
and_imm(8,8,32767),
|
||||||
label(_7762),
|
label(_8338),
|
||||||
sub_imm(6,6,0),
|
sub_imm(6,6,0),
|
||||||
eq_offset(_7830),
|
eq_offset(_8406),
|
||||||
sub(6,6,0),
|
sub(6,6,0),
|
||||||
and_imm(6,6,32767),
|
and_imm(6,6,32767),
|
||||||
label(_7830),
|
label(_8406),
|
||||||
lsl_imm(8,8,15),
|
lsl_imm(8,8,15),
|
||||||
ior(8,8,6),
|
ior(8,8,6),
|
||||||
store_word(8,0,0),
|
store_word(8,0,0),
|
||||||
sub_imm(0,0,4),
|
sub_imm(0,0,4),
|
||||||
sub_imm(9,9,0),
|
sub_imm(9,9,0),
|
||||||
eq_offset(_7960),
|
eq_offset(_8536),
|
||||||
sub(9,9,0),
|
sub(9,9,0),
|
||||||
and_imm(9,9,32767),
|
and_imm(9,9,32767),
|
||||||
label(_7960),
|
label(_8536),
|
||||||
mov_imm_with_shift(2,2),
|
mov_imm_with_shift(2,2),
|
||||||
ior(2,2,9),
|
ior(2,2,9),
|
||||||
do_offset(_7358),
|
do_offset(_7934),
|
||||||
label(_6886),
|
label(_7434),
|
||||||
expr_cell(_8078,0),
|
expr_cell(_8654,0),
|
||||||
label(_8078),
|
label(_8654),
|
||||||
symbol(_7412)]
|
symbol(_7988)]
|
||||||
|
|
@ -44,31 +44,17 @@ Mark II
|
||||||
mov_imm(TERM, 0),
|
mov_imm(TERM, 0),
|
||||||
store_word(TOS, SP, 0), % RAM[SP] := 0
|
store_word(TOS, SP, 0), % RAM[SP] := 0
|
||||||
|
|
||||||
label(Main)],
|
label(Main)
|
||||||
⟐([
|
],⟐([
|
||||||
if_zero(EXPR_addr, HALT),
|
if_zero(EXPR_addr, HALT),
|
||||||
load(EXPR, EXPR_addr)
|
load(EXPR, EXPR_addr),
|
||||||
]),[
|
|
||||||
% At this point EXPR holds the record word of the expression.
|
% At this point EXPR holds the record word of the expression.
|
||||||
lsl_imm(TermAddr, EXPR, 2), % Trim off the type tag 00 bits.
|
unpack_pair(EXPR, TermAddr, TEMP0, EXPR_addr),
|
||||||
asr_imm(TermAddr, TermAddr, 17), % preserve sign of offset.
|
load(TERM, TermAddr)
|
||||||
eq_offset(Foo), % if the offset is zero don't add the address. it's empty list.
|
]),[
|
||||||
add(TermAddr, TermAddr, EXPR_addr),
|
|
||||||
label(Foo),
|
|
||||||
|
|
||||||
% TermAddr has the address of the term record.
|
% TermAddr has the address of the term record.
|
||||||
|
% Now TERM has the term's record data and TermAddr has the address of the term.
|
||||||
load_word(TERM, TermAddr, 0), % Bring the record in from RAM.
|
|
||||||
|
|
||||||
% Now Term has the term's record data and TermAddr has the address of the term.
|
|
||||||
|
|
||||||
lsl_imm(TEMP0, EXPR, 17), % Get the offset of the tail of the expr
|
|
||||||
asr_imm(TEMP0, TEMP0, 17), % while preserving the sign.
|
|
||||||
eq_offset(Foo0), % if the offset is zero don't add the address. it's empty list.
|
|
||||||
add(TEMP0, TEMP0, EXPR_addr), % Add the address to the offset.
|
|
||||||
label(Foo0),
|
|
||||||
mov(EXPR_addr, TEMP0),
|
mov(EXPR_addr, TEMP0),
|
||||||
|
|
||||||
% EXPR_addr now holds the address of the next cell of the expression list.
|
% EXPR_addr now holds the address of the next cell of the expression list.
|
||||||
|
|
||||||
% if_literal(TERM, PUSH),
|
% if_literal(TERM, PUSH),
|
||||||
|
|
@ -123,20 +109,18 @@ Mark II
|
||||||
|
|
||||||
% Build and write the new list cell.
|
% Build and write the new list cell.
|
||||||
sub_imm(SP, SP, 4)
|
sub_imm(SP, SP, 4)
|
||||||
|
|
||||||
],⟐([
|
],⟐([
|
||||||
|
|
||||||
sub_base_from_offset(TEMP2, SP),
|
sub_base_from_offset(TEMP2, SP),
|
||||||
sub_base_from_offset(TEMP0, SP)
|
sub_base_from_offset(TEMP0, SP)
|
||||||
|
|
||||||
]),[
|
]),[
|
||||||
|
|
||||||
lsl_imm(TEMP2, TEMP2, 15), % TEMP2 := TEMP2 << 15
|
lsl_imm(TEMP2, TEMP2, 15), % TEMP2 := TEMP2 << 15
|
||||||
ior(TEMP2, TEMP2, TEMP0),
|
ior(TEMP2, TEMP2, TEMP0),
|
||||||
store_word(TEMP2, SP, 0),
|
store_word(TEMP2, SP, 0),
|
||||||
|
|
||||||
sub_imm(SP, SP, 4) ],⟐(
|
sub_imm(SP, SP, 4)
|
||||||
sub_base_from_offset(TEMP3, SP) ),[
|
],⟐(
|
||||||
|
sub_base_from_offset(TEMP3, SP)
|
||||||
|
),[
|
||||||
mov_imm_with_shift(TOS, 2), % TOS := 4 << 15
|
mov_imm_with_shift(TOS, 2), % TOS := 4 << 15
|
||||||
ior(TOS, TOS, TEMP3),
|
ior(TOS, TOS, TEMP3),
|
||||||
do_offset(Done), % Rely on mainloop::Done to write TOS to RAM.
|
do_offset(Done), % Rely on mainloop::Done to write TOS to RAM.
|
||||||
|
|
|
||||||
Binary file not shown.
Loading…
Reference in New Issue