Google
 

Trailing-Edge - PDP-10 Archives - klad_sources - klad.sources/mosdef.mac
There are no other files named mosdef.mac in the archive.
	.SBTTL	MOSDEF -- DIAGNOSTIC MEMORY BOOT MACRO COMPATABILITY PACKAGE

	.IDENT	/001010/

;                            COPYRIGHT (C) 1975, 1978 BY
;                    DIGITAL EQUIPMENT CORPORATION, MAYNARD MASS.
;
;      THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE  USED  AND  COPIED
;      ONLY IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE AND WITH THE INCLUSION
;      OF THE ABOVE COPYRIGHT NOTICE.  THIS SOFTWARE OR ANY OTHER COPIES THERE-
;      OF  MAY NOT BE PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY OTHER PERSON.
;      NO TITLE TO OR OWNERSHIP OF THE SOFTWARE IS HEREBY TRANSFERRED.
;
;      THE INFORMATION CONTAINED IN THIS SOFTWARE IS SUBJECT TO CHANGE  WITHOUT
;      NOTICE  AND SHOULD NOT BE CONSTRUED AS A COMMITMENT BY DIGITAL EQUIPMENT
;      CORPORATION.
;
;      DIGITAL ASSUMES NO RESPONSIBILITY FOR THE  USE  OR  RELIABILITY  OF  ITS
;      SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPILED BY DIGITAL.
;
;	VERSION:	01-01
;
;	AUTHOR:		R. BELANGER
;
;	DATE:		11-AUG-78	
;
;	MODIFICATIONS:
;
;	EDIT	PROGRAMMER		REASON
;	----	----------		------
;	001	R. BELANGER		FIX BUG IN "PMSG"

	.MCALL	$DEF

	$DEF
	.MACRO	CALL	X,Y
	.NTYPE	$$,X
	.IF	EQ,$$&70
	 JSR	X,Y
	.IFF
	 JSR	PC,X
	.ENDC
	.ENDM	CALL

	.MACRO	CALLR	X
	 JMP	X
	.ENDM	CALLR

	.MACRO	RETURN	X
	.IF	NB,<X>
	 RTS	X
	.IFF
	 RTS	PC
	.ENDC
	.ENDM	RETURN

	.MACRO	PUSH	LOCS
	.IRP	L,<LOCS>
	 MOV	L,-(SP)
	.ENDR
	.ENDM	PUSH

	.MACRO	POP	LOCS
	.IRP	L,<LOCS>
	 MOV	(SP)+,L
	.ENDR
	.ENDM	POP
.MACRO	SL	REG,NUM
		.IF	GT,NUM-7
		.IFT
	  SWAB	REG
		.REPT	NUM-^D8
	  ASL	REG
		.ENDR
		.IFF
		.REPT	NUM
	  ASL	REG
		.ENDR
		.ENDC
.ENDM

.MACRO	SR	REG,NUM
		.IF	GT,NUM-7
		.IFT
	  SWAB	REG
		.REPT	NUM-^D8
	  ASR	REG
		.ENDR
		.IFF
		.REPT	NUM
	  ASR	REG
		.ENDR
		.ENDC
.ENDM

.MACRO	EXOR	REG,DESTIN,SCRTCH
		.IF	NB,SCRTCH
		.IFT
	  MOV	REG,SCRTCH
	  BIC	DESTIN,SCRTCH
	  BIC	REG,DESTIN
	  BIS	SCRTCH,DESTIN
		.IFF
	  MOV	REG,-(SP)
	  BIC	DESTIN,(SP)
	  BIC	REG,DESTIN
	  BIS	(SP)+,DESTIN
		.ENDC
.ENDM
STPCLK=	000	; STOP CLOCK
STRCLK=	001	; START CLOCK
SSCLK=	002	; SINGLE STEP THE MBOX CLOCK
SECLK=	003	; SINGLE STEP EBOX CLOCK
CECLK=	004	; CONDITIONAL EBOX CLOCK
CLRMR=	006	; CLEAR MR RESET
SETMR=	007	; SET MR RESET
BRCLK=	005	; BURST THE CLOCK
SETRUN=	011	; SET THE RUN FLOP
CONBUT=	012	; SET THE CONTINUE BUTTON
LDAR=	077	; LOAD THE AR REGISTER

$SBDIAG=BLKO
$$SBDIAG=PI
$APRID=BLKI
$$APRID=APR
$RDERA=BLKI
$$RDERA=PI
.SBTTL	DMBMCP -- DTE-20 OPERATION MACROS

;+
; DFRD -- DIAGNOSTIC FUNCTION READ TRANSLATION MACRO
;
; DFRD TRANSLATES THE DIAGNOSTIC EMT 116 IN TO A CALL TO "$DDFRD"
;
; SEQUENCE OF OPERATION:
;
;	1. R1 IS SAVED ON THE STACK
;	2. R1 IS SET POINTING TO STORAGE
;	3. CALL TO "$DDFRD" IS MADE
;
; ERROR RETURN -- CC-C SET
;
; SUCCESS RETURN -- CC-C CLEAR
;
;	R0 -- POINTS TO DEXWDS IN ".DFRBK"
;
; STACK SUMMARY:
;
;	STACK IS UNAFFECTED
;
; CALLER'S RESPONSIBILITIES:
;
;	NONE
;
;-

.MACRO	DFRD	FUNC,ADDR
.IF	NB,FUNC
	 MOV	#FUNC,R0	; ** FUNCTION READ CODE TO R0
.ENDC	; .IF NB,FUNC
	 MOV	R1,-(SP)	; ** SAVE R1
