"swap" word.
This commit is contained in:
parent
4faebb4551
commit
851f212fb2
|
|
@ -5,7 +5,7 @@ label(A),
|
|||
mov_imm(0, 0),
|
||||
store_word(0, 0, 0),
|
||||
mov_imm(0, 4096),
|
||||
mov_imm(1, J1),
|
||||
mov_imm(1, S1),
|
||||
mov_imm(2, 0),
|
||||
mov_imm(3, 0),
|
||||
store_word(2, 0, 0),
|
||||
|
|
@ -190,7 +190,61 @@ symbol(I1),
|
|||
mov_imm(5, 0),
|
||||
do_offset(D),
|
||||
label(J1),
|
||||
symbol(J1),
|
||||
lsl_imm(6, 2, 2),
|
||||
asr_imm(6, 6, 17),
|
||||
eq_offset(K1),
|
||||
add(6, 6, 0),
|
||||
label(K1),
|
||||
lsl_imm(7, 2, 17),
|
||||
asr_imm(7, 7, 17),
|
||||
eq_offset(L1),
|
||||
add(7, 7, 0),
|
||||
label(L1),
|
||||
load_word(8, 7, 0),
|
||||
lsl_imm(9, 2, 2),
|
||||
asr_imm(9, 9, 17),
|
||||
eq_offset(M1),
|
||||
add(9, 9, 0),
|
||||
label(M1),
|
||||
lsl_imm(10, 2, 17),
|
||||
asr_imm(10, 10, 17),
|
||||
eq_offset(N1),
|
||||
add(10, 10, 0),
|
||||
label(N1),
|
||||
sub_imm(0, 0, 4),
|
||||
sub_imm(6, 6, 0),
|
||||
eq_offset(O1),
|
||||
sub(6, 6, 0),
|
||||
and_imm(6, 6, 32767),
|
||||
label(O1),
|
||||
sub_imm(10, 10, 0),
|
||||
eq_offset(P1),
|
||||
sub(10, 10, 0),
|
||||
and_imm(10, 10, 32767),
|
||||
label(P1),
|
||||
lsl_imm(6, 6, 15),
|
||||
ior(6, 6, 10),
|
||||
store_word(6, 0, 0),
|
||||
mov_imm(6, 4),
|
||||
sub_imm(0, 0, 4),
|
||||
sub_imm(9, 9, 0),
|
||||
eq_offset(Q1),
|
||||
sub(9, 9, 0),
|
||||
and_imm(9, 9, 32767),
|
||||
label(Q1),
|
||||
sub_imm(6, 6, 0),
|
||||
eq_offset(R1),
|
||||
sub(6, 6, 0),
|
||||
and_imm(6, 6, 32767),
|
||||
label(R1),
|
||||
lsl_imm(9, 9, 15),
|
||||
ior(9, 9, 6),
|
||||
store_word(9, 0, 0),
|
||||
do_offset(H),
|
||||
label(S1),
|
||||
expr_cell(I1, 4),
|
||||
expr_cell(R, 4),
|
||||
expr_cell(J1, 4),
|
||||
expr_cell(J, 4),
|
||||
expr_cell(S, 0)].
|
||||
|
|
@ -153,9 +153,24 @@ Mark II
|
|||
asm(mov_imm(TermAddr, 0)), % Rely on push machinery.
|
||||
jump(PUSH),
|
||||
|
||||
definition(Swap), % ======================================
|
||||
unpack_pair(TOS, TEMP0, TEMP1, SP),
|
||||
% TEMP0 = Address of the first item on the stack.
|
||||
% TEMP1 = Address of the stack tail.
|
||||
load(TEMP2, TEMP1), % TEMP1 contains the record of the second stack cell.
|
||||
unpack_pair(TOS, TEMP3, TEMP4, SP),
|
||||
% TEMP3 = Address of the second item on the stack.
|
||||
% TEMP4 = Address of the stack tail.
|
||||
incr(SP),
|
||||
sub_base_merge_and_store(TEMP0, TEMP4, SP), % Push first item onto stack.
|
||||
asm(mov_imm(TEMP0, 4)), % Used for linking to previous cell.
|
||||
incr(SP),
|
||||
sub_base_merge_and_store(TEMP3, TEMP0, SP), % Push first item onto stack.
|
||||
jump(Main),
|
||||
|
||||
% ======================================
|
||||
label(Expression),
|
||||
dexpr([New, Dup, Cons, I])
|
||||
dexpr([New, Dup, Swap, Cons, I])
|
||||
]).
|
||||
|
||||
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -386,8 +386,19 @@ the library code.
|
|||
ペ, write_cell(TOS, SP)
|
||||
|
||||
|
||||
------------------------------------------
|
||||
|
||||
|
||||
[ナ,ズ,セ,ネ,ヒ,ド,ャ,ペ],ワ(swap),
|
||||
|
||||
ナ, low_half(TEMP0, TOS)
|
||||
ズ, deref(TEMP0)
|
||||
セ, chop_word(TEMP1, TEMP0)
|
||||
ネ, chop_word(TEMP2, TOS)
|
||||
ヒ, or_inplace(TEMP0, TEMP2)
|
||||
ド, write_cell(TEMP0, SP)
|
||||
ャ, asm(ior(TOS, TEMP1, SP))
|
||||
ペ, write_cell(TOS, SP)
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue