diff --git a/thun/asm-dump.txt b/thun/asm-dump.txt index 384256b..3b4437a 100644 --- a/thun/asm-dump.txt +++ b/thun/asm-dump.txt @@ -5,13 +5,13 @@ label(A), mov_imm(0, 0), store_word(0, 0, 0), mov_imm(0, 4096), -mov_imm(1, R), +mov_imm(1, S), mov_imm(2, 0), mov_imm(3, 0), store_word(2, 0, 0), -label(F), +label(H), sub_imm(1, 1, 0), -eq_offset(G), +eq_offset(I), load_word(4, 1, 0), lsl_imm(5, 4, 2), asr_imm(5, 5, 17), @@ -24,8 +24,7 @@ eq_offset(C), add(6, 6, 1), label(C), load_word(3, 5, 0), -mov(1, -6), +mov(1,6), asr_imm(6, 3, 30), and_imm(6, 6, 2), sub_imm(6, 6, 2), @@ -36,68 +35,71 @@ and(6, 6, 3), do(6), label(D), sub_imm(0, 0, 4), +sub_imm(5, 5, 0), +eq_offset(F), sub(2, 5, 0), hi_offset(E), and_imm(2, 2, 32767), label(E), lsl_imm(2, 2, 15), ior_imm(2, 2, 4), -label(P), -store_word(2, 0, 0), -do_offset(F), -label(G), do_offset(G), -label(H), -symbol(H), +label(F), +mov_imm(2, 4), +label(G), +store_word(2, 0, 0), +do_offset(H), +label(I), +do_offset(I),label(J), +symbol(J), lsl_imm(6, 2, 2), asr_imm(6, 6, 17), -eq_offset(I), +eq_offset(K), add(6, 6, 0), -label(I), +label(K), lsl_imm(2, 2, 17), asr_imm(2, 2, 17), -eq_offset(J), +eq_offset(L), add(2, 2, 0), -label(J), +label(L), load_word(7, 2, 0), lsl_imm(8, 7, 2), asr_imm(8, 8, 17), -eq_offset(K), +eq_offset(M), add(8, 8, 2), -label(K), +label(M), lsl_imm(9, 7, 17), asr_imm(9, 9, 17), -eq_offset(L), +eq_offset(N), add(9, 9, 2), -label(L), +label(N), sub_imm(0, 0, 4), sub_imm(8, 8, 0), -eq_offset(M), +eq_offset(O), sub(8, 8, 0), and_imm(8, 8, 32767), -label(M), +label(O), sub_imm(6, 6, 0), -eq_offset(N), +eq_offset(P), sub(6, 6, 0), and_imm(6, 6, 32767), -label(N), +label(P), lsl_imm(8, 8, 15), ior(8, 8, 6), store_word(8, 0, 0), sub_imm(0, 0, 4), sub_imm(9, 9, 0), -eq_offset(O), +eq_offset(Q), sub(9, 9, 0), and_imm(9, 9, 32767), -label(O), +label(Q), mov_imm_with_shift(2, 2), ior(2, 2, 9), -do_offset(P), -label(Q), -symbol(Q), -lsl_imm(5, 2, -2), +do_offset(G), +label(R), +symbol(R), +lsl_imm(5, 2, 2), asr_imm(5, 5, 17), do_offset(D), -label(R), -expr_cell(Q, 0)]. \ No newline at end of file +label(S), +expr_cell(R, 0)]. \ No newline at end of file diff --git a/thun/compiler.markII.pl b/thun/compiler.markII.pl index 8b070c0..95a742c 100644 --- a/thun/compiler.markII.pl +++ b/thun/compiler.markII.pl @@ -62,7 +62,8 @@ Mark II % going into push we have the term label(PUSH), % push2(TOS, TEMP1, SP), % stack = TERM, stack - incr(SP) + incr(SP), + if_zero(TermAddr, JustPushEmptyList) ]),[ % SP points to the future home of the new stack cell. sub(TOS, TermAddr, SP), % TOS := &temp - sp @@ -74,6 +75,10 @@ Mark II % Combine with the offset to the previous stack cell. lsl_imm(TOS, TOS, 15), % TOS := TOS << 15 ior_imm(TOS, TOS, 4), % TOS := TOS | 4 + do_offset(Done), + label(JustPushEmptyList), + mov_imm(TOS, 4), % TOS is a pair record with 0 as the head addr + % and the previous word in RAM as tail addr. label(Done), store_word(TOS, SP, 0), % RAM[SP] := TOS diff --git a/thun/joy_asmii.bin b/thun/joy_asmii.bin index e4e6a5b..825da21 100644 Binary files a/thun/joy_asmii.bin and b/thun/joy_asmii.bin differ