.IF	NB,ADDR
	 MOV	#ADDR,R1	; ** BUFFER POINTER TO R1
.IFF
	 CLR	R1		; ** NO DATA BUFFER
.IFTF
	 JSR	PC,$DDFRD	; ** EXECUTE THE FUNCTION READ
	 MOV	(SP)+,R1	; ** RESTORE R1
.ENDC	; .IF NB,ADDR
.ENDM	; DFRD
;+
; DFRDT -- DIAGNOSTIC FUNCTION READ (TRAILING) TRANSLATION MACRO
;
; DFRDT TRANSLATES THE DIAGNOSTIC EMT 140 INTO A "DFRD" MACRO (Q.V.)
;-

.MACRO	DFRDT	FUNC,ADDR
.IF	NB,FUNC
	 MOV	#FUNC,R0	; ** FUNCTION READ CODE TO R0
.ENDC	; .IF NB,FUNC
	 MOV	R1,-(SP)	; ** SAVE R1
.IF	NB,ADDR
	 MOV	#ADDR,R1	; ** BUFFER POINTER TO R1
.IFF
	 CLR	R1		; ** NO DATA BUFFER
.IFTF
	 JSR	PC,$DDFRD	; ** EXECUTE THE FUNCTION READ
	 MOV	(SP)+,R1	; ** RESTORE R1
.ENDC	; .IF NB,ADDR
.ENDM	; DFRDT
;+
; DFWRT -- DIAGNOSTIC FUNCTION WRITE TRANSTATION MACRO
;
; DFWRT  TRANSLATES A DIAGNOSTIC EMT 141 IN TO A CALL TO "$DDFWR"
;
; SEQUENCE OF OPERATION:
;
;	1. DATA POINTER IS LOADED INTO R1
;	2. FUNCTION CODE IS LOADED INTO R0
;	3. CALL IS MADE TO "$DFWR"
;
; ERROR RETURN -- CC-C SET
;
; SUCCESS RETURN -- CC-C CLEAR
;
;	R0, R1 -- UNCHANGED
;
; STACK SUMMARY:
;
;	STACK IS UNAFFECTED
;
; CALLER'S REPONSIBILITIES:
;
;	NONE
;-

.MACRO	DFWRT	ADDR,FUNC
.IF	NB,FUNC
	 MOV	#FUNC,R0	; ** FUNCTION WRITE CODE TO R0
.ENDC	; .IF NB,FUNC
.IF	NB,ADDR
	 MOV	R1,-(SP)	; ** SAVE R1
	 MOV	#ADDR,R1	; ** BUFFER POINTER TO R1
.IFTF
	 JSR	PC,$DDFWR	; ** EXECUTE THE FUNCTION WRITE
.IFT
	 MOV	(SP)+,R1	; ** RESTORE R1
.ENDC	; .IF NB,ADDR
.ENDM	; DFWRT
;+
; DFWRTT -- DIAGNOSIC FUNCTION WRITE (TRAILING) TRANSLATION MACRO
;
; DFWRT TRANSLATES A DIAGNOSTIC EMT 140 INTO A CALL TO "$DDFWR"
;
; SEQUENCE OF OPERATION:
;
;	1. DATA POINTER IS LOADED INTO R1
;	2. FUNCTION CODE IS LOADED INTO R0
;	3. CALL IS MADE TO "$DDFWR"
;
; ERROR RETURN -- CC-C SET
;
; SUCCESS RETURN -- CC-C CLEAR
;
;	R0, R1 -- UNCHANGED
;
; STACK SUMMARY:
;
;	STACK IS UNAFFECTED
;
; CALLER'S REPONSIBILITIES:
;
;	NONE
;-

.MACRO	DFWRTT	ADDR,FUNC
.IF	NB,FUNC
	 MOV	#FUNC,R0	; ** FUNCTION WRITE CODE TO R0
.ENDC	; .IF NB,FUNC
.IF	NB,ADDR
	 MOV	R1,-(SP)	; ** SAVE R1
	 MOV	#ADDR,R1	; ** BUFFER POINTER TO R1
.IFTF
	 JSR	PC,$DDFWR	; ** EXECUTE THE FUNCTION WRITE
.IFT
	 MOV	(SP)+,R1	; ** RESTORE R1
.ENDC	; .IF NB,ADDR
.ENDM	; DFWRTT
;+
; DFXCT -- DIAGNOSTIC FUNCTION EXECUTE MACRO
;
; DFXCT TRANSLATES A DIAGNOSTIC EMT 114 IN TO A CALL TO "$DDFXC"
;
; SEQUENCE OF OPERATION:
;
;	1. FUNCTION CODE IS LOADED INTO R0
;	2. CALL IS MADE TO "$DDFXC"
;
; ERROR RETURN -- CC-C SET
;
; SUCCESS RETURN -- CC-C CLEAR
;
;	R0, R1 -- UNCHANGED
;
; STACK SUMMARY:
;
;	STACK IS UNAFFECTED
;
; CALLER'S REPONSIBILITIES:
;
;	NONE
;-

.MACRO	DFXCT	FUNC
.IF	NB,FUNC
	 MOV	#FUNC,R0	; ** FUNCTION CODE TO R0
.ENDC	; .IF NB,FUNC
	 JSR	PC,$DDFXC	; ** EXECUTE THE FUNCTION EXECUTE
