Google
 

Trailing-Edge - PDP-10 Archives - BB-H348C-RM_1982 - swskit-v21/debugging-tools/ddt11/ddtsym.unv
There are no other files named ddtsym.unv in the archive.
x
,F6@PCZ
	JSR	@RFwETCH(IR)	;GET OPEw RAND
	TRZ	PS,PS.[email protected]!PS...Z!PS...Vw`
	TRZE	PS,PS...Cx
	JRST	.+6
	TRNx E	T1,100000
	TROx@	PS,PS...N
	JUMPx`N	T1,SIM11
	TRO	yPS,PS...Z
	JRST	y SIM11
	AOS	T1
	y@TRNE	T1,100000
	y`TRO	PS,PS...N
	TzRZE	T1,200000	;OVz ERFLOW IFF WENT Tz@O ZERO
	TRO	PS,Pz`S...Z!PS...C
	CA{IN	T1,100000
	TR{ O	PS,PS...V
	RSTORE	A
	
	RSTC#@ {a 
	JSR	@BR|FTCH(IR)	;GET OPE| RAND
	TRZ	PS,PS.|@..N!PS...Z!PS...V|`
	TRZE	PS,PS...C}
	JRST	.+6
	TRN} E	T1,000200
	TRO}@	PS,PS...N
	JUMP}`N	T1,SIM11
	TRO	~PS,PS...Z
	JRST	~ SIM11
	AOS	T1
	~@TRNE	T1,000200
	~`TRO	PS,PS...N
	TRZE	T1,000400	;OV ERFLOW IFF WENT T@O ZERO
	TRO	PS,P`S...Z!PS...C
	CAIN	T1,000200
	TR O	PS,PS...V
	RSTORE	A
	
	RSTC!` a 4
	MOVE	T2,T1		;SAVE SRC
	 JSR	@RFETCH(IR)	;@GET DST
	MOVE	IR`,T1		;SAVE COPY OF DST FOR PS...V  CALC
	ADD	T1,T2	@	;MAKES RESULT
	`TRZ	PS,PS...N!PS...Z!PS...V!PS...C 
	TRNE	T1,100000@	;CHECK FOR NEGAT`IVE
	TRO	PS,PS...N
	TRZE	T1,6000 00	;CHECK FOR OVE@RFLOW
	TRO	PS,PS`...C
	SKIPN	T1
	TRO	PS,PS...Z
	 EQV	IR,T2		;SRC E@QV DST
	XOR	T2,T`1		;RESULT XOR SRC
	AND	T2,IR
	T RNE	T2,100000
	T@RO	PS,PS...V
	RSTORE	A
	
	RSCC pCCMVP CNA` !2
	ANDI	T2!,7		;LEAVE ONLY R@EG FIELD
	JSR	@F`ETCH(IR)	;GET NN
	TRZ	PS,PS...N!P S...Z!PS...V!PS..@.C
	MOVE	MA,(T2)`		;GET REGISTER T	O SHIFT
	TRNE	MA	 ,100000	;WAS REGI	@STER NEGATIVE ?
	`	IOR	MA,[-1,,7000
00]	;EXTEND SIGN
 
	TRNE	T1,40		;RI
@GHT OR LEFT SHIFT
` ?
	JRST	[IORI	T1,777740	;SHIFT R IGHT
		ASHC	MA,(@T1)		;SHIFT IT
	`	TLNE	MA+1,200000
	;WAS LAST BIT OU
 T A 1 ?
		TRO	PS
@,PS...C	;REMEMBER
` LAST BIT OUT
		ST	.+13 ]
	AND,37		;SHIFT L
	;JUMPE	T1,*
	;	*****				*****
	; 	*****	WHAT IF SH@IFT 0 ???	*****
`	;	*****				*****
	JOV	.+1		;CLEA R A
	ASH	MA,(T1@)		;SHIFT IT
	TR`NE	MA,200000	;WAS LAST BIT OUT SET  ?
	TRO	PS,PS...@C	;LAST BIT OUT W`AS SET
	JOV	.+4		;LOSE ANY BITS ? 
	SKIPGE	T1,MA		@;NEGATIVE ?
	XOR`	T1,[-1,,700000]
	TDNE	T1,[-1,,70 0000]
	TRO	PS,PS@...V
	ANDI	MA,17`7777	;STRIP EXTRA BITS
	TRNE	MA,1 00000	;IS RESULT @NEGATIVE ?
	TRO	`PS,PS...N	;WAS NEGATIVE RESULT
	S KIPN	MA		;WAS RES@ULT ZERO ?
	TRO	`PS,PS...Z	;YES
	MOVEM	MA,(T2)		;U PDATE ORIGINAL RE@GISTER
	TRNE	PC,`1		;DID THAT POLLUTE THE PC ?
	JR ST	NXM...		;GIVE A BUS TRAP
	E CND3@ a"X
	; *****				*****
	; *** **	WHAT IF REG IS@ ODD ??	*****
	;` *****				*****
	ANDI	T2,7		;LEAV E ONLY REG FIELD
	JSR	@FETCH(IR)	`;GET NN
	TRZ	PS,PS...N!PS...Z!PS. ..V!PS...C
	MOVE@	MA,(T2)		;GET HI`GH ORDER BITS
	LSH	MA,^D16		;POSI TION
	MOVE	IR,T2@		;COPY REGISTER `ADR
	IORI	IR,1		;MAKE LOW ORDER B ITS ADR
	IOR	MA,@(IR)		;GET LOW OR`DER BITS
	TLNE	MA,020000	;WAS REG  NEGATIVE ?
	TLO@	MA,740000	;EXTEN`D SIGN
	TRNE	T1,40		;RIGHT OR LEF T SHIFT ?
	JRST	@[IORI	T1,777740	;`SHIFT RIGHT
		ASHC	MA,(T1)		;SHIF T IT
		TLNE	MA+1@,200000;WAS LAST `BIT OUT A 1 ?
		TRO	PS,PS...C
		 JRST	.+13 ]
	AND@I	T1,37		;SHIFT L`EFT
	;JUMPE	T1,  ????		*****
	;	*  ****				*****
	; @	*****	WHAT IF SH `IFT 0 ???	*****
!	;	*****				*****! 
	JOV	.+1		;CLEA!@R A
	ASH	MA,(T1!`)		;SHIFT IT
	TL"NE	MA,040000	;WIN"  A CARRY BIT ?
	"@TRO	PS,PS...C	;WO"`N A CARRY
	JOV	.#+4
	SKIPGE	T1,MA# 		;WAS THAT NEGAT#@IVE ?
	TLC	T1,76#`0000	;CL7AR EXTEN$DED SIGN
	TLNE	T$ 1,760000	;DID WE $@LOSE BITS ?
	TRO$`	PS,PS...V	;LOST %BITS
	TLNE	MA,02% 0000	;IS RESULT N%@EGATIVE ?
	TRO	P%`S,PS...N	;WAS NEG&ATIVE RESULT
	TL& Z	MA,740000	;STRI&@P EXTRA BITS
	SK&`IPN	MA		;WAS RESU'LT ZERO ?
	TRO	P' S,PS...Z	;YES
	M'@OVE	T1,MA		;COPY '`RESULT
	ANDI	T1,(177777	;STRIP EXT( RA BITS
	MOVEM	T(@1,(IR)		;RESTORE (`LOW ORDER BITS
	)LSH	MA,-^D16	;POS) ITION HIGH ORDER )@BITS
	MOVEM	MA,()`T2)		;RESTORE NEW* HIGH ORDER BITS
	TRNE	PC,1		;DID*@ THAT POLLUTE THE*` PC ?
	JRST	NXM.+..		;GIVE A BUS TRAP
	E A BUS TCNa` +A#
	JSR	@RF+aETCH(IR)	;GET OPE,RAND
	TRZ	PS,PS., ..N!PS...Z!PS...V,@!PS...C
	TRNN	T1,`,040000	;CHECK NE-W N BIT
	JRST	.+- 5		;NO NEW N BIT
	TRZE	T1,100000	-`;CHECK NEW C BIT
	TROA	PS,PS...N!. PS...C
	TRO	PS,P[email protected]!PS...V
	JR.`ST	.+3
	TRZE	T1,/100000	;CHECK NEW/  C BIT
	TRO	PS,P/@S...C!PS...V
	LS/`H	T1,1
	SKIPN	T10
	TRO	PS,PS...Z
	RSTORE	A
	#@ 0A#(
	JSR	@BR0aFTCH(IR)	;GET OPE1RAND
	TRZ	PS,PS.1 ..N!PS...Z!PS...V1@!PS...C
	TRNN	T11`,000100	;CHECK NE2W N BIT
	JRST	.+2 5		;NO NEW N BIT
	TRZE	T1,000200	2`;CHECK NEW C BIT
	TROA	PS,PS...N!3 PS...C
	TRO	PS,P[email protected]!PS...V
	JR3`ST	.+3
	TRZE	T1,4000200	;CHECK NEW4  C BIT
	TRO	PS,P[email protected]!PS...V
	LS4`H	T1,1
	SKIPN	T15
	TRO	PS,PS...Z
	RSTORE	A
	` 5A#T
	JSR	@RF5aETCH(IR)	;GET OPE6RAND
	TRZ	PS,PS.6 ..N!PS...Z!PS...V6@!PS...C
	TRNN	T16`,100000	;CHECK NE7W N BIT
	JRST	.+7 6		;NO NEW N BIT
	TRO	T1,200000	;7`SET NEW SIGN BIT
	TRZE	T1,1		;CHE8 CK NEW C BIT
	TR8@OA	PS,PS...N!PS..8`.C
	TRO	PS,PS...9N!PS...V
	JRST	.9 +3
	TRZE	T1,1		;9@CHECK NEW C BIT
9`	TRO	PS,PS...C!PS:...V
	LSH	T1,-1
	SKIPN	T1
	TRO	:@PS,PS...Z
	RSTORE	A
	
	RSTORCO#@ ;$
	JSR	@BR;!FTCH(IR)	;GET OPE;@RAND
	TRZ	PS,PS.;`..N!PS...Z!PS...V<!PS...C
	TRNN	T1< ,000200	;CHECK NE<@W N BIT
	JRST	.+<`6		;NO NEW N BIT
	TRO	T1,000400	;= SET NEW SIGN BIT
	TRZE	T1,1		;CHE=`CK NEW C BIT
	TR>OA	PS,PS...N!PS..> .C
	TRO	PS,PS...>@N!PS...V
	JRST	.>`+3
	TRZE	T1,1		;?CHECK NEW C BIT
? 	TRO	PS,PS...C!PS[email protected]
	LSH	T1,-1
	SKIPN	T1
	TRO	@PS,PS...Z
	RSTORE	A
	
	RSTORE` @A$
	TRNE	PS@a,PS...C
	JRST	SIAM11		;NO BRANCH
			;NO BRANCH
EMp s EMx@ u E` AA$
	TRNN	PSAa,PS...C
	JRST	SIBM11		;NO BRANCH
			;NO BRANCH
E	` BA$
	TRNN	PSBa,PS...Z
	JRST	SIM11
	
	JRST	SIE)` C!$&
	TRNN	PSCA,PS...N
	JRST	[TC`RNE	PS,PS...V
		DJRST	SIM11		;NO BD RANCH
		JRST	.+3D@ ]
	TRNN	PS,PS..D`.V
	JRST	SIM11		;NO BRANCH
			E!` E!$<
	TRNE	PSEA,PS...Z
	JRST	SIE`M11		;NO BRANCH
F	TRNN	PS,PS...N
F 	JRST	[TRNE	PS,PS[email protected]
		JRST	SIM1F`1		;NO BRANCH
		GJRST	.+3 ]
	TRNNG 	PS,PS...V
	JRSTG@	SIM11		;NO BRANCH
			;NO BRANCE"I` H$D
	TRNE	PSH!,PS...Z!PS...C
	H@JRST	SIM11		;NO BRANCH
			;NO BE"N3@ I$L
	TRNE	PSI!,PS...C
	JRST	SII@M11		;NO BRANCH
			;NO BRANCH
E&` J$d
	MOVE	T2J!,T1		;COPY SRC
	J@JSR	@RFETCH(IR)	;J`GET DST
	ANDCM	TK1,T2		;CLEAR SOMEK  BITS
	TRZ	PS,PS[email protected]!PS...Z!PS...K`V
	TRNE	T1,10000L0
	TRO	PS,PS...NL 
	SKIPN	T1
	TROL@	PS,PS...Z
	RSTORE	A,C
		RSTOE&#@ M$|
	MOVE	T2M!,T1		;COPY SRC
	M@JSR	@BRFTCH(IR)	;M`GET DST
	ANDCM	TN1,T2		;CLEAR SOMEN  BITS
	TRZ	PS,PS[email protected]!PS...Z!PS...N`V
	TRNE	T1,00020O0
	TRO	PS,PS...NO 
	SKIPN	T1
	TROO@	PS,PS...Z
	RSTORE	A,C
		RSTOE'` P%
	MOVE	T2P!,T1		;COPY SRC
	P@JSR	@RFETCH(IR)	;P`GET DST
	IOR	T1,QT2		;SET NEW BITSQ 
	TRZ	PS,PS...N![email protected]!PS...V
	TQ`RNE	T1,100000
	TRRO	PS,PS...N
	SKR IPN	T1
	TRO	PS,P[email protected]
	RSTORE	A,S
		RSTORE	AE'#@ S%,
	MOVE	T2S!,T1		;COPY SRC
	S@JSR	@BRFTCH(IR)	;S`GET DST
	IOR	T1,TT2		;SET NEW BITST 
	TRZ	PS,PS...N![email protected]!PS...V
	TT`RNE	T1,000200
	TURO	PS,PS...N
	SKU IPN	T1
	TRO	PS,P[email protected]
	RSTORE	A,S
		RSTORE	AE'!` V%D
	MOVE	T2V!,T1		;COPY FIRST V@OPERAND
	JSR	@FEV`TCH(IR)	;GET 2ND WOPERAND
	TRZ	PS,W PS...N!PS...Z!PS.[email protected]
	AND	T1,T2		W`;MASK THE BITS
	XSKIPN	T1
	TRO	PSX ,PS...Z
	TRNE	T1X@,100000
	TRO	PS,PS...N
	RO	PS,E'$#@ Y%\
	MOVE	T2Y!,T1		;COPY FIRST Y@OPERAND
	JSR	@BFY`ETCH(IR)	;GET 2NDZ OPERAND
	TRZ	PSZ ,PS...N!PS...Z!PS[email protected]
	AND	T1,T2	Z`	;MASK THE BITS
[	SKIPN	T1
	TRO	P[ S,PS...Z
	TRNE	T[@1,000200
	TRO	PS,PS...N
	RO	PSE2)` \%r
	TRNE	PS\!,PS...Z
	JRST	.+\@5		;BRANCH
	TRNE\`	PS,PS...N
	JRST]	[TRNE	PS,PS...V
		JRST	SIM11		;N]@O BRANCH
		JRST	]`.+3 ]
	TRNN	PS,P^S...V
	JRST	SIM1^ 1		;NO BRANCH
			;NO BRANCH
	E2y` ^a%z
	TRNN	PS_,PS...C
	JRST	SI_ M11		;NO BRANCH
			;NO BRANCH
E2| MA
	XLIST
MaIFN	<MA-A>,< HRRNZ	MA,A >	;COPY RN EG SO WE CAN DIVIN@DE IT
		MEMREL	MN`EMLIM
	CAIL	MA,0O
	CALL	IOBLOD
BO LDRET==7		;NUMBERO@ OF INSTRUCTIONS O`TO SKIP
	LSHC	MAP,-2		;IDIVI	MA,4
	LSH	MA+1,-^D34
	TRNE	MA+1,2
	 P`MEMREL	MEMORY
	SQKIPA	B,0(MA)	;GEQ T RH OF WORD
	 MQ@EMREL	MEMORY
	HLQ`RZ	B,0(MA)	;GET RLH OF WORD
	TRNER 	MA+1,1		;WANT ODR@D BYTE ?
	LSH	BR`,-^D8		;YES
	ANDSI	B,377		;STRIP EXTRA BITS
IP E2~3@ _a&
	TRNN	PS`,PS...Z!PS...C
	` JRST	SIM11		;NO BRANCH
			;NO BE3!` `a&
	TRNE	PSa,PS...N
	JRST	[Ta RNE	PS,PS...V
		a@JRST	SIM11		;NO Ba`RANCH
		JRST	.+3b ]
	TRNN	PS,PS..b .V
	JRST	SIM11		;NO BRANCH
			E6I` ba&
	TRNN	PSc,PS...N
	JRST	SIc M11		;NO BRANCH
			;NO BRANCH
E:)` ca& 
	TRNE	PSd,PS...Z
	JRST	SIM11
	
	JRST	SIEBa` dA&(
	TRNE	PSda,PS...N
	JRST	SIeM11		;NO BRANCH
			;NO BRANCH
EC!` eA&,
	INTSAV	14
	
	INTSAV	EHp &.
	HZD,}EI-ZP EI-MVP EI-ySP EI-{@P EI=ZP EI=MVP EI=ySP EI={@P ENMp sENMx@ uEO%|R iAx
	XLIST
ia	 IFN	<MA-A>,< HjRRZ	MA,A >
		MEj MREL	MEMLIM
	CAIj@L	MA,0		;BE SURE j`IN CORE
	JRST	[IkFN	<T1-B>,< HRRZk  T1,B>
Z=	4
		k@IFE	<A-6>,<Z=Z+2k`>
		PUSH	P,[EXP l.+Z]
		JRST	IOBSl TO ]
	 IFE	<A-6l@>,<
	CAIGE	MA,40l`0		;IS THIS A STAmCK VIOLATION ?
	m JSR	STCKVP		;RECOm@RD VIOLATION (& Rm`ESTORE PS)
    >n;IFE <A-6>
	LSHn C	MA,-2		;IDIVI	Mn@A,4
	LSH	MA+1,-^n`D34
	DPB	B,SIMPoTR(MA+1)	;STORE BYTE IN MEMORY
EQ4HQP:EQ4MPHEQ4\YPIEQ5	PIEQ6EQ6JP EQ6K9P EQ6LRP EZ` f!&6
	TRNE	PSfA,PS...V
	JRST	SIf`M11		;NO BRANCH
			;NO BRANCH
E[` g!&>
	TRNN	PSgA,PS...V
	JRST	SIg`M11		;NO BRANCH
			;NO BRANCH
Ge@ ,G2\P!3G2]MVP G3` h!&P
	HRRM PShA,PS.REG+1	;IN CASh`E OF BUS TRAP
	SiETZ	T1,
	TRZ	PS,i PS...N!PS...V!PS.[email protected]
	TRO	PS,PS..i`.Z
	JRST	@STUFF(jIR)
ZZRET==	-1
	
ZZRET==	-1
G3#@ jA&b
	HRRM PSja,PS.REG+1	;IN CASkE OF BUS TRAP
	Sk ETZ	T1,
	TRZ	PS,[email protected]!PS...V!PS.k`..C
	TRO	PS,PS..l.Z
	JRST	@BSTUFFl (IR)
ZZRET==	-1
	
ZZRET==	-1G6&:=P `G7` la'
	MOVE	T2m,T1		;COPY FIRST m OPERAND
	JSR	@FEm@TCH(IR)	;GET 2ND m`OPERAND
	MOVE	IRn,T2		;ANOTHER COPn Y OF SRC FOR PS..[email protected] CALC
	TRZ	PS,n`PS...N!PS...Z!PS.o..V!PS...C
	SUB	o T2,T1
	TRNE	T2,1o@00000
	TRO	PS,PSo`...N
	TRNN	T2,17p7777
	TRO	PS,PS.p ..Z
	TRNE	T2,200p@000
	TRO	PS,PS..p`.C
	XOR	IR,T1		;qSRC XOR DST
	EQVq 	T1,T2		;CHECK REq@SULT AND DST
	ANq`D	T1,IR
	TRNE	T1r,100000
	TRO	PS,r PS...V	;SAME SIGN SO OVERFLOW
	G7#@ ra'D
	MOVE	T2s,T1		;COPY FIRST s OPERAND
	JSR	@BFs@ETCH(IR)	;GET 2NDs` OPERAND
	MOVE	ItR,T2		;ANOTHER COt PY OF SRC FOR PS.[email protected] CALC
	TRZ	PSt`,PS...N!PS...Z!PSu...V!PS...C
	SUBu 	T2,T1
	TRNE	T2,u@000200
	TRO	PS,Pu`S...N
	TRNN	T2,0v00377
	TRO	PS,PSv ...Z
	TRNE	T2,00v@0400
	TRO	PS,PS.v`..C
	XOR	IR,T1		w;SRC XOR DST
	EQw V	T1,T2		;CHECK Rw@ESULT AND DST
	Aw`ND	T1,IR
	TRNE	Tx1,000200
	TRO	PSx ,PS...V	;SAME SIGx@N SO OVERFLOW
	 SO OVERFLOW
	G>i` y'`
	JSR	@RFy!ETCH(IR)	;GET OPEy@RAND
	TRZ	PS,PS.y`..N!PS...Z!PS...Vz
	TRO	PS,PS...C
	TRCE	T1,177777	z@;PERFORM COMPLEMEz`NT AND CHECK FOR {-1 RESULT
	TRNE	{ T1,100000
	TRO	P{@S,PS...N
	SKIPN	{`T1
	TRO	PS,PS...|Z
	RSTORE	A
	
	RSTORE	A
	G>l#@ |A'|
	JSR	@BR|aFTCH(IR)	;GET OPE}RAND
	TRZ	PS,PS.} ..N!PS...Z!PS...V}@
	TRO	PS,PS...C
	TRCE	T1,000377	~;PERFORM COMPLEME~ NT AND CHECK FOR ~@-1 RESULT
	TRNE	~`T1,000200
	TRO	PS,PS...N
	SKIPN	 T1
	TRO	PS,PS...@Z
	RSTORE	A
	
	RSTORE	A
	GO!cGP GSLP!8GSMMVP HXtRP HXt)P HXt,|Q @HXtHVQ HXtIQ HXtI8P HXtMQ HXt^P HXtiQ HXu	Q HXuiQ HXumP HXvQ HXvQ  HXv(VQ @HXv)Q  HXv)2Q HXv99P HXvIP HXvLP HXvLYP HZD,}P HZF|}P Iy7 a9z
	XLIST
	 IF2,<
	IFGE	< AADR-DDBADR> <PRI@NTX ERROR BUILDIN`G IOMAP>
	IFNDEF	ATIM,<ATIM==R> 	;DEFAULT TIMER R@OUTINE
	IFNDEF	`ARST,<ARST==R>	;DEFAULT RESET ROU TINE
	IFNDEF	AL@VL,<ALVL==0	;DEF`AULT INTERRUPT LEVEL
			AINT==0> 	;DEFAULT INTERRU@PT ROUTINE
    >`;IF2
	ADDB: PHASE	0
	0,,AADR	; FIRST ADR IN DEVI@CE
	0,,AADR+B+`B-1	;HIGHEST ADR IN DEVICE
DDBAD R==AADR
DV.LNK:@! DDBLNK,,DDBLNK	`	;LINK TO NEXT DEVICE BLOCK
DDBLN K==ADDB
DV.LOD:@! EXP	ALOD		;DIS`PATCH FOR LOAD
DV.BLD:! EXP	ABLD 		;DISPATCH FOR B@YTE LOAD
DV.WRT:`! EXP	AWRT		;DISPATCH FOR WRITING  WORDS
DV.BWR:! @EXP	ABWR		;DISPA`TCH FOR WRITING BYTES
DV.TIM:! EX P	ATIM		;DISPATC@H WHEN TIMER GOES` OFF
				; RETURNS WITH SKIP IF I NTERRUPTED
	Z			@;TIME TO TAKE TIM`ER DISPATCH
DV.RST:! EXP	ARST		; DISPATCH FOR RESE@T
DV.LVL:! EXP	`ALVL		;CONTAINS DEVICE LEVEL
DV.I NT:! EXP	AINT		;@DISPATCH IF WANT `TO CHECK FOR INTERRUPTS
DV.SIZ:!
	DEPHASE
	LIST
EPHASE
	LIST (
	JSR	@RF!ETCH(IR)	;GET OPE@RAND
	TRZ	PS,PS.`..N!PS...Z!PS...V
	SOSN	T1
	TRO	 PS,PS...Z
	ANDI	@T1,177777
	TRNE	`T1,100000
	TRO	PS,PS...N
	CAIN	T 1,077777
	TRO	PS@,PS...V
	RSTORE	A
	
	RSTORE	I#@ (,
	JSR	@BR!FTCH(IR)	;GET OPE@RAND
	TRZ	PS,PS.`..N!PS...Z!PS...V
	SOSN	T1
	TRO	 PS,PS...Z
	ANDI	@T1,000377
	TRNE	`T1,000200
	TRO	PS,PS...N
	CAIN	T 1,000177
	TRO	PS@,PS...V
	RSTORE	A
	
	RSTORE	I'1` )
	ANDI	T2!,7		;LEAVE REGIST@ER FIELD
	JSR	@F`ETCH(IR)	;GET DIVISOR
	TRZ	PS,PS. ..N!PS...Z!PS...V@!PS...C
	JUMPE	T`1,[TRO PS,PS...C!PS...V	;SET FLAGS 
		JRST	SIM11 ]
	TRNE	T1,100000	`;NEGATIVE DIVSOR 	?
	IOR	T1,[-1,,7	 00000]	;EXTEND SI	@GN
	MOVE	MA,(T2)	`		;GET HIGH ORDER
 BITS OF DIVIDEND
 
	LSH	MA,^D16		;
@POSITION
	TLNE	M
`A,020000	;NEGATIVE ?
	TLO	MA,7600 00	;EXTEND SIGN
@	MOVE	IR,T2		;COP`Y REG ADR
	IORI	
IR,1
	IOR	MA,(IR
 )		;GET LOW ORDER
@ BITS
	IDIV	MA,T
`1		;DO THE DIVISI
	ANDI	MA,1777RA B
	MOVEM	MA,(T
	TRO	T1,1		;OTHER REGISTER
	A NDI	MA+1,177777	;@STRIP OTHER BITS
	MOVEM	MA+1,(T2)	;AND SAVE THESE  AS WELL
	TRNE	MA@,100000	;NEGATIVE` RESULT ?
	TRO	PS,PS...N	;REMEMBE R NEGATIVE
	ANDI@	MA,177777	;STRIP` EXTRA BITS
	SKIPN	MA
	TRO	PS,PS ...Z	;REMEMBER ZE@RO RESULT
	TRNE	`PC,1		;DID THAT POLLUTE THE PC ?
 	JRST	NXM...		;GI@VE A BUS TRAP
	E A BUS TRAP
	I? @ IN^3P Iht<yP IhuLP Ihu\yP Ihv(SP IhvHyP IhvIP K
e<}P K7!` )
	INTSAV	30
	
	INTSAV	KBjP @KC!cGP KC${P KC%ZP KC&	P 	KC&=P 0KC&L	P 	KC&i1P  K`tEHP K`tEIP K`ti(P K`ti(P K`uXqP K`uY6P K`ukrP K`vyP KblP 0L8t\qP"L8tkwP L8v:6Q  L:RP  L:tP L:\YQ L:/	1Q @L:4[Q L:5J8P L:5KxP L:<^Q L:DQ L:DtQ L:LI1P L:M	<P L:MxzP @L:d*zQ L:exuP @L:e|P L:f9Q @L:luP L:l8@Q L:m|P L:n>9Q  L:u}:Q @L;uP$L;\QQ  L;[SQ L;)3Q L;j7Q L;1P L;6Q L;$^P  L;%|Q L;<[QP!L;>*:P M$C@ A)
	JRST	ILaLINS
ZZRET==	-1
	
ZZRET==	-1!)$
	JRST	ILALINS
ZZRET==	-1
	
ZZRET==	-1M=X@ 
M28@ M7-C@ )*
	JRST	IL!LINS
ZZRET==	-1
	
ZZRET==	-1a)0
	JRST	ILLINS
ZZRET==	-1
	
ZZRET==	-1QfC@ A)>
	TXZ	FLGa,F.RUNF
	TXO	FLG,F.HALT	;A WE DI D A HALT
	HRROS	@INTDLY		;SO WE NO`TICE RUN FLOP
	ICE RUN FLOP
	S:` !)Z
	JSR	@RFAETCH(IR)	;GET OPE`RAND
	TRZ	PS,PS...N!PS...Z!PS...V 
	AOS	T1
	TRNE	@T1,100000
	TRO	P`S,PS...N
	TRZE	T1,200000	;HAPPENS  IIF
	TRO	PS,PS.@..Z	; OPERAND NOW` ZERO
	CAIN	T1,100000
	TRO	PS,PS ...V
	RSTORE	A
	
	RSTORE	Aa)v
	JSR	@BRFTCH(IR)	;GET OPE RAND
	TRZ	PS,PS.@..N!PS...Z!PS...V`
	AOS	T1
	TRNE	T1,000200
	TRO	P S,PS...N
	TRZE	T@1,000400	;HAPPENS` IFF
	TRO	PS,PS...Z	; OPERAND NOW  ZERO
	CAIN	T1,0@00200
	TRO	PS,PS`...V
	RSTORE	A
	
	RSTORE	AkA
	XLIST
ka	X	000000,007000,lAND,<SMF.IN!SMF.Pl 8>
	X	000000,177l@777,HALT,<SMF.IN!l`SMF.11>
	X	00000m0,177777,R0,<SMF.m RG!SMF.11>
	X	00m@0001,177777,R1,<Sm`MF.RG!SMF.11>
	Xn	000001,177777,WAn IT,<SMF.IN!SMF.11n@>
	X	000002,1777n`77,R2,<SMF.RG!SMFo.11>
	X	000002,1o 77777,RTI,<SMF.INo@!SMF.11>
	X	0000o`03,177777,BPT,<SMpF.IN!SMF.11>
	X	p 000003,177777,R3,p@<SMF.RG!SMF.11>
p`	X	000004,177777,qIOT,<SMF.IN!SMF.1q 1>
	X	000004,177q@777,R4,<SMF.RG!SMq`F.11>
	X	000005,r177777,R5,<SMF.RGr !SMF.11>
	X	0000r@05,177777,RESET,<r`SMF.IN!SMF.11>
	sX	000006,177777,Rs TT,<SMF.IN!SMF.11s@>
	X	000006,1777s`77,SP,<SMF.RG!SMFt.11>
	X	000007,1t 77777,PC,<SMF.RG![email protected]>
	X	00010t`0,177700,JMP,<SMFu.IN!SMF.DD!SMF.11u >
	X	000200,1777u@70,RTS,<SMF.IN!SMu`F.RT!SMF.11>
	X	v000230,177770,SPLv ,<SMF.IN!SMF.PL!S[email protected]>
	X	000240v`,177777,NOP,<SMF.wIN!SMF.11>
	X	00w 0241,177777,CLC,<[email protected]!SMF.11>
	w`X	000242,177777,CxLV,<SMF.IN!SMF.11x >
	X	000244,1777x@77,CLZ,<SMF.IN!SMx`F.11>
	X	000250,y177777,CLN,<SMF.Iy N!SMF.11>
	X	000y@257,177777,CCC,<Sy`MF.IN!SMF.11>
	Xz	000261,177777,SEz C,<SMF.IN!SMF.11>z@
	X	000262,17777z`7,SEV,<SMF.IN!SMF{.11>
	X	000264,1{ 77777,SEZ,<SMF.IN{@!SMF.11>
	X	0002{`70,177777,SEN,<SM|F.IN!SMF.11>
	X	| 000277,177777,SCC|@,<SMF.IN!SMF.11>
	X	000300,177700},SWAB,<SMF.IN!SMF} .DD!SMF.11>
	X	0}@00400,177400,BR,<}`SMF.IN!SMF.BR!SMF~.11>
	X	001000,1~ 77400,BNE,<SMF.IN~@!SMF.BR!SMF.11>
~`	X	001000,007000,TAD,<SMF.IN!SMF.P 8>
	X	001400,177@400,BEQ,<SMF.IN!S`MF.BR!SMF.11>
	X	002000,177400,BG E,<SMF.IN!SMF.BR!@SMF.11>
	X	00200`0,007000,ISZ,<SMF.IN!SMF.P8>
	X	0 02400,177400,BLT,@<SMF.IN!SMF.BR!SM`F.11>
	X	003000,177400,BGT,<SMF.I N!SMF.BR!SMF.11>
	X	003000,007000`,DCA,<SMF.IN!SMF.P8>
	X	003400,17 7400,BLE,<SMF.IN!@SMF.BR!SMF.11>
	`X	004000,177000,JSR,<SMF.IN!SMF.DD !SMF.JS!SMF.11>
@	X	004000,007000,`JMS,<SMF.IN!SMF.P8>
	X	005000,177 700,CLR,<SMF.IN!S@MF.DD!SMF.11>
	X`	005000,007000,JMP,<SMF.IN!SMF.P8> 
	X	005100,17770@0,COM,<SMF.IN!SMF`.DD!SMF.11>
	X	005200,177700,INC, <SMF.IN!SMF.DD!SM@F.11>
	X	005300,`177700,DEC,<SMF.IN!SMF.DD!SMF.11>
	X	005400,177700@,NEG,<SMF.IN!SMF.`DD!SMF.11>
	X	00	5500,177700,ADC,<	 SMF.IN!SMF.DD!SMF	@.11>
	X	005600,1	`77700,SBC,<SMF.IN
!SMF.DD!SMF.11>

 	X	005700,177700,
@TST,<SMF.IN!SMF.D
`D!SMF.11>
	X	006000,177700,ROR,<S MF.IN!SMF.DD!SMF.@11>
	X	006000,00`7000,IOT,<SMF.IN!
SMF.P8>
	X	00610
 0,177700,ROL,<SMF
@.IN!SMF.DD!SMF.11
`>
	X	006200,1777!SM
	X	300,177700,ASLMF.11>
	X	006400 ,177700,MARK,<SMF@.IN!SMF.MK!SMF.11`>
	X	006700,177700,SXT,<SMF.IN!SM F.DD!SMF.11>
	X	@007000,007777,NOP`,<SMF.IN!SMF.P8>
	X	007001,007401 ,IAC,<SMF.IN!SMF.@P8>
	X	007002,00`7416,BSW,<SMF.IN!SMF.P8>
	X	00700 4,007406,RAL,<SMF@.IN!SMF.P8>
	X	0`07006,007406,RTL,<SMF.IN!SMF.P8>
 	X	007010,007412,@RAR,<SMF.IN!SMF.P`8>
	X	007012,007412,RTR,<SMF.IN!S MF.P8>
	X	007020@,007420,CML,<SMF.`IN!SMF.P8>
	X	007040,007440,CMA,< SMF.IN!SMF.P8>
	@X	007100,007500,C`LL,<SMF.IN!SMF.P8>
	X	007200,0076 00,CLA,<SMF.IN!SM@F.P8>
	X	007400,`007777,NOP,<SMF.IN!SMF.P8>
	X	007 401,007777,NOP,<S@MF.IN!SMF.P8>
	X`	007402,007403,HLT,<SMF.IN!SMF.P8> 
	X	007404,00740@5,OSR,<SMF.IN!SMF`.P8>
	X	007410,007571,SKP,<SMF.IN !SMF.P8>
	X	0074@20,007431,SNL,<SM`F.IN!SMF.P8>
	X	007421,007521,MQL ,<SMF.IN!SMF.P8>
	X	007430,007431`,SZL,<SMF.IN!SMF.P8>
	X	007440,00 7451,SZA,<SMF.IN!@SMF.P8>
	X	00745`0,007451,SNA,<SMF.IN!SMF.P8>
	X	0 07500,007511,SMA,@<SMF.IN!SMF.P8>
`	X	007501,007521,MQA,<SMF.IN!SMF.P 8>
	X	007510,007@511,SPA,<SMF.IN!S`MF.P8>
	X	007521,007521,SWP,<SMF. IN!SMF.P8>
	X	00@7600,007601,CLA,<`SMF.IN!SMF.P8>
	X	007601,007601,C LA,<SMF.IN!SMF.P8@>
	X	010000,1700`00,MOV,<SMF.IN!SMF.SS!SMF.11>
	X	 020000,170000,CMP@,<SMF.IN!SMF.SS!S`MF.11>
	X	030000 ,170000,BIT,<SMF.  IN!SMF.SS!SMF.11> @
	X	040000,17000 `0,BIC,<SMF.IN!SMF!.SS!SMF.11>
	X	0! 50000,170000,BIS,!@<SMF.IN!SMF.SS!SM!`F.11>
	X	060000,"170000,ADD,<SMF.I" N!SMF.SS!SMF.11>
	X	070000,177000"`,MUL,<SMF.IN!SMF.#EI!SMF.11>
	X	07# 1000,177000,DIV,<#@SMF.IN!SMF.EI!SMF#`.11>
	X	072000,1$77000,ASH,<SMF.IN$ !SMF.EI!SMF.11>
$@	X	073000,177000,$`ASHC,<SMF.IN!SMF.%EI!SMF.11>
	X	07% 4000,177000,XOR,<%@SMF.IN!SMF.JS!SMF%`.DD!SMF.11>
	X	0&75000,177770,FADD& ,<SMF.IN!SMF.RT!S&@MF.11>
	X	075010&`,177770,FSUB,<SMF'.IN!SMF.RT!SMF.11' >
	X	075020,1777'@70,FMUL,<SMF.IN!S'`MF.RT!SMF.11>
	X(	075030,177770,FD( IV,<SMF.IN!SMF.RT(@!SMF.11>
	X	0770(`00,177000,SOB,<SM)F.IN!SMF.SB!SMF.1) 1>
	X	100000,177)@400,BPL,<SMF.IN!S)`MF.BR!SMF.11>
	X*	100400,177400,BM* I,<SMF.IN!SMF.BR!*@SMF.11>
	X	10100*`0,177400,BHI,<SMF+.IN!SMF.BR!SMF.11+ >
	X	101400,1774+@00,BLOS,<SMF.IN!S+`MF.BR!SMF.11>
	X,	102000,177400,BV, C,<SMF.IN!SMF.BR!,@SMF.11>
	X	10240,`0,177400,BVS,<SMF-.IN!SMF.BR!SMF.11- >
	X	103000,1774-@00,BCC,<SMF.IN!SM-`F.BR!SMF.11>
	X	.103000,177400,BHI. S,<SMF.IN!SMF.BR![email protected]>
	X	10340.`0,177400,BCS,<SMF/.IN!SMF.BR!SMF.11/ >
	X	103400,1774/@00,BLO,<SMF.IN!SM/`F.BR!SMF.11>
	X	0104000,177400,EMT0 ,<SMF.IN!SMF.EM!S[email protected]>
	X	1044000`,177400,TRAP,<SMF1.IN!SMF.EM!SMF.111 >
	X	105000,17771@00,CLRB,<SMF.IN!S1`MF.DD!SMF.BY!SMF.211>
	X	105100,172 7700,COMB,<SMF.IN2@!SMF.DD!SMF.BY!SM2`F.11>
	X	105200,3177700,INCB,<SMF.3 IN!SMF.DD!SMF.BY![email protected]>
	X	105303`0,177700,DECB,<SM4F.IN!SMF.DD!SMF.B4 Y!SMF.11>
	X	1054@400,177700,NEGB,<4`SMF.IN!SMF.DD!SMF5.BY!SMF.11>
	X	15 05500,177700,ADCB5@,<SMF.IN!SMF.DD!S5`MF.BY!SMF.11>
	X6	105600,177700,SB6 CB,<SMF.IN!SMF.DD6@!SMF.BY!SMF.11>
6`	X	105700,177700,7TSTB,<SMF.IN!SMF.7 DD!SMF.BY!SMF.11>7@
	X	106000,177707`0,RORB,<SMF.IN!SM8F.DD!SMF.BY!SMF.18 1>
	X	106100,1778@700,ROLB,<SMF.IN!8`SMF.DD!SMF.BY!SMF9.11>
	X	106200,19 77700,ASRB,<SMF.I9@N!SMF.DD!SMF.BY!S9`MF.11>
	X	106300:,177700,ASLB,<SMF: .IN!SMF.DD!SMF.BY:@!SMF.11>
	X	1100:`00,170000,MOVB,<S;MF.IN!SMF.SS!SMF.; BY!SMF.11>
	X	12;@0000,170000,CMPB,;`<SMF.IN!SMF.SS!SM<F.BY!SMF.11>
	X	< 130000,170000,BIT<@B,<SMF.IN!SMF.SS!<`SMF.BY!SMF.11>
	=X	140000,170000,B= ICB,<SMF.IN!SMF.S=@S!SMF.BY!SMF.11>
	X	150000,170000>,BISB,<SMF.IN!SMF> .SS!SMF.BY!SMF.11>@>
	X	160000,1700>`00,SUB,<SMF.IN!SM?F.SS!SMF.11>
	X	? 163000,177777,UBA?@MAP,<SMF.11>
	X	?`163100,177777,UBA@.SR,<SMF.11>
	;X@ 	163200,177777,UB@@A.VC,<SMF.11>
	X@`	163300,177777,UBAA.MR,<SMF.11>
	XA 	177570,177777,SWA@,<SMF.11>
	X	177A`776,177777,PS,<SMBF.11>
	LIST	;TURB N LISTINGS BACK ON
TINGS BACK OS;&8; oA2
	XLIST
oa	CAIG	SP,177774
p	CAIG	SP,400-40
p 	JRST	RSTACK		;REp@D STACK VIOLATIONp`
	MOVEI	SP,-4(SPq)
	HRRZI	MA,2(SPq )
	STORE	MA,PS		q@;SAVE PS ON STACKq`
	STORE	SP,PC		;rSAVE PC ON STACK
	MOVEI	MA,A
	Lr@OAD	MA,T2		;GET Nr`EW PC IN TEMP REGs
	MOVEI	MA,2+A
	LOAD	MA,T1		;GEs@T NEW PS
	ANDI	Ts`1,377		;ONLY HAVEt A RH
	EXCH	PS,Tt 1		;SET NEW PS (At@ND PRESERVE OLD Ot`NE)
	MOVE	PC,T2	u	;LOAD NEW PC
	Cu ALL	PS.CHK		;ADJUu@ST FOR NEW PS LEVu`EL
	TRNE	PC,1		;vBE SURE OK
	JRSTv 	NXM...		;TAKE A BUS TRAP
KE A S<v+P S<v{P S?!` !)z
	INTSAV	20
	
	INTSAV	SH@ U7` a*
	JSR	@JM PCLC(IR)	;CALCULA  TE ADDR
	MOVE	PC @,T1		;SET NEW PC
	TRNE	PC,1		;BE !SURE KOSHER PC
	JRST	NXM...
		UO` !A*B
	JSR	@JM!aPCLC(IR)	;GET ADR" OF JSR
	TRZ	T2," 777770	;REG IN JS"@R REG,FOO
	HRLM	"`T1,T2		;SAVE SUBR#OUTINE ADR
	MOVE# 	T1,(T2)		;GET CU#@RRENT REG CONTENT#`S
	MOVEI	SP,-2(S$P)	;START PUSHING$  OLD REG ON STACK$@
	ANDI	SP,177777$`	;BE SURE DIDN'T %PUSH TO FAR
	HRR% ZM	PC,(T2)		;PUT %@PC IN REG
	HLRZ	%`PC,T2		;GET SUBRO&UTINE ADR BACK
	& HRRM PS,PS.REG+1	&@;SAVE PS IN CASE &`OF STACK VIOLATIO'N
	STORE	SP,T1		' ;FINISH PUSHING R'@EG ON STACK
	TRN'`E	PC,1		;BE SURE (NEW PC KOSHER
	J( RST	NXM...		;DIE
	NXM...		;DIE
@ D!h
	XLIST
DAIFN	<A-PC> <
	TD`RNE	A,1
	JRST	NEXM...		;DO ODD ADE DRESS TRAP
>;IFNE@ <A-PC>
IFN	<MAE`-A>,< HRRZ	MA,AF >	;COPY REG SO WF E CAN ROT IT
		MF@EMREL	MEMLIM
	CAF`IL	MA,0
IFE	<B-GT1> <
	CALL	IOLOG AD
LODRET==4		;NG@UMBER OF INSTRUCTG`IONS TO SKIP
>;IHFE <B-T1>
IFN	<H B-T1> <
	JRST	[H@MOVEM	T1,IOLT1S#	H`;SAVE T1
		CALL	IIOLOAD+2
		HRRZ	I B,T1
		MOVE	T1,I@IOLT1S#	;RESTORE I`T1
		JRST	.+LODRJET+1]
>;IFN <B-J T1>
	ROT	MA,-2
J@	SKIPGE	MA
		MEMJ`REL	MEMORY
	SKIPKA	B,0(MA)
		MEMK REL	MEMORY
	HLRZK@	B,0(MA)
	ANDI	K`B,177777	;STRIP LEXTRA BITS
IFE	<L B-PC> <
	TRNE	PL@C,1
	JRST	NXM...L`		;DO ODD ADDRESSM TRAP
>;IFE <B-PC>
>;IFE <B-[@ [qj7P [qlSP  [qm7P @[3@ (a*^
	ANDI	IR),77		;LEAVES N
	) LSH	IR,1		;MAKES )@N*2
	HRRZ	SP,IR
	ADDI	SP,(PC)		;*SP FROM PC + 2*NN* 
	HRRZ	PC,5		;PC*@ FROM R5
	LOAD	S*`P,5
	MOVEI	SP,2(+SP)
	ANDI	SP,177+ 777
	TRNE	PC,1		+@;IS NEW PC OK
	J+`RST	NXM...		;TAKE A BUS TRAP
	E[<}P [n)6 Ba
	IF2	<
CQ=	.
	RELOC	RLMTC AB+RLMSIZ
	A,,QC@
	RELOC	Q
>;IF2C`
RLMSIZ=	RLMSIZ+1
	.XCREF Q
+[3@ ,!*z
	HRRM PS,A,PS.REG+1	;IN CAS,`E OF BUS TRAP
	H-RRZ	T1,PS		;GET D- ATA TO STORE
	TR-@Z	PS,PS...N!PS...-`Z!PS...V
	TRNE	T.1,200
	TRO	PS,PS. ...N
	TRNN	T1,37.@7
	TRO	PS,PS...Z.`
	JRST	@BSTUFF(I/R)	;NOW STORE THE/  DATA
ZZRET==	-1
	
ZZRET==	-1[>$P [>$qP [>$.:P [>$XQP [>$\` %A9

	XLIST
%a
;MODE 0 - REGIS&TER MODE

	SGET& 0A:
	Z
	HRRZ	T&@1,(T2)		;GET REGI&`STER
	HRRZ	MA+1,'IR		;COPY DEST MO' DE
	ANDI	MA+1,7	'@	;LEAVE ONLY DEST'` REGISTER
	CAME	(MA+1,T2		;SAME AS(  SRC REGISTER ?
(@	JRST	@SGET0A	;N(`O SO DONE
	CAIL	)IR,20		;MAYBE DES) T IS REG OR @REG )@?
	CAILE	IR,57		)`;OR IS INDEXED OR* @INDEXED ?
	JRS* T	@SGET0A	;ONE O*@F THOSE SO DONE
*`	CAIGE	IR,30
	AD+DI	T1,4		;WAS AUT+ O INCREMENT MODE
	SUBI	T1,2
	AND+`I	T1,177777	;STRI,P EXTRA BITS
	JR, ST	@SGET0A

	G,@ET0A:
	Z
	HRRZ,`	T1,A
	JRST	@GE-T0A

	RGET0A:- 
	Z
	HRROI	MA,-@A
	HRRZ	T1,A
	-`JRST	@RGET0A

.	SBGT0A:
	Z
	H. RRZ	T1,(T2)		;GET.@ REGISTER
	ANDI	.`T1,377		;STRIP EX/TRA BITS
	HRRZ	M/ A+1,IR		;COPY DES/@T MODE
	ANDI	MA+/`1,7		;LEAVE ONLY 0DEST REGISTER
	C0 AME	MA+1,T2		;SAM0@E AS SRC REGISTER0` ?
	JRST	@SBGT01A	;NO SO DONE
	C1 AIL	IR,20		;MAYBE1@ DEST IS REG OR @1`REG ?
	CAILE	IR,257		;OR IS INDEXE2 D OR @INDEXED ?
2@	JRST	@SBGT0A	;O2`NE OF THOSE SO DO3NE
	CAIGE	IR,30
	IFL	<A-6>,<
	3@ADDI	T1,2
	SOS	T3`1
	>;IFL <A-6>
	IFGE	<A-6>,<
4 	ADDI	T1,4		;WAS 4@AUTO INCREMENT MO4`DE
	SUBI	T1,2
	5>;IFGE <A-6>
	A5 NDI	T1,377		;STRI5@P EXTRA BITS
	JR5`ST	@SBGT0A

	B6GET0A:
	Z
	HRR6 Z	T1,A
	ANDI	T16@,377
	JRST	@BGET6`0A

	BRGT0A:
	Z
	HRROI	MA,A7 
	HRRZ	T1,A
	A7@NDI	T1,000377
	J7`RST	@BRGT0A

	8JMP0A==JMPREG		;8 REGISTER MODE ILL8@EGAL FOR JMP & JS8`R

	PUT0A:
	H9RRZ	A,T1		;LOAD 9 REGISTER
	IFE	<9@A-PC> <
	TRNE	PC9`,1		;BE SURE PC N:OT CORRUPTED
	JR: ST	NXM...
	>;IFE:@ <A-PC>
	JRST	S:`IM11

	BPUT0A:;
	TRZ	A,377		;S; TRIP OLD BITS
	T;@RO	A,(T1)		;SET ;`NEW BITS
	IFE	<<A-PC> <
	TRNE	PC< ,1		;BE SURE PC N<@OT CORRUPTED
	JR<`ST	NXM...		;TAKE =A BUS TRAP
	>;IF= E <A-PC>
	JRST	=@SIM11
;MODE 1 -=` REGISTER DEFERRE>D

	RGET1A:
	> IFE	<A-6>,<
	Z@
	HRRZ	MA,A		;CO>`PY CONTENTS OF RE?GISTER
	CAIGE	MA? ,400
	JSR	STACKV?@		;WE'RE GONNA VI?`OLATE STACK
	LOA@D	MA,T1
	JRST	@R@ GET1A
	>;IFE <@@A-6>

	SGET1A:@`
	GET1A:
	Z
	ALOAD	A,T1
	JRSTA 	@GET1A

	BRGTA@1A:
	IFE	<A-6>A`,<
	Z
	HRRZ	MA,BA		;COPY STACK PB OINTER
	CAIGE	MAB@,400
	JSR	STACKVB`		;WE'RE GONNA VICOLATE STACK
	BLOC AD	MA,T1
	JRST	@C@BRGT1A
	>;IFE <C`A-6>

	SBGT1AD:
	BGET1A:
	Z 
	BLOAD	A,T1
	JD@RST	@BGET1A

	D`JMP1A:
	Z
	HRREZ	T1,A
	JRST	@JE MP1A

	PUT1A:E@
	STORE	A,T1
	E`JRST	SIM11

	BPFUT1A:
	BSTORE	F A,T1
	JRST	SIM11F@
;MODE 2 - AUTOF`-INCREMENT

	RGGET2A:
	IFE	<A-G 6>,<
	Z
	HRRZ	MG@A,A		;COPY STACKG` POINTER
	ADDI	HA,2
	IFL	<A-6>,H <ANDI A,177777>
	CAIGE	MA,400
	H`JSR	STACKV		;WE'RIE GONNA VIOLATE SI TACK
	LOAD	MA,T1I@
	JRST	@RGET2A
	>;IFE <A-6>
J
	SGET2A:
	GET2J A:
	Z
	HRRZ	MAJ@,A		;COPY REGISTJ`ER
	ADDI	A,2
	KIFL	<A-6>,<ANDI K A,177777>
	LOADK@	MA,T1
	JRST	@GEK`T2A

	BRGT2A:L
	IFE	<A-6>,<
L 	Z
	HRRZ	MA,A		L@;COPY STACK POINTL`ER
	IFGE	<A-6>,M< ADDI A,2 >
	IM FL	<A-6>,< AOS	M@A >
	IFL	<A-6>,M`<ANDI A,177777>
	CAIGE	MA,400
	N JSR	STACKV		;WE'RN@E GONNA VIOLATE SN`TACK
	BLOAD	MA,TO1
	JRST	@BRGT2AO 
	>;IFE <A-6>
O@
	SBGT2A:
	BGEO`T2A:
	Z
	HRRZ	PMA,A		;COPY REGIP STER
	IFGE	<A-6P@>,< ADDI A,2 >
P`	IFL	<A-6>,< AOSQ	A >
	IFL	<A-6Q >,<ANDI A,177777Q@>
	BLOAD	MA,T1
Q`	JRST	@BGET2A
R
	JMP2A:
	Z
	HR RRZ	T1,A
	ADDI	R@A,2
	IFL	<A-6>R`,<ANDI A,177777>S
	JRST	@JMP2A
S 
	PUT2A:
	HRRZS@	MA,A		;COPY REGS`ISTER
	ADDI	A,2T
	IFL	<A-6>,<ANT DI A,177777>
	ST@TORE	MA,T1
	JRSTT`	SIM11

	BPUT2UA:
	HRRZ	MA,A		U ;COPY REGISTER
	U@IFGE	<A-6>,< ADDU`I A,2 >
IFL	<AV-6>,<
	AOS	A
	V ANDI	A,177777
>V@
	BSTORE	MA,T1
V`	JRST	SIM11
;MOWDE 3 - AUTO-INCREW MENT DEFERRED

W@	SGET3A:
	GET3W`A:
	RGET3A:
	ZX
	HRRZ	MA,A		;CX OPY REGISTER
	ADX@DI	A,2
	IFL	<AX`-6>,<ANDI A,1777Y77>
	LOAD	MA,MA
	LOAD	MA,T1
	JRY@ST	@GET3A

	SBY`GT3A:
	BGET3A:Z
	BRGT3A:
	Z
Z 	HRRZ	MA,A		;COPZ@Y REGISTER
	ADDIZ`	A,2		
	IFL	<A[-6>,<ANDI A,1777[ 77>
	LOAD	MA,MA
	BLOAD	MA,T1
	J[`RST	@BGET3A

	\JMP3A:
	Z
	HRR\ Z	MA,A		;COPY RE\@GISTER
	ADDI	A,\`2
	IFL	<A-6>,<A]NDI A,177777>
	] LOAD	MA,T1
	JRST]@	@JMP3A

	PUT3]`A:
	HRRZ	MA,A	^	;COPY REGISTER
^ 	ADDI	A,2
	IFL	^@<A-6>,<ANDI A,1^`77777>
	LOAD	MA,_MA
	STORE	MA,T1
	JRST	SIM11

	_@BPUT3A:
	HRRZ	M_`A,A		;COPY REGIS`TER
	ADDI	A,2		` 
	IFL	<A-6>,<AN`@DI A,177777>
	L``OAD	MA,MA
	BSTORaE	MA,T1
	JRST	SIa M11
;MODE 4 - Aa@UTO-DECREMENT

a`	RGET4A:
	IFE	<bA-6>,<
	Z
	SUBb I	A,2
	IFL	<A-b@7>,<ANDI A,17777b`7>
	HRRZ	MA,A		c;COPY SP IN CASE c OF STACK VIOLATIOc@N
	CAIGE	MA,400
	JSR	STACKV		;WEd'RE GONNA VIOLATEd  STACK
	LOAD	MA,d@T1
	JRST	@RGET4d`A
	>;IFE <A-6>

	SGET4A:
	GEe T4A:
	Z
	SUBI	e@A,2
	IFL	<A-7>e`,<ANDI A,177777>f
	LOAD	A,T1
	Jf RST	@GET4A

	Bf@RGT4A:
	IFE	<Af`-6>,<
	Z
	IFGE	g<A-6>,< SUBI A,g 2 >
	IFL	<A-6>,g@< SOSGE A >
	IFg`L	<A-7>,<ANDI Ah,177777>
	HRRZ	Mh A,A
	CAIGE	MA,4h@00
	JSR	STACKV		h`;WE'RE GONNA VIOLiATE STACK
	BLOADi 	MA,T1
	JRST	@BRi@GT4A
	>;IFE <Ai`-6>

	SBGT4A:
	BGET4A:
	Z
	j IFGE	<A-6>,< SUBj@I A,2 >
	IFL	<j`A-6>,< SOSGE A >k
	IFL	<A-7>,<ANk DI A,177777>
	Bk@LOAD	A,T1
	JRSTk`	@BGET4A

	JMPl4A:
	Z
	IFL	<l A-7>,<ANDI A,177l@777>
	HRRZ	T1,Al`
	JRST	@JMP4A
m
	PUT4A:
	SUBIm 	A,2
	IFL	<A-7m@>,<ANDI A,177777m`>
	STORE	A,T1
n	JRST	SIM11

	Bn PUT4A:
	IFGE	<n@A-6>,< SUBI A,2 n`>
	IFL	<A-6>,< oSOSGE A >
	IFL	o <A-7>,<ANDI A,1o@77777>
	BSTORE	o`A,T1
	JRST	SIM11p
;MODE 5 - AUTOp -DECREMENT DEFERRp@ED

	SGET5A:
p`	GET5A:
	RGET5qA:
	Z
	SUBI	A,q 2
	IFL	<A-7>,<Aq@NDI A,177777>
	q`LOAD	A,MA
	LOADr	MA,T1
	JRST	@GEr T5A

	SBGT5A:r@
	BGET5A:
	BRGr`T5A:
	Z
	SUBI	sA,2		;2 (NOT 1) s BECAUSE DEFERRED
	IFL	<A-7>,<ANDs`I A,177777>
	LOtAD	A,MA
	BLOAD	t MA,T1
	JRST	@BGEt@T5A

	JMP5A:
	Z
	SUBI	A,2
u	IFL	<A-7>,<ANDIu  A,177777>
	LOAu@D	A,T1
	JRST	@Ju`MP5A

	PUT5A:v
	SUBI	A,2
	IFv L	<A-7>,<ANDI Av@,177777>
	LOAD	v`A,MA
	STORE	MA,Tw1
	JRST	SIM11
w 
	BPUT5A:
	SUBIw@	A,2		;2 (NOT 1)w` BECAUSE DEFERREDx
	IFL	<A-7>,<ANx DI A,177777>
	Lx@OAD	A,MA
	BSTORx`E	MA,T1
	JRST	SIyM11
;MODE 6 - Iy NDEXED

	RGET6y@A:
	IFE	<A-6>,<y`
	Z
	LOAD	PC,MAz
	ADDI	PC,2
	ADz D	MA,A
	ANDI	MAz@,177777
	CAIGE	Mz`A,400
	JSR	STACK{V		;WE'RE GONNA V{ IOLATE STACK
	LO{@AD	MA,T1
	JRST	@{`RGET6A
	>;IFE <|A-6>

	SGET6A| :
	GET6A:
	Z
|@	LOAD	PC,MA
	ADD|`I	PC,2
	ADD	MA,}A
	ANDI	MA,17777} 7
	LOAD	MA,T1
	}@JRST	@GET6A

	}`BRGT6A:
	IFE	<~A-6>,<
	Z
	LOAD~ 	PC,MA
	ADDI	PC,~@2
	ADD	MA,A
	A~`NDI	MA,177777
	CAIGE	MA,400
	JSR 	STACKV		;WE'RE G@ONNA VIOLATE STAC`K
	BLOAD	MA,T1
	JRST	@BRGT6A
	 >;IFE <A-6>

	@SBGT6A:
	BGET6`A:
	Z
	LOAD	PC,MA
	ADDI	PC,2
	 ADD	MA,A
	ANDI	@MA,177777
	BLOAD`	MA,T1
	JRST	@BGET6A

	JMP6A: 
	Z
	LOAD	PC,T1@
	ADDI	PC,2
	AD`D	T1,A
	ANDI	T1,177777
	JRST	@J MP6A

	PUT6A:@
	LOAD	PC,MA
	A`DDI	PC,2
	ADD	MA,A
	ANDI	MA,177 777
	IFE	<A-6>,@<
		CAIGE	MA,400`
		JSR	STCKVP		;MADE STACK VIOLAT ION
	>;IFE <A-6@>
	STORE	MA,T1
`	JRST	SIM11

	BPUT6A:
	LOAD	PC ,MA
	ADDI	PC,2
@	ADD	MA,A
	ANDI`	MA,177777
	IFE	<A-6>,<
		CAIGE 	MA,400
		JSR	ST@CKVP		;MADE STACK` VIOLATION
	>;IFE <A-6>
	BSTORE 	MA,T1
	JRST	SIM@11
;MODE 7 - IN`DEXED DEFERRED
	
	SGET7A:
	GET7	 A:
	RGET7A:
		@Z
	LOAD	PC,MA
		`ADDI	PC,2
	ADD	M
A,A
	ANDI	MA,17
 7777
	LOAD	MA,MA
@
	LOAD	MA,T1
	J
`RST	@GET7A

	SBGT7A:
	BGET7A :
	BRGT7A:
	Z@
	LOAD	PC,MA
	AD`DI	PC,2
	ADD	MA,
A
	ANDI	MA,1777
 77
	LOAD	MA,MA

@	BLOAD	MA,T1
	JR
`ST	@BGET7A

	J7A:
	Z
	LOADA
	ADDI	PC,
	ADD	MA,A
	AI	MA,177777
	LOAD	MA,T1
	JRST	 @JMP7A

	PUT7@A:
	LOAD	PC,MA
`	ADDI	PC,2
	ADD	MA,A
	ANDI	MA,1 77777
	LOAD	MA,M@A
	STORE	MA,T1
`	JRST	SIM11

	BPUT7A:
	LOAD	PC ,MA
	ADDI	PC,2
@	ADD	MA,A
	ANDI`	MA,177777
	LOAD	MA,MA
	BSTORE	M A,T1
	JRST	SIM11

	LIST
IM11[>%YP [>%m6P [>&%(P [?1` /a+
	HRRM PS0,PS.REG+1	;SAVE P0 S IN CASE OF STAC0@K VIOLATION
	TRZ0`	PS,PS...N!PS...Z1!PS...V
	TRNE	T11 ,100000	;DO WE WA1@NT N BIT
	TRO	PS1`,PS...N	;SET N BI2T
	SKIPN	T1
	TR2 O	PS,PS...Z	;SET 2@Z BIT
	JRST	@STU2`FF(IR)
ZZRET==	-1
	
ZZRET==	-[?4#@ 3!+>
	HRRM PS3A,PS.REG+1	;SAVE P3`S IN CASE OF STAC4K VIOLATION
	TRZ4 	PS,PS...N!PS...Z4@!PS...V
	TRNE	T14`,000200	;DO WE WA5NT N BIT
	TRO	PS5 ,PS...N	;SET N BI5@T
	SKIPN	T1
	TR5`O	PS,PS...Z	;SET 6Z BIT
	TRNE	IR,76 0		;CHECK FOR REG6@ISTER DST
	JRST	6`@BSTUFF(IR)
	TRN7E	T1,200		;WANT T7 O EXTEND SIGN ?
7@	TRO	T1,177600	;E7`XTEND SIGN
	HRRM	T1,(IR)
	HRRM[S3@ 8!+R
	JSR	@BF8AETCH(IR)	;GET WHA8`T TO SET PS TO
	9HRRM	PS,PS.REG+1	9 ;SAVE ORIGINAL PS9@
	HRRZ	PS,T1		;S9`ET NEW PS
	CALL	:PS.CHK		;TAKE AN : INTERRUPT MAYBE
	ERRUPT MAYBE
[Va` :a,:
	ANDI	T2;,7		;LEAVE ONLY R; EGISTER FIELD
	J;@SR	@FETCH(IR)	;GE;`T THE SOURCE OPER<AND
	TRZ	PS,PS..< .N!PS...Z!PS...V!<@PS...C
	TRNE	T1,<`100000	;NEGATIVE =VALUE ?
	IOR	T1,= [-1,,700000]	;EXT=@END SIGN
	MOVE	M=`A,(T2)		;GET REGI>STER ARGUMENT
	T> RNE	MA,100000	;NE>@GATIVE ARGUMENT ?>`
	IOR	MA,[-1,,70?0000]	;EXTEND SIG? N
	IMULB	T1,MA		?@;DO THE MULTIPLIC?`ATION
	SKIPN	T1	@	;WAS RESULT ZERO@ 
	TRO	PS,PS...Z	@@;REMEMBER IT WAS @`ZERO
	TLNE	T1,02A0000	;IS RESULT NA EGATIVE ?
	TRO	PA@S,PS...N	;REMEMBEA`R IT WAS NEGATIVEB
	CAML	T1,[-1,,7B 00000]
	CAILE	T1B@,077777
	TRO	PS,B`PS...C	;NEED MOREC THAN 16 BITS
	AC NDI	MA,177777	;LEC@AVES LOW ORDER POC`RTION
	LSH	T1,-^DD16	;LEAVES HIGH D ORDER PORTION
	AD@NDI	T1,177777	;STD`RIP EXTRA IF ANY
	MOVEM	T1,(T2)		E ;STORE HIGH ORDERE@ PORTION
	IORI	TE`2,1		;OTHER REG AFDDRESS
	MOVEM	MAF ,(T2)
	TRNE	PC,1F@		;DID THAT CORRUF`PT THE PC ?
	JRSGT	NXM...		;YES SOG  TAKE A BUS TRAP
	EABUSTRAP
	JSR	@RFHETCH(IR)	;GET OPEH RAND
	TRZ	PS,PS.[email protected]!PS...Z!PS...VH`!PS...C
	MOVNS	TI1
	ANDI	T1,17777I 7
	TRNE	T1,10000I@0
	TRO	PS,PS...NI`
	SKIPN	T1
	TROJA	PS,PS...Z
	TROJ 	PS,PS...C
	CAINJ@	T1,100000
	TRO	J`PS,PS...V
	RSTORE	A
	
	RSTOR]<#@ K!,r
	JSR	@BRKAFTCH(IR)	;GET OPEK`RAND
	TRZ	PS,PS.L..N!PS...Z!PS...VL !PS...C
	MOVNS	TL@1
	ANDI	T1,00037L`7
	TRNE	T1,00020M0
	TRO	PS,PS...NM 
	SKIPN	T1
	TROM@A	PS,PS...Z
	TROM`	PS,PS...C
	CAINN	T1,000200
	TRO	N PS,PS...V
	RSTORE	A
	
	RSTOR]? 0]Vl-3P `@ a
@ a&|i@ pa&}` p@aL@ aLqcQP aLqcWP aLqcZP aLqc[P aLqc]P aLtP!e
@ p
e8@ pBe= pFe,,@ p*eMm pJeMp r@eMx@ t@e pe\@ pDe@ p@e%2 pHe,,@ p"e] Na,x
	CALL	R.OSET		;DO COMMON STUFF
	COMMON Se  ,~e&:x b1
IFB <A>bQ,<JRST RSKP>
IFNbpB <A>,<
 IFIDN c<A>,<FAST>,<
	Ac0OS (P)
	RET>
 IcPFDIF <A>,<FAST>,cp<
	JRST RSKP>
>
JRST RSKP>
>e>a` OA-&
	JSR	@RFOaETCH(IR)	;GET OPEPRAND
	TRZ	PS,PS.P ..N!PS...Z!PS...VP@
	TRZE	PS,PS...CP`
	TLO	T1,400000	Q;CARRY BIT GOES TQ O SIGN BIT
	TRZEQ@	T1,100000	;CHECKQ` NEW CARRY
	TRO	RPS,PS...C!PS...V	R ;NEW CARRY AND OVR@ERFLOW (MAYBE)
	R`ROT	T1,1
	TRNE	TS1,100000	;GET A NS EGATIVE RESULT ?
	TRC	PS,PS...N!PS`S...V	;WIN NEGATITVE AND COMPLEMENTT  OVERFLOW
	SKIPNT@	T1
	TRO	PS,PS..T`.Z
	RSTORE	A
	
	RSTORE	A
	e>d#@ U!-T
	JSR	@BRUAFTCH(IR)	;GET OPEU`RAND
	TRZ	PS,PS.V..N!PS...Z!PS...VV 
	TRZE	PS,PS...CV@
	TLO	T1,400000	V`;CARRY BIT GOES TWO SIGN BIT
	TRZEW 	T1,000200	;CHECKW@ NEW CARRY
	TRO	W`PS,PS...C!PS...V	X;NEW CARRY AND OVX ERFLOW (MAYBE)
	X@ROT	T1,1
	TRNE	TX`1,000200	;GET A NYEGATIVE RESULT ?
	TRC	PS,PS...N!P[email protected]	;WIN NEGATIY`VE AND COMPLEMENTZ OVERFLOW
	SKIPNZ 	T1
	TRO	PS,PS..[email protected]
	RSTORE	A
	
	RSTORE	A
	e?` [.
	JSR	@RF[!ETCH(IR)	;GET OPE[@RAND
	TRZ	PS,PS.[`..N!PS...Z!PS...V\
	TRZE	PS,PS...C\ 
	JRST	.+4
	TRZ\@E	T1,1		;DO WE GE\`T A NEW CARRY ?
]	TRO	PS,PS...C!PS] ...V
	JRST	.+5
]@	TRO	T1,200000	;C]`ARRY BIT GOES TO ^SIGN BIT
	TRZE	T^ 1,1		;CHECK NEW C^@ARRY
	TROA	PS,PS^`...C!PS...N	;NEW _CARRY AND NEGATIV_ E
	TRO	PS,PS...V_@!PS...N	;OVERFLOW_` AND NEGATIVE
	L`SH	T1,-1
	SKIPN	` T1
	TRO	PS,PS...`@Z
	RSTORE	A
	
	RSTORE	A
	e?#@ a.4
	JSR	@BRa!FTCH(IR)	;GET OPEa@RAND
	TRZ	PS,PS.a`..N!PS...Z!PS...Vb
	TRZE	PS,PS...Cb 
	JRST	.+4
	TRZb@E	T1,1		;DO WE GEb`T A NEW CARRY ?
c	TRO	PS,PS...C!PSc ...V
	JRST	.+5
c@	TRO	T1,000400	;Cc`ARRY BIT GOES TO dSIGN BIT
	TRZE	Td 1,1		;CHECK NEW Cd@ARRY
	TROA	PS,PSd`...C!PS...N	;NEW eCARRY AND NEGATIVe E
	TRO	PS,PS...Ve@!PS...N	;OVERFLOWe` AND NEGATIVE
	LfSH	T1,-1
	SKIPN	f T1
	TRO	PS,PS...f@Z
	RSTORE	A
	
	RSTORE	A
	eB0P'}geBP'}beB0P'}oeB4 P'}`eB4@P'}deB$P'}ceB$ P'}ieB$0P'}neB&0P'}eeB&@P'}keB,4 P'}reB,4@P'}seB.$ P'}feB.$@P'}peB.$`P'}qeBdP'}heBn P'}jeB|`P'}meC`P'}leC<0P'}aeO%|R SA

	XLIST
SaIFE	<<A>&SMF.BY>T <	;FOLLOWING FORT  WORD MODE
	TLNET@	MA,MA..RG	;WAS LT`OCATION A REGISTEUR ?
	JRST	[HRRM	U T1,(MA)		;DEPOSITU@ APPROPRIATE REG
		TRNN	PC,1		;INV CASE SET PC
		JV RST	SIM11		;PC WAV@S GARBAGED
		JRSV`T	NXM...	]	;TAKE WA TRAP
	TLNE	MA,W MA..IO	;WAS LOCATW@ION AN IO REGISTEW`R ?
	JRST	[PUSH	XP,[EXP SIM11]	;PUX SH RETURN ON STACX@K
		JRST	IOR.B X`]	;RESTORE WORD TYO MEMORY
	SKIPGEY 	MA
	JRST	.+3
	Y@MEMREL	MEMORY
	HY`RLM	T1,0(MA)
	JRZST	SIM11
	MEMRELZ 	MEMORY
	HRRM T1Z@,0(MA)
>;IFE <<Z`A>&SMF.BY>

IFN[	<<A>&SMF.BY> <	[ ;FOLLOWING FOR BY[@TE RESTORE
	TLNN[` MA,MA..RG	;WAS L\OCATION A REGISTE\ R ?
	JRST .+5		;\@NOT A REGISTER
	\`DPB T1,[POINT 8,(]MA),35]	;THIS IS ] SLOW BUT PROB BES]@T WAY
	TRNN PC,1]`		;CHECK PC NOT P^OLLUTED
	JRST SI^ M11
	JRST NXM...^@		;TAKE A BUS TRA^`P

	TLNE MA,MA._.IO	;WAS LOCATION_  AN IO REGISTER ?_@
	JRST [PUSH	P,[_`EXP SIM11]	;PUSH `RETURN ON STACK
` 		JRST	IOBR.B ]	`@;RESTORE BYTE TO ``MEMORY
	DPB T1,SaIMPTR(MA+1)	;PUT a BYTE BACK INTO MEa@MORY
>;IFN <<A>&SMF.BY>
<<A>eRI` g.b
	LOAD	SPg!,T1		;PUT RESTOREg@D PC IN TEMP REG
	MOVEI	SP,2(SP)
	ANDI	SP,177776
	LOAD	SP,T2		;GEh@T NEW PS
	ANDI	Th`2,377		;WE DON'T iHAVE A LH
	HRRM	i PS,PS.REG+1	;SAVEi@ OLD PS
	MOVE	PSi`,T2		;LOAD NEW PSj
	MOVEI	SP,2(SP)j 
	ANDI	SP,177776j@
	MOVE	PC,T1		;Lj`OAD NEW PC
	TRNEk	PC,1		;CHECK PC k OK
	JRST	NXM...	k@	;TAKE A BUS TRAPk`
	CALL	PS.CHK		;lSEE IF THERE ARE l INTERRUPTS TO TAKE
	UPTS TO TAKeS` la/
	ANDI	IRm,7
	MOVE	PC,(IR)m 
	LOAD	SP,T1		;Gm@ET OLD REG FROM Sm`TACK
	MOVEM	T1,(nIR)		;LOAD REG FRn OM STACK
	MOVEI	n@SP,2(SP)	;FINISH n`POP
	ANDI	SP,177o777	;IN CASE OVERo FLOWED
	TRNE	PC,o@1		;BE SURE NEW Po`C OK
	JRST	NXM..p.		;TAKE A BUS TRAP
	E A BUS TReS!` pA/0
	LOAD	SPpa,T1
	MOVEI	SP,2(qSP)
	ANDI	SP,177q 776
	LOAD	SP,T2	q@	;GET NEW PS
	ANq`DI	T2,377		;WE DOrN'T HAVE A LH
	Hr RRM	PS,PS.REG+1	;r@SAVE OLD PS
	MOVr`E	PS,T2		;LOAD NEsW PS
	MOVEI	SP,2s (SP)
	ANDI	SP,17s@7776
	HRRZ	PC,T1s`		;LOAD NEW PC
	tTRNE	PC,1		;CHECKt  NEW PC OK
	JRSTt@	NXM...		;TAKE A t`BUS TRAP
	CALL	PuS.CHK		;SEE IF THu ERE ARE INTERRUPTu@S TO TAKE
	JRST	u`SIM11A		;INHIBIT vTRACE TRAP
ZZRET==	-1
	
ZZRETg
` vA/Z
	JSR	@RFvaETCH(IR)	;GET OPEwRAND
	TRZ	PS,PS.w ..N!PS...Z!PS...Vw@
	TRZE	PS,PS...Cw`
	JRST	.+8
	TRNxE	T1,100000
	TROx 	PS,PS...N
	CAINx@	T1,100000
	TRO	x`PS,PS...V
	JUMPNy	T1,SIM11
	TRO	Py S,PS...Z
	JRST	Sy@IM11
	SOSN	T1
	y`TRO	PS,PS...Z
	TzRNE	T1,100000
	Tz RO	PS,PS...N
	CAz@IN	T1,100000-1
	z`TRO	PS,PS...V
	T{RZE	T1,600000
	T{ RO	PS,PS...C
	RSTORE	A
	
	RSg
#@ {a0
	JSR	@BR|FTCH(IR)	;GET OPE| RAND
	TRZ	PS,PS.|@..N!PS...Z!PS...V|`
	TRZE	PS,PS...C}
	JRST	.+8
	TRN} E	T1,000200
	TRO}@	PS,PS...N
	CAIN}`	T1,000200
	TRO	~PS,PS...V
	JUMPN~ 	T1,SIM11
	TRO	P~@S,PS...Z
	JRST	S~`IM11
	SOSN	T1
	TRO	PS,PS...Z
	T RNE	T1,000200
	T@RO	PS,PS...N
	CA`IN	T1,000200-1
	TRO	PS,PS...V
	T RZE	T1,777400
	T@RO	PS,PS...C
	RSTORE	A
	
	RSg61d(P!g61hYP  g61h\P"g61iP g61i4P g61i6P g61j7P g61jYP g61k5P g61l
P @g61lP  g61lSP g61lZP g61lqP @g61lyP g61lzP g>` 0"
	ANDI	T2!,7		;GET REGISTER@ DESIGNATION
	SO`SN	T1,(T2)
	JRST	SIM11		;DON'T TA KE BRANCH
	ANDI	@T1,177777	;IN CAS`E OF OVERFLOW
	MOVEM	T1,(T2)
	AN DI	IR,77
	LSH	IR@,1
	SUBI	PC,(IR)`
	ANDI	PC,177777	;ONLY NEEDED IF  PC .LT. 200 !
	C .LT. 200 !
	g@@ gBa` a0,
	ANDI	IR,7		;LEAVE ONLY N EW PRIORITY
	DPB@	IR,P.PLVL
	CALL	PS.CHK
		CALLgRI @ gRcGP gRk<P gR~)  bH
	XLIST
b!IFN	<A-PC> <
	Tb@RNE	A,1
	JRST	Nb`XM...		;TAKE A BUcS TRAP
>;IFE <Ac -PC>
IFN	<MA-A>c@,< HRRZ	MA,A >
c`	MEMREL	MEMLIM
	dCAIL	MA,0		;BE SUd RE IN CORE
	JRSTd@	[IFN	<T1-B>,< Hd`RRZ T1,B>
Z=	7
		IFE	<A-6> <Z=e Z+2>
		PUSH	P,[Ee@XP .+Z]
		JRST	Ie`OSTOR ]
IFE	<A-f6>,<
	CAIGE	MA,4f 00		;IS THIS A STf@ACK VIOLATION ?
f`	JSR	STCKVP		;RECgORD VIOLATION (& g RESTORE PS)
>;IFg@E <A-6>
	ROT	MAg`,-2
	SKIPGE	MA
h	JRST	.+3
	MEMREh L	MEMORY
	HRLM	h@B,0(MA)
	JRST	.+h`2
	MEMREL	MEMORYi
	HRRM	B,0(MA)
HRRM	B,0(MA)
	MOVE	T2!,T1		;SAVE SRC
	@JSR	@RFETCH(IR)	;`GET DST
	MOVE	IR,T1		;SAVE COPY O F DST FOR PS...V @CALC
	SUB	T1,T2	`	;MAKES RESULT
	TRZ	PS,PS...N!PS. ..Z!PS...V!PS...C@
	TRNE	T1,100000`	;CHECK FOR NEGAT	IVE
	TRO	PS,PS..	 .N
	TRZE	T1,6000	@00	;CHECK FOR OVE	`RFLOW
	TRO	PS,PS
...C
	SKIPN	T1

 	TRO	PS,PS...Z
	
@XOR	IR,T2		;DST X
`OR SRC
	EQV	T2,T1		;SRC EQV RESUL T
	AND	T2,IR
	T@RNE	T2,100000
	T`RO	PS,PS...V
	RSTORE	A
	
	RSg\tP!<g^
#@ 
!0v
	JSR	@RF
AETCH(IR)	;GET ARG
`UMENT
	DPB	T1,[P19]
	L	T1,-10
	TRZSP.N!PS...Z!P
	TRNE	T1,000200
	TR O	PS,PS...N
	TRN@N	T1,377
	TRO	PS`,PS...Z
	RSTORE	A
	
	RSTORE	g_$: f?
IF2 <
 f1IFNDEF ZA,<EXTERfPNAL ZA>
 IFNDEFfp YA,<EXTERNAL YgA>	
>
	MOVE T1,g0[ZA]		
	MOVE T2gP,YA		
	CALL SWTgpTST		
	RET			
ST		
	RET			
g_$;w e-
IRP A,<e1YA::>
ZZ==0
IRePP B,<ZZ=ZZ!ZB>
	EXP ZZ
ZB> !1
	HRRM PSA,PS.REG+1	;IN CAS`E OF BUS TRAP
	TRZ	PS,PS...V	;ALW AYS CLEARED
	TRN@N	PS,PS...N
	TRO`A	PS,PS...Z	;WIN A Z BIT
	TRZA	PS ,PS...Z	;LOST THE@ Z BIT
	TDZA	T1,`T1
	MOVEI	T1,177777
	JRST	@STUFF (IR)
ZZRET==	-1
	
ZZRET==	-1h:/	1Q h:NL`Q h:~JQ @h;$[RQ h;%|Q  h;%|	Q hD@ hH@ hL@ hP@ hT@ i<Li $a2(
	.XCREF %ABC
	EXP	ABC

	EXP	ABi<Lx #2"
	XLIST
#!Q=0
REPEAT	10,<Q#@Q=0
REPEAT	10,< #`TAGDS2	A,\Q,\QQ
QQ=QQ+1
>
Q=Q+$ 1
.XCREF QQ,Q
>
	LIST
Q,Q
>iv-1Q  i&|P ri&|X@ ti&}` r i&}h@ t iJ@ a1
	INTSAV	34
	
	INTSAV	iO!` !1(
	JSR	@FEATCH(IR)	;GET OPER`AND
	TRZ	PS,PS...N!PS...Z!PS...V! PS...C
	TRNE	T1,@100000
	TRO	PS,P`S...N
	SKIPN	T1
	TRO	PS,PS...Z
	RO	PS,PS...Z
iO$#@ A1:
	JSR	@BFaETCH(IR)	;GET OPERAND
	TRZ	PS,PS. ..N!PS...Z!PS...V@!PS...C
	TRNE	T1`,000200
	TRO	PS,PS...N
	SKIPN	T1 
	TRO	PS,PS...Z
	RO	PS,PS...Z
	MOVEI	TdQ1,[ASCIZ \A\]
	CALL	TYPSTR

	krQP"ktlzP!kv,P$kvkP @k
	hJP Bk
	hKP Lk
	j9@'f@k
	k9@'f k
	ly@'f k
MVP Nk
X8@'fkDP!fk6~i  qk6~i6 q kC!cGP kC&	VP  kC&	WP !kC&	WP !kC&	[P  mH1P oNC@ a1|
	TADJUS
WAIT0:
	TXNN	FL G,F.EXEC	;RUNNING@ IN EXEC MODE ?
`	JRST	WAIT1		;NO
	SKIPN	BR7PND		; CHECK FOR INTERUP@TS HAPPENED
	SKI`PE	BR5PND		;CHECK OTHER FLAVOUR
	 JRST	SIM11		;GO T@AKE INTERRUPT
	S`OSLE	T1,INTDLY
	JRST	WAIT0		;NOT  YET
	TADJUS
	HR@RZ	T1,CTISPD
	MO`VEM	T1,INTDLY
	MOVEM	T1,INTDLY+1
	CALL	TIMCHK
	J@RST	WAIT0
	JRST	`SIM11

WAIT1:	HRRE	T1,INTDLY+1
 	ADDM	T1,INSRUN	;@ACCUMULATE NUMBER` OF INSTRUCTIONS EXECUTED
	ADDM	T 1,WAITIM	;ACCUMUL@ATE WAIT TIME
	M`OVE	T1,CTISPD
	HRRM	T1,INTDLY
	H RRM	T1,INTDLY+1
@	CALL	TIMCHK
	JRST	WAIT0
	
	JRoJ
@ poJ8@ pRoJ= pVoJ,,@ p(oJMm pZoJMp r`oJMx@ t`oK poK\@ pToK@ pPoK%2 pXoK,,@ p&q?`  2
	MOVE	T2 !,-740(T2)	;GET RE @GISTER
	JSR	@RFE `TCH(IR)	;GET OPER!AND
	TRZ	PS,PS..! .N!PS...Z!PS...V
	XOR	T1,T2
	TRN!`E	T1,100000
	TRO"	PS,PS...N
	SKIP" N	T1
	TRO	PS,PS."@..Z
	RSTORE	A
	
	RSTORE	A
$EHP S@P W]7P 
W]8P 
ZtEHP >}{woP