perm filename TRACE.MAC[SIM,SYS] blob sn#460326 filedate 1979-07-20 generic text, type C, neo UTF8
COMMENT āŠ—   VALID 00010 PAGES
C REC  PAGE   DESCRIPTION
C00001 00001
C00002 00002	COMMENT::::::::::::::::::::::::::::::::::::::::::::::::::
C00003 00003	DEFINE	X(F,L,T)<
C00004 00004	TRACE:
C00005 00005	IXORD:
C00006 00006	IJUMP:
C00008 00007	IJSP:
C00009 00008	IXCT:
C00011 00009	IJSR:
C00012 00010		LIT
C00013 ENDMK
CāŠ—;
COMMENT;::::::::::::::::::::::::::::::::::::::::::::::::::

AUTHOR:	CLAES WIHLBORG
	KIM WALDEN

UPDATE:	1

PURPOSE:TRACE PERFORMS THE TRACE FUNCTION OF THE COMPILER.
	IT IS LOADED IN EVERY PASS.

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


	SEARCH	SIMMAC
	SALL
	CTITLE	TRACE
	MACINIT
	TWOSEG
	RELOC	400K

	INTERN	TRACE

	EXTERN	QPASSNO,YTRSAV,YTRLC,YTRJLC,YTRINS,YTRLOW,YTRHGH,YTRTP
	EXTERN	YTRPAS,YTRACC,YTRSIM,YTRTAB,.JBUUO,.JB41
DEFINE	X(F,L,T)<
IFB<L>,<<IX'T-IXCT>B8+I'T>
IFNB<L>,<REPEAT L+1-F,<<IX'T-IXCT>B8+I'T>>
>

TAB:
X	0,0,SKIP
X	1,37,UUO
X	40,46,SKIP
X	47,47,CALLI
X	50,107,SKIP
X	110,251,ORD
X	252,255,JUMP
X	256,,XCT
X	257,,ORD
X	260,,PUSHJ
X	261,262,ORD
X	263,,POPJ
X	264,,JSR
X	265,,JSP
X	266,,JSA
X	267,,JRA
X	270,277,ORD
X	300,317,SKIP
X	320,327,JUMP
X	330,337,SKIP
X	340,347,JUMP
X	350,357,SKIP
X	360,367,JUMP
X	370,377,SKIP
X	400,577,ORD
X	600,677,SKIP
X	700,777,SKIP
TRACE:
	LI	1,QPASSNO
	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