.ENDM	; DFXCT
;+
; DFXCTT -- DIAGNOSIC FUNCTION EXECUTE (TRAILING) TRANSLATION MACRO
;
; DFXCTT TRANSLATES A DIAGNOSTIC EMT 115 INTO A CALL TO "$DDFXC"
;
; SEQUENCE OF OPERATION:
;
;	1. FUNCTION CODE IS LOADED INTO R0
;	2. CALL IS MADE TO "$DDFXC"
;
; ERROR RETURN -- CC-C SET
;
; SUCCESS RETURN -- CC-C CLEAR
;
;	R0, R1 -- UNCHANGED
;
; STACK SUMMARY:
;
;	STACK IS UNAFFECTED
;
; CALLER'S REPONSIBILITIES:
;
;	NONE
;-

.MACRO	DFXCTT	FUNC
.IF	NB,FUNC
	 MOV	#FUNC,R0	; ** FUNCTION CODE TO R0
.ENDC	; .IF NB,FUNC
	 JSR	PC,$DDFXC	; ** EXECUTE THE FUNCTION EXECUTE
.ENDM	; DFXCTT
;+
; DPOS -- DIAGNOSTIC KL10 DEPOSIT MACRO
;
; DPOS TRANSLATES THE DIAGNOSTIC EMT 105 INTO A CALL TO "$DPOS"
;
; SEQUENCE OF OPERATION:
;
;	1. DATA POINTER IS LOADED INTO R0
;	2. KL10 ADDRESS POINTER IS LOADED INTO R1
;	3. THE CALL TO "$DPOS" IS EXECUTED
;
; ERROR RETURN -- CC-C IS SET
;
; SUCCESS RETURN - CC-C IS CLEAR
;
;	R0 AND R1 ARE UNCHANGED
;
; STACK SUMMARY:
;
;	STACK IS UNAFFECTED
;
; CALLER'S RESPONSIBILITIES:
;
;	NONE
;-

.MACRO	DPOS	ADDR,DATA
.IF	NB,DATA
	 MOV	#DATA,R0	; ** DATA POINTER TO R0
.ENDC	; .IF NB,DATA
.IF	NB,	ADDR
	 MOV	R1,-(SP)	; ** SAVE R1
	 MOV	#ADDR,R1	; ** ADDRESS POINTER TO R1
.IFTF
	 JSR	PC,$DPOS	; ** EXECUTE THE DEPOSIT
.IFT
	 MOV	(SP)+,R1	; ** RESTORE R1
.ENDC	; .IF NB,ADDR
.ENDM	; DPOS
;+
; DPOST -- DIAGNOSTIC KL10 DEPOSIT (TRAILING) MACRO
;
; DPOST TRANSLATES THE DIAGNOSTIC EMT 106 INTO A CALL TO "$DPOST"
;
; SEQUENCE OF OPERATION:
;
;	1. DATA POINTER IS LOADED INTO R0
;	2. KL10 ADDRESS POINTER IS LOADED INTO R1
;	3. THE CALL TO "$DPOS" IS EXECUTED
;
; ERROR RETURN -- CC-C IS SET
;
; SUCESS RETURN - CC-C IS CLEAR
;
;	R0 AND R1 ARE UNCHANGED
;
; STACK SUMMARY:
;
;	STACK IS UNAFFECTED
;
; CALLERS RESPONSIBILITIES:
;
;	NONE
;-

.MACRO	DPOST	ADDR,DATA
.IF	NB,	ADDR
	 MOV	#ADDR,R0	; ** ADDRESS TO R0
.ENDC	; .IF NB,ADDR
.IF	NB,DATA
	 MOV	R1,-(SP)	; ** SAVE R1
	 MOV	#DATA,R1	; ** DATA POINTER TO R1
.IFTF
	 JSR	PC,$DPOST	; ** EXECUTE THE DEPOSIT
.IFT
	 MOV	(SP)+,R1	; ** RESTORE R1
.ENDC	; .IF NB,DATA
.ENDM	; DPOST
;+
; EXAM -- DIAGNOSTIC KL10 EXAMINE TRANSLATION MACRO
;
; EXAM TRANSLATES A DIAGNOSTIC EMT 103 INTO A CALL TO "$EXAM"
;
; SEQUENCE OF OPERATION
;
;	1. R1 POINTS TO THE RETURNED DATA BUFFER
;	2. R0 POINTS TO THE KL10 ADDRESS
;	3. THE CALL TO "$EXAM" IS EXECUTED
;
; ERROR RETURN -- CC-C IS SET
;
; SUCCESS RETURN -- CC-C CLEAR
;
;	R1 IS MOVED TO R0 TO MAINTAIN COMPATABILITY
;
; STACK SUMMARY:
;
;	STACK IS UNAFFECTED
;
; CALLER'S RESPONSIBILITIES:
;
;	NONE
;-

.MACRO	EXAM	ADDR,DATA
.IF	NB,ADDR
	 MOV	#ADDR,R0	; ** ADDRESS POINTER TO R0
.ENDC	; .IF NB,ADDR
.IF	NB,DATA
	 MOV	R1,-(SP)	; ** SAVE R1
	 MOV	#DATA,R1	; ** DATA BUFFER POINTER TO R1
.IFTF
	 JSR	PC,$EXAMD	; ** EXECUTE THE KL10 EXAMINE
.IFT
	 MOV	(SP)+,R1	; ** RESTORE R1
.ENDC	; .IF NB,DATA
.ENDM	; EXAM
;+
; EXAMT -- DIAGNOSTIC KL10 EXAMINE (TRAILING) TRANSLATION MACRO
;
; EXAMT TRANSLATES A DIAGNOSTIC EMT 104 INTO A CALL TO "$EXAM"
;
; SEQUENCE OF OPERATION
;
;	1. R1 POINTS TO THE RETURNED DATA BUFFER
;	2. R0 POINTS TO THE KL10 ADDRESS
;	3. THE CALL TO "$EXAM" IS EXECUTED
;
; ERROR RETURN -- CC-C IS SET
;
; SUCCESS RETURN -- CC-C CLEAR
;
;	R1 IS MOVED TO R0 TO MAINTAIN COMPATABILITY
;
; STACK SUMMARY:
;
;	STACK IS UNAFFECTED
;
; CALLER'S RESPONSIBILITIES:
;
;	NONE
;-

