This commit is contained in:
Simon Forman 2019-11-12 09:02:19 -08:00
parent afea54bf08
commit f201cd6bb3
4 changed files with 213 additions and 198 deletions

View File

@ -185,4 +185,5 @@ lsl_imm(6, 6, 15),
ior(6, 6, 7),
store_word(6, 0, 0),
label(I1),
expr_cell(R, 0)].
expr_cell(R, 4),
expr_cell(S, 0)].

View File

@ -157,15 +157,13 @@ Mark II
incr(SP),
sub_base_from_offset(TEMP0, SP),
sub_base_from_offset(TEMP1, SP),
merge_and_store(TEMP0, TEMP1, SP)
merge_and_store(TEMP0, TEMP1, SP),
% ======================================
]),[
label(Expression),
expr_cell(Dup, 0)
].
% ======================================
label(Expression)
]),
dexpr([Dup, I]).
/*
@ -262,11 +260,9 @@ language.
/*
The add_label/3 relation is a meta-logical construct that accepts a comparision
predicate (e.g. if_zero/2) and "patches" it by adding the Label logic variable
to the end.
*/
add_label(CmpIn, Label, CmpOut) :-
@ -275,6 +271,18 @@ add_label(CmpIn, Label, CmpOut) :-
CmpOut =.. G.
/*
The dexpr//1 DCG establishes a sequence of labeled expr_cell/2 pseudo-assembly
memory locations as a linked list that encodes a Prolog list of Joy function
labels comprising e.g. the body of some Joy definition.
*/
% This is simpler now that link offsets are just 4.
dexpr([]) --> !, [].
dexpr([Func]) --> !, [expr_cell(Func, 0)].
dexpr([Func|Rest]) --> !, [expr_cell(Func, 4)], dexpr(Rest).
do :-
compile_program(Binary),
write_binary('joy_asmii.bin', Binary).

6
thun/dump-asm.py Normal file
View File

@ -0,0 +1,6 @@
s = ''''''
s = s.splitlines()
s = ' '.join(s)
s = s.replace('), ', '),\n')
with open('thun/asm-dump.txt', 'wb') as f:
f.write(s)

Binary file not shown.