Source code: nxdump.pal

From PROSE Programming Language - Wiki
Revision as of 15:52, 4 August 2010 by Cambridge (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
% $Id:$
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% nxdump.pal
% Author: Mark R. Bannister
% Date: 17/Feb/2007
%
% Creates the system function tools.nxdump() for dumping all nodes in nexus
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

~Module
EQUS {[sys.tools]}

._init
func/def	[nxdump], &[.dump]
local/rtn

.dump
stack/lock
reg/load	PUSH, (![.prose])
obj/dump	PEEK

.loop
reg/load	P0, (PEEK)
reg/jmpeq	&[.loop_next], P0, NULL
obj/dump	P0
reg/load	P1, (P0)
reg/jmpeq	&[.loop], P1, NULL

stack/push	P1
local/jmp	&[.loop]

.loop_next
reg/clr		PULL
reg/jmpneq	&[.loop], PEEK, LOCK
stack/unlock
func/rtn