.MACRO	EXAMT	ADDR,DATA
.IF	NB,ADDR
	 MOV	#ADDR,R0	; ** ADDRESS POINTER TO R0
.ENDC	; .IF NB,ADDR
.IF	NB,DATA
	 MOV	R1,-(SP)	; ** SAVE R1
	 MOV	#DATA,R1	; ** DATA BUFFER POINTER TO R1
.IFTF
	 JSR	PC,$EXAMT	; ** EXECUTE THE KL10 EXAMINE
.IFT
	 MOV	(SP)+,R1	; ** RESTORE R1
.ENDC	; .IF NB,DATA
.ENDM	; EXAMT
;+
; DFSCLK -- DAGNOSTIC SINGLE STEP CLOCK TRANSLATION MACRO
;
; DFSCLK TRANSALTES A DIAGNOSTIC EMT 122 INTO A "DFXCT SSCLK"
;
; SEE "DFXCT" FOR DETAILS
;-

.MACRO DFSCLK
	DFXCT	SSCLK
.ENDM	; DFSCLK
;+
; DFPC -- DIAGNOSTIC PC READ TRANSLATION MACRO
;
; DFPC RETURNS THE KL10 PC IN A TRIPLET POINTED TO BY R0
;-

.MACRO	DFPC	ADDR
.IF	NB,ADDR
	 MOV	#ADDR,R0	; ** BUFFER POINTER TO R0
.ENDC	; .IF NB,ADDR
	 JSR	PC,$DFPC	; ** READ THE KL10 PC
.ENDM	; DFPC
;+
; BURST -- BURST MBOX CLOCK TRANSLATION MACRO
;
; BURST TRANSLATES A DIAGNOSTIC EMT 131 INTO A CALL TO "$BURST"
;
; SEQUENCE OF OPERATION:
;
;	1. THE MBOX CLOCK BURST COUNT IS LOADED INTO R0
;	2. THE CALL TO "$BURST" IS MADE
;
; ERROR RETURN -- CC-C SET
;
; SUCCESS RETURN -- CC-C CLEAR
;
; STACK SUMMARY:
;
;	STACK IS UNAFFECTED
;
; CALLER'S RESPONSIBILITIES:
;
;	NONE
;-

.MACRO	BURST ARG
.IF	NB,ARG
	 MOV	#ARG,R0		; ** BURST COUNT TO R0
.ENDC	; .IF NB,ARG
	 JSR	PC,$BURST	; ** BURST THE MBOX CLOCK
.ENDM	; BURST
;+
; DTEBAS -- RETURN DTE-20 BASE ADDRESS TRANSLATION MACRO
;
; DTEBAS RETURNS THE THE BASE ADDRESS OF THE PRIVILEGED DTE-20 FROM
; ".PRDTE" IN THE REGISTER SPECIFIED
;-

.MACRO	DTEBAS	REG
.IF 	NB,REG
	 MOV	.PRDTE,REG	; ** DTE-20 BASE ADDRESS TO REG
.IFF
	MOV	.PRDTE,R0	; ** DTE-20 BASE ADDRESS TO R0
.ENDC	; .IF NB,REG
.ENDM	; DTEBAS
;+
; LODAR -- DIAGNOSTIC KL10 AR LOAD TRANSLATION MACRO
;
; LODAR TRANSLATES A DIAGNOSTIC EMT 102 INTO A CALL TO "$LDAR"
;
; SEQUENCE OF OPERATION:
;
;	1. R0 POINTS TO THE DATA TO BE LOADED INTO THE KL10 AR REGISTER
;	2. THE CALL TO "$LDAR" IS MADE
;
; ERROR RETURN -- CC-C SET
;
; SUCCESS RETURN -- CC-C CLEAR
;
; STACK SUMMARY:
;
;	STACK IS UNAFFECTED
;
; CALLER'S RESPONSIBILITIES:
;
;	NONE
;-

.MACRO	LODAR	DATA
.IF	NB,DATA
	 MOV	#DATA,R0	; ** DATA POINTER TO R0
.ENDC	; .IF NB,DATA
	 JSR	PC,$LDAR	; ** LOAD THE KL10 AR REGISTER
.ENDM	; LODAR
;+
; EXCT -- DIAGNOSTIC KL10 INSTRUCTION EXECUTE TRANSLATION MACRO
;
; EXCT TRANSLATES A DIAGNOSTIC EMT 101 INTO A CALL TO "$EXCT"
;
; SEQUENCE OF OPERATION:
;
;	1. POINTER TO KL10 INSTRUCTION IS LOADED INTO R0
;	2. CALL TO "$EXCT" IS MADE
;
; ERROR RETURN -- CC-C SET
;
; SUCCESS RETURN -- CC-C CLEAR
;
; STACK SUMMARY:
;
;	STACK IS UNAFFECTED
;
; CALLER'S RESPONSIBILITIES:
;
;	NONE
;-

.MACRO	EXCT	INST
.IF	NB,INST
	 MOV	#INST,R0	; ** KL10 INSTRUCTION POINTER TO R0
.ENDC	; .IF NB,INST
	 JSR	PC,$EXCT	; ** EXECUTE IT
.ENDM	; $EXCT
;+
; SM -- DIAGNOSTIC START MICROCODE TRANSLATION MACRO
;
; SM TRANSLATES A DIAGNOSTIC EMT 100 INTO A "MASTER RESET/ START CLOCK" SEQUENCE
;
; SEQUENCE:
;
;	1. A KL10 MASTER RESET SEQUENCE IS EXECUTED
;	2. THE KL10 CLOCK IS STARTED
;
; ERROR RETURN -- CC-C SET
;
; SUCCESS RETURN -- CC-C CLEAR
;
; STACK SUMMARY:
;
;	STACK IS UNAFFECTED
;
; CALLER'S RESPONSIBILITIES:
;
;	NONE
;-

.MACRO	SM
	 JSR	PC,$KLMR	; ** MASTER RESET THE KL10
	 MOV	#STRCLK,R0	; ** START CLOCK FUNCTION CODE TO R0
	 JSR	PC,$DDFXC	; ** START THE KL10 CLOCK
.ENDM	; SM
;+
; WWADR -- DIAGNOSTIC CRAM ADDRESS LOAD TRANSLATION MACRO
;
; WWADR TRANSLATES A DIAGNOSTIC EMT 075 INTO A CALL TO "$ACRAM"
;
; SEQUENCE OF OPERATION
;
;	1. CRAM ADDRESS IS LOADED INTO R0
;	2. CALL TO "$ACRAM" IS MADE
;
; ERROR RETURN -- CC-C SET
;
; SUCCESS RETURN -- CC-C CLEAR
;
; STACK SUMMARY:
;
;	STACK IS UNAFFECTED
;
; CALLER'S RESPONSIBILITIES:
;
;	NONE:
;-

.MACRO	WWADR	ADDR
.IF	NB,ADDR
	 MOV	#ADDR,R0	; ** CRAM ADDRESS TO R0
.ENDC	; .IF NB,ADDR
	 MOV	R0,-(SP)	; ** SAVE R0
	 JSR	PC,$KLMR	; ** RESET THE KL10
	 MOV	(SP)+,R0	; ** RESTORE R0
	 JSR	PC,$ACRAM	; ** LOAD THE CRAM ADDRESS REGISTER
.ENDM	; WWADR
;+
; MRESET -- DIAGNOSTIC KL10 MASTER RESET TRANSLATION MACRO
;
; MRESET TRANSLATES A DIAGNOSTIC EMT 076 INTO A CALL TO "$KLMR"
;
; SEQUENCE OF OPERATION:
;
;	1. THE CALL TO "$KLMR" IS EXECUTED
;
; ERROR RETURN -- CC-C SET
;
; SUCCESS RETURN -- CC-C CLEAR
;
; STACK SUMMARY:
;
;	STACK IS UNAFFECTED
;
; CALLER'S RESPONSIBILITIES:
;
;	NONE
;-

.MACRO	MRESET
	 JSR	PC,$KLMR	; ** MASTER RESET THE KL10
.ENDM	; MRESET
.SBTTL REGISTER SAVE/RESTORE TRANSLATION MACROS

;+
; REGSAV -- R1 - R5 SAVE TRANSLATION MACRO
; REGRST -- R1 - R5 RESTORE TRANSLATION MACRO
;
; SEQUENCE OF OPERATION:
;
;	1. REGSAV -- R1 - R5 ARE SAVED ON THE STACK
;	2. REGRST -- R1 - R5 ARE RESTORED FROM THE STACK
;
; ALWAYS RETURNS SUCCESS
;
; STACK SUMMARY:
;
;	SP+00 ==> SAVED R1
;	SP+02 ==> SAVED R2
;	SP+04 ==> SAVED R3
;	SP+06 ==> SAVED R4
;	SP+10 ==> SAVED R5
;	SP+12 ==> SUBROUTINE RETURN PC
;
; CALLER'S RESPONSIBILITIES
;
;	CALLS TO THESE ROUTINES MUST BE PARALLEL AND SYMMETRIC
;	A ROUTINE WHICH CALLS REGSAV UPON ENTRY MAY RESTORE R0 - R5 AND EXIT
;	TO ITS CALLER VIA A SIMPLE "RTS PC"
;-

.MACRO	REGSAV
	 JSR	PC,SAV.5	; ** SAVE R1 - R5 ON THE STACK
.ENDM	; REGSAV

.MACRO	REGRST
	 JSR	PC,RST.5	; ** RESTORE R1 - R5 AND RETURN
.ENDM	; REGRST
;+
; VARIOUS PRINT MACROS
;
; PFORCE -- NOOP
; PNORML -- NOOP
; PNTBAK -- NOOP
;
; CHARACTERISTICS:
;
;	OBVIOUS
;-

.MACRO	PFORCE
.ENDM	; PFORCE

.MACRO	PNORML
.ENDM	; PNORML

.MACRO	PNTBAK
.ENDM	; PNTBAK
;+
; PNT36 -- 36-BIT KL10 WORD PRINT TRANSLATION MACRO
;
; PNT36 TRANSLATES A DIAGNOSTIC EMT 042 INTO A CALL TO "$WDD36"
;
; SEQUENCE OF OPERATION:
;
;	1. THE POINTER TO THE 36-BIT DATA IS LOADED INTO R0
;	2. THE CALL TO "$WDD36" IS MADE
;
; ALWAYS RETURNS SUCCESS
;
; STACK SUMMARY:
;
;	STACK IS UNAFFECTED
;
; CALLER'S RESPONSIBILITIES:
;
;	NONE
;-

.MACRO	PNT36	ADDR
.IF	NB,ADDR
	 MOV	#ADDR,R0	; ** ADDRESS OF 36-BIT KL10 NUMBER TO R0
.ENDC	; .IF NB,ADDR
	 JSR	PC,$WDD36	; ** CALL TO PRINT ROUTINE
.ENDM	; PNT36
;+
; PNTADR -- 22-BIT KL10 ADDRESS PRINT TRANSLATION MACRO
;
; PNTADR TRANSLATES A DIAGNOSTIC EMT 042 INTO A CALL TO "$WDD22"
;
; SEQUENCE OF OPERATION:
;
;	1. THE POINTER TO THE 22-BIT DATA IS LOADED INTO R0
;	2. THE CALL TO "$WDD22" IS MADE
;
; ALWAYS RETURNS SUCCESS
;
; STACK SUMMARY:
;
;	STACK IS UNAFFECTED
;
; CALLER'S RESPONSIBILITIES:
;
;	NONE
;-

.MACRO	PNTADR	ADDR
.IF	NB,ADDR
	 MOV	#ADDR,R0	; ** ADDRESS OF 22-BIT KL10 ADDRESS TO R0
.ENDC	; .IF NB,ADDR
	 JSR	PC,$WDD22	; ** CALL TO PRINT ROUTINE
.ENDM	; PNTADR
;+
; PNTNBR -- NUMERIC PRINT TRANSLATION MACRO
;
; PNTNBR TRANSLATES A DIAGNOSTIC PRINT EMT INTO A CALL TO "$TDB2O"
;
; SEQUENCE OF OPERATION:
;
;	"$TDB2O" IS CALLED
;
; ALWAYS RETURNS SUCCESS
;
; STACK SUMMARY:
;
;	STACK IS UNAFFECTED
;
; CALLER'S RESPONSIBILITIES:
;
;	NONE
;-

.MACRO	PNTNBR
	 MOV	R0,-(SP)	; ** SAVE R0
	 BIC	#^C777,R0	; ** MASK OFF UNWANTED BITS
	 JSR	PC,$TDB2O	; ** PRINT THE NUMBER
	 MOV	(SP)+,R0	; ** RESTORE R0
.ENDM	; PNTNBR
;+
; PNT36B -- 36-BIT KL10 WORD PRINT TRANSLATION MACRO
;
; PNT36B TRANSLATES A DIAGNOSTIC EMT 134 INTO A CALL TO "$WDD36"
;
; SEQUENCE OF OPERATION:
;
;	1. THE POINTER TO THE 36-BIT DATA IS LOADED INTO R0
;	2. THE CALL TO "$WDD36" IS MADE
;
; ALWAYS RETURNS SUCCESS
;
; STACK SUMMARY:
;
;	STACK IS UNAFFECTED
;
; CALLER'S RESPONSIBILITIES:
;
;	NONE
;-

.MACRO	PNT36B	ADDR
.IF	NB,ADDR
	 MOV	#ADDR,R0	; ** ADDRESS OF 36-BIT KL10 NUMBER TO R0
.ENDC	; .IF NB,ADDR
	 JSR	PC,$WDD36	; ** CALL TO PRINT ROUTINE
.ENDM	; PNT36B
;+ PNTOCT -- PRINT OCTAL NUMBER TRANSLATION MACRO
;
; PNTOCT TRANSLATES A DIAGNOSTIC EMT 035 INTO A CALL TO "$TDB2O"
;
; SEQUENCE OF OPERATION
;
;	1. THE NUMBER TO BE PRINTED IS LOADED INTO R0
;	2. THE CALL IS MADE TO "$TDB2O"
;
; ALWAYS RETURNS SUCCESS
;
; STACK SUMMARY:
;
;	STACK IS UNAFFECTED
;
; CALLER'S RESPONSIBILITIES:
;
;	NONE
;-

.MACRO	PNTOCT	NUMB
.IF	NB,NUMB
	.NTYPE	$$T$$,NUMB
.IF	EQ,$$T$$&70
	 MOV	NUMB,R0		; ** GET THE NUMBER INTO R0
.IFF
	 MOV	#NUMB,R0	; ** GET THE NUMBER INTO R0
.ENDC	; .IF EQ,$$T$$&70
.ENDC	; .IF NB,NUMB
	 JSR	PC,$TDB2O	; ** PRINT THE NUMBER
.ENDM	; PNTOCT
;+ PNTOCS -- PRINT OCTAL NUMBER TRANSLATION MACRO
;
; PNTOCS TRANSLATES A DIAGNOSTIC EMT 036 INTO A CALL TO "$TDB2O"
;
; SEQUENCE OF OPERATION
;
;	1. THE NUMBER TO BE PRINTED IS LOADED INTO R0
;	2. THE CALL IS MADE TO "$TDB2O"
;
; ALWAYS RETURNS SUCCESS
;
; STACK SUMMARY:
;
;	STACK IS UNAFFECTED
;
; CALLER'S RESPONSIBILITIES:
;
;	NONE
;-

.MACRO	PNTOCS	NUMB
.IF	NB,NUMB
	.NTYPE	$$T$$,NUMB
.IF	EQ,$$T$$&70
	 MOV	NUMB,R0		; ** GET THE NUMBER INTO R0
.IFF
	 MOV	#NUMB,R0	; ** GET THE NUMBER INTO R0
.ENDC	; .IF EQ,$$T$$&70
.ENDC	; .IF NB,NUMB
	 JSR	PC,$TDB2O	; ** PRINT THE NUMBER
.ENDM	; PNTOCS
;+ PNTDEC -- PRINT DECIMAL NUMBER TRANSLATION MACRO
;
; PNTDEC TRANSLATES A DIAGNOSTIC EMT 037 INTO A CALL TO "$TDB2I"
;
; SEQUENCE OF OPERATION
;
;	1. THE NUMBER TO BE PRINTED IS LOADED INTO R0
;	2. THE CALL IS MADE TO "$TDB2I"
;
; ALWAYS RETURNS SUCCESS
;
; STACK SUMMARY:
;
;	STACK IS UNAFFECTED
;
; CALLER'S RESPONSIBILITIES:
;
;	NONE
;-

.MACRO	PNTDEC	NUMB
.IF	NB,NUMB
	.NTYPE	$$T$$,NUMB
.IF	EQ,$$T$$&70
	 MOV	NUMB,R0		; ** GET THE NUMBER INTO R0
.IFF
	 MOV	#NUMB,R0	; ** GET THE NUMBER INTO R0
.ENDC	; .IF EQ,$$T$$&70
.ENDC	; .IF NB,NUMB
	 JSR	PC,$TDB2I	; ** PRINT THE NUMBER
.ENDM	; PNTDEC
;+
; PNTODT -- FORMATTED OCTAL PRINT TRANSLATION MACRO
;
; PNTODT TRANSLATES A DIAGNOSTIC EMT 047 INTO A CALL TO "$TDB2O"
;
; SEQUENCE OF OPERATION:
;
;	1. THE NUMBER IN R0 IS MASKED TO THE PROPER WIDTH
;	2. THE CALL TO "$TDB2O" IS MADE
;
; ALWAYS RETURNS SUCCESS
;
; STACK SUMMARY:
;
;	STACK IS UNAFFECTED
;
; CALLER'S RESPONSIBILITIES:
;
;	NONE
;-

.MACRO	PNTODT	ARG
.IF	NB,ARG
	 MOV	R0,-(SP)	; ** SAVE R0
.IF	EQ,ARG-1
	 BIC	#^C7,R0		; ** MASK OUT UNWANTED BITS
.ENDC	; .IF EQ, ARG-1
.IF	EQ,ARG-2
	 BIC	#^C77,R0	; ** MASK OUT UNWANTED BITS
.ENDC	; .IF EQ, ARG-2
.IF	EQ,ARG-3
	 BIC	#^C777,R0	; ** MASK OUT UNWANTED BITS
.ENDC	; .IF EQ, ARG-3
.IF	EQ,ARG-4
	 BIC	#^C7777,R0	; ** MASK OUT UNWANTED BITS
.ENDC	; .IF EQ, ARG-4
.IF	EQ,ARG-5
	 BIC	#^C77777,R0	; ** MASK OUT UNWANTED BITS
.ENDC	; .IF EQ, ARG-5
.IFTF
	 JSR	PC,$TDB2O	; ** PRINT THE NUMBER
.IFT
	 MOV	(SP)+,R0	; ** RESTORE R0
.ENDC	;.IF NB,ARG
.ENDM	; PNTODT
;+
; PMSG -- DIAGNOSTIC PRINT TRANSLATION MACRO
;
; PMSG TRANSLATES A DIAGNOSTIC PRINT CALL INTO A CALL TO  "$TTDMS"
;
; SEQUENCE OF OPERATION:
;
;	1. A POINTER TO THE MESSAGE IS LOADED INTO R0
;	2. THE CALL TO "$TTDMS" IS MADE
;
; ALWAYS RETURNS SUCCESS
;
; STACK SUMMARY:
;
;	STACK IS UNAFFECTED
;
; CALLER'S RESPONSIBILITIES
;
;	NONE
;-

.MACRO	PMSG	MSG,?L1,?L2
	 MOV	#L1,R0		; ** MESSAGE POINTER TO R0
	 JSR	PC,$TTDMS	; ** OUTPUT THE MESSAGE
	 BR	L2		; ** BRANCH AROUND TEXT
	 ;
L1:	 .ASCIZ	%MSG%
	 .EVEN
L2:
.ENDM	; PMSG
;+
; PNTAL -- DIAGNOSTIC PRINT ASCII LINE TRANSLATION MACRO
;
; PNTAL TRANSLATES A DIAGNOSTIC PRINT CALL INTO A CALL TO  "$TTDMS"
;
; SEQUENCE OF OPERATION:
;
;	1. A POINTER TO THE MESSAGE IS LOADED INTO R0
;	2. THE CALL TO "$TTDMS" IS MADE
;
; ALWAYS RETURNS SUCCESS
;
; STACK SUMMARY:
;
;	STACK IS UNAFFECTED
;
; CALLER'S RESPONSIBILITIES
;
;	NONE
;-

.MACRO	PNTAL
	 JSR	PC,$TTDMS	; ** OUTPUT THE MESSAGE
.ENDM	; PNTAL
;+
; $PMSG -- DIAGNOSTIC PRINT TRANSLATION MACRO
;
; $PMSG TRANSLATES A DIAGNOSTIC PRINT EMT INTO A CALL TO "$TTDMS"
;
; SEQUENCE OF OPERATION
;
;	1. MESSAGE POINTER IS LOADED INTO R0
;	2. CALL IS MADE TO "$TTDMS"
;
; ALWAYS RETURNS SUCCESS
;
; STACK SUMMARY:
;
;	STACK IS UNAFFECTED
;-

.MACRO	$PMSG	ARG
.IF	NB,ARG
	 MOV	#ARG,R0		; ** TEXT POINTER TO R0
.ENDC	; .IF NB,ARG
	 JSR	PC,$TTDMS	; ** OUTPUT THE MESSAGE
.ENDM	; $PMSG	
;+
; PSPACE ET. AL. -- VARIOUS PRINT MACROS
;
; PSPACE PRINTS A <SPACE>
; PTAB PRINTS A <TAB>
; PSLASH PRINTS A <SLASH>
; PBELL PRINTS A <BELL>
; PCRLF PRINTS A <CR><LF>
;
; SEQUENCE OF OPERATION:
;
;	THE APPROPRIATE CALL IS MADE
;
; ALWAYS RETURNS SUCCESS
;
; STACK SUMMARY:
;
;	STACK IS UNAFFECTED
;
; CALLER'S RESPONSIBILITIES:
;
;	NONE
;-

.MACRO	PSPACE
	 JSR	PC,$TTSPC	; ** PRINT A <SPACE>
.ENDM	; PSPACE

.MACRO	PSLASH
	 JSR	PC,$TTSLS	; ** PRINT A <SLASH>
.ENDM	; PSLASH

.MACRO	PBELL
	 JSR	PC,$TTBEL	; ** PRINT A <BELL>
.ENDM	; PBELL

.MACRO	PTAB
	 JSR	PC,$TTTAB	; ** PRINT A <TAB>
.ENDM	; PTAB

.MACRO	PCRLF
	 JSR	PC,$TCRLF	; ** PRINT A <CR><LF>
.ENDM	; PCRLF
;+
; TTIOCT -- DIAGNOSTIC OCTAL INPUT TRANSLATION MACRO
;
; TTIOCT TRANSLATES A DIAGNOSTIC OCTAL INPUT EMT INTO A CALL TO "$TDO2B"
;
; SEQUENCE OF OPERATION:
;
;	THE CALL TO "$TDO2B" IS EXECUTED
;
; SUCCESS RETURN -- CC-C CLEAR
;
; ERROR RETURN -- CC-C SET
;
;	NUMBER IN R0 IN EITHER CASE
;
; STACK SUMMARY:
;
;	STACK IS UNAFFECTED
;
; CALLER'S RESPONSIBILITIES:
;
;	NONE
;-

.MACRO	TTIOCT
	 JSR	PC,$TDO2B	; ** READ OCTAL NUMBER
.ENDM	; TTIOCT
;+
; TTIDEC -- DIAGNOSTIC DECIMAL INPUT TRANSLATION MACRO
;
; TTIDEC TRANSLATES A DIAGNOSTIC DECIMAL INPUT EMT INTO A CALL TO "$TDI2B"
;
; SEQUENCE OF OPERATION:
;
;	THE CALL TO "$TDI2B" IS EXECUTED
;
; SUCCESS RETURN -- CC-C CLEAR
;
; ERROR RETURN -- CC-C SET
;
;	NUMBER IN R0 IN EITHER CASE
;
; STACK SUMMARY:
;
;	STACK IS UNAFFECTED
;
; CALLER'S RESPONSIBILITIES:
;
;	NONE
;-

.MACRO	TTIDEC
	 JSR	PC,$TDI2B	; ** READ DECIMAL NUMBER
.ENDM	; TTIDEC
;+
; TTILIN -- DIAGNOSTIC TERMINAL INPUT TRANSLATION MACRO
;
; TTILIN TRANSLATES A DIAGNOSTIC TERMINAL INPUT EMT INTO A CALL TO "$TTRD"
;
; SEQUENCE OF OPERATION:
;
;	THE CALL TO "$TTRD" IS EXECUTED
;
; SUCCESS RETURN -- INPUT STRING IN ".TTIBF"
;
; ESCAPES THROUGH "$ERROR" ON ERROR
;
; STACK SUMMARY:
;
;	STACK IS UNAFFECTED
;
; CALLER'S RESPONSIBILITIES:
;
;	NONE
;-

.MACRO	TTILIN
	 JSR	PC,$TTRD	; ** READ TERMINAL INPUT
.ENDM	; TTILIN
;+
; TTILNW -- DIAGNOSTIC TERMINAL INPUT TRANSLATION MACRO
;
; TTILNW TRANSLATES A DIAGNOSTIC TERMINAL INPUT EMT INTO A CALL TO "$TTRD"
;
; SEQUENCE OF OPERATION:
;
;	THE CALL TO "$TTRD" IS EXECUTED
;
; SUCCESS RETURN -- INPUT STRING IN ".TTIBF"
;
; ESCAPES THROUGH "$ERROR" ON ERROR
;
; STACK SUMMARY:
;
;	STACK IS UNAFFECTED
;
; CALLER'S RESPONSIBILITIES:
;
;	NONE
;-

.MACRO	TTILNW
	 JSR	PC,$TTRD	; ** READ TERMINAL INPUT
.ENDM	; TTILNW
;+
; FATAL -- MEMORY BOOT ERROR CALL TRANSLATION MACRO
;
; FATAL EXECUTES A CALL TO "$FATAL" WHERE THE MEMORY BOOT IS ABORTED
; AFTER THE ERROR CODE IS PRINTED
;
; SEQUENCE OF OPERATION:
;
;	THE CALL TO "$FATAL" IS EXECUTED
;
; NEVER RETURNS (GUARANTEED ESCAPE)
;
; STACK SUMMARY:
;
;	POINTER TO ERROR TEXT IS ON TOP OF THE STACK
;
; CALLER'S RESPONSIBILITIES:
;
;	NONE
;-

.MACRO	FATAL	TXT
.IF NB,	<TXT>
ER$'TXT==.
	 JSR	PC,$FATAL	; ** FATAL "TXT" ERROR
	 .ASCIZ	%TXT%
	.EVEN
.IFF
	.ERROR			; ** UNDEFINED ERROR TRAP!!
.ENDC	; .IF NB, <TXT>
.ENDM	; FATAL