Google
 

Trailing-Edge - PDP-10 Archives - BB-D351B-SM - sources/minint.p11
There are 8 other files named minint.p11 in the archive. Click here to see a list.
.SBTTL	MINOR INTERRUPTS AND MISCELLANEOUS
;
; THIS SECTION CONTAINS THE MINOR INTERRUPTS
;  (PARITY ERROR, BUS TRAP, ILLEGAL INSTRUCTION, 
;  IOT INSTRUCTION, EMT INSTRUCTION, TRACE TRAP (BPT 
;  INSTRUCTION AND T-BIT), CLOCK, POWER FAIL AND UNKNOWN).
;  THIS SECTION ALSO CONTAINS THE CODE TO RECORD TRACE
;  INFORMATION, WHICH IS DRIVEN BY THE TRACE INTERRUPT
;  OR BY THE TRACE MACRO.  THE CHUNK OWNERSHIP RECORDING
;  SUBROUTINES AND THE KG11-A SIMULATOR HAVE BEEN
;  INCLUDED HERE FOR LACK OF ANY
;  OBVIOUSLY BETTER PLACE TO PUT THEM.
;
.REPT 0


                          COPYRIGHT (c) 1980, 1979
            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  THEREOF MAY NOT BE PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY
OTHER PERSON.  NO TITLE TO AND OWNERSHIP OF  THE  SOFTWARE  IS  HEREBY
TRANSFERRED.

THE INFORMATION 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 SUPPLIED BY DIGITAL.

.ENDR
;
;
;	REVISION HISTORY
;
; 3(001) BS	MODIFIED TO SAVE REGISTERS ON STOPCODE WITH DEBUG OFF
;
;
VMINNT=001
;
;
VEDIT=VEDIT+VMINNT
;
;
;
;
;
;
;
; COME HERE FOR VARIOUS TRAPS.  BUS ERROR TRAP WITH THE DL10
;  DISABLED CAUSES A SPECIAL EXIT.  ALL OTHER TRAPS ARE
;  FATAL.
;
; HERE ON PARITY ERROR INTERRUPT.
;
MP.INT:	MOV	MP.REG,MEMERR	;SAVE FOR INTERESTED PARTIES
	STOPCD	MEM		;HALT.
;
; HERE ON BUS TIMEOUT.
;
NXMINT:	MOV	(SP)+,NXMPC	;RECORD PC OF BUS TRAP
	MOV	NXMGO,-(SP)	;REPLACE WITH SPECIFIED PC
	RTI			; GO THERE, RESTORING INTERRUPTS
;
; NORMALLY, BUS TRAPS COME HERE.
;
NXMNRM:	TST	DLGONE		;DO WE ALREADY KNOW THE DL10 IS GONE?
	BEQ	11$		;NO, SPECIAL EXIT.
	STOPCD	NXM		;YES, MUST BE FATAL ERROR.
;
; HERE ON BUS ERROR TRAP AND THE DL10 IS DISABLED.  DO SPECIAL
; BRANCH IF REQUESTED.
;
11$:	TST	NXMSP		;ANY SPECIAL EXIT SPECIFIED?
	BEQ	12$		;NO.
	MOV	#-1,DLGONE	;YES, NOTE DL10 IS NOW GONE.
	CLR	DLGNTM		;WAIT A WHILE BEFORE TRYING TO RESTART IT
	MOV	NXMSP,SP	;LOAD STACK POINTER
	CLR	NXMSP		;ONLY DO THIS ONCE
	SEC			;SET "C" AS A FLAG
	RTS	PC		;AND RETURN TO CALLER.
;
; HERE IF NO SPECIAL EXIT SPECIFIED
;
12$:	STOPCD	NXM		;HALT.
;
;
; HERE ON ILLEGAL INSTRUCTION, IOT, EMT AND RANDOM
; INTERRUPT.
;
ILSINT:
.IF NE,DEBUG
	MOV	(SP)+,ILSERR	;SAVE TRAP INFO
	MOV	(SP)+,ILSERR+2	; IN CASE ANYBODY IS INTERESTED
	STOPCD	ILS		;HALT
.ENDC ;.IF NE,DEBUG
IOTINT:
.IF NE,DEBUG
	MOV	(SP)+,ILSERR	;SAVE TRAP INFO
	MOV	(SP)+,ILSERR+2	; IN CASE ANYBODY IS INTERESTED
	STOPCD	ILS		;HALT
.ENDC ;.IF NE,DEBUG
EMTINT:
.IF NE,DEBUG
	MOV	(SP)+,ILSERR	;SAVE TRAP INFO
	MOV	(SP)+,ILSERR+2	; IN CASE ANYBODY IS INTERESTED
	STOPCD	ILS		;HALT
.ENDC ;.IF NE,DEBUG
ERRINT:	MOV	(SP)+,ILSERR	;SAVE TRAP INFO
	MOV	(SP)+,ILSERR+2	;IN CASE ANYBODY IS INTERESTED
	STOPCD	ILS		;HALT.
;
; HERE ON POWER FAIL.  NO ATTEMPT IS MADE TO RECOVER, SINCE
;  IT IS PRUDENT TO RUN CHK11 AFTER A POWER FAILURE.
;
PWFINT:
.IIF NDF,FT2020, HALT			;POWER FAILURE.
.IIF DF,FT2020, BR	.		;DON'T HALT FOR 2020s
;
;
; HERE ON TRAP INSTRUCTION.  THIS IS USED ONLY BY THE STOPCD
; MACRO.
;
TRPINT:	MOV	(SP)+,TRPERR	;SAVE TRAP INFO
	MOV	(SP)+,TRPERR+2	;IN CASE ANYBODY IN INTERESTED

	MOV	R0,STOPR0	;SAVE THE ACS
	MOV	R1,STOPR1	;FOR DEBUGGING
	MOV	R2,STOPR2
	MOV	R3,STOPR3
	MOV	R4,STOPR4
	MOV	R5,STOPR5
	MOV	SP,STOPSP	;SAVE STACK POINTER, TOO.

.IF NE,DEBUG
.IF EQ,FTKG11			;IF WE HAVE A KG11-A...
	MOV	@#KG.STS,STOPKG	;SAVE KG11-A REGISTERS
	MOV	@#KG.BCC,STOPKG+2
	MOV	@#KG.DTA,STOPKG+4
.ENDC ;.IF EQ,FTKG11
	CLR	R5		;LINE NUMBER*2
11$:	MOV	DQLCB(R5),R4	;GET LINE CONTROL BLOCK
	BEQ	12$		;NONE
	JSR	PC,TRAPDQ	;STORE THE DQ11'S REGISTERS IN THE LCB
12$:	ADD	#2,R5		;GO TO NEXT LINE
	CMP	#NLINES*2,R5	;DONE ENOUGH?
	BNE	11$		;NO, DO ANOTHER.
.ENDC ;.IF NE,DEBUG
.IF NE,FT.KMC
	JSR	PC,TRAPMD	;STOP THE KMC11S [1A(731)]
.ENDC ;.IF NE,FT.KMC
	MOV	TRPERR,R0	;GET OLD PC
	SUB	#2,R0		;POINT TO TRAP INSTR
	MOVB	(R0),TRPCOD	;GET TRAP CODE
	BNE	13$		;BRANCH IF VALID CODE
.IIF NDF,FT2020, HALT			;NOT--SOMETHING VERY WRONG!
.IIF DF,FT2020, BR	.	;DON'T HALT ON A 2020
;
13$:	MOV	TRPCOD,R1	;FETCH STOP CODE
	JSR	PC,DLSTCS	;STORE STOP CODE SO PDP-10 CAN SEE IT.
14$:	MOV	TRPCOD,R0	;SHOW STOP CODE IN LIGHTS (11/40)
.IF NDF,FT2020 ;IF NOT ON A 2020
	HALT			;ALL DONE.
	BR	14$		;DON'T ALLOW "CONTINUE".
.ENDC ;END IF NDF,FT2020
.IIF DF,FT2020, BR	.	;DON'T HALT ON A 2020
;
;
; CLOCK INTERRUPTS.  THESE COME ONCE A JIFFIE FROM THE
;  KW11-L.
;
CLKINT:	INC	JIFCLK		;INCREMENT JIFFIE CLOCK
	BIT	#77,JIFCLK	;HAVE A MULT. OF 64 JIFFIES PAST?
	BNE	12$		;NO.
	MOV	DSPMTY,DSPMTT	;YES, RECORD NULL TIME
	BNE	11$		;BETTER BE NON-ZERO
	STOPCD	LOP		;NO NULL TIME ACCUMULATED
;
; HERE IF THE NULL TIME IN THE LAST 64. TICKS IS NON-ZERO.
;
11$:	CLR	DSPMTY		;CLEAR COUNTER FOR NEXT PERIOD
	CMP	DSPMTX,DSPMTT	;LARGER MAX THAN BEFORE?
	BGE	12$		;NO.
	MOV	DSPMTT,DSPMTX	;YES, RECORD NEW MAX
12$:	RTI			; AND EXIT THE INTERRUPT.
;
.SBTTL		TRACE TRAP INTERRUPTS
;
; HERE ON TRACE INTERRUPTS, CAUSED BY BIT 4 IN THE PS.
;  RECORD THE CURRENT PC AND PS FOR DEBUGGING.
;
.IF NE,FTRACE
.IFT
BPTINT:	MOV	R0,-(SP)	;SAVE R0
	TST	TRCBTS		;ARE WE DOING EVENT TRACING?
	BNE	12$		;YES, DONT DO INSTRUCTION TRACING
	MOV	TRCPTR,R0	;NO, GET CURRENT POINTER
	CMP	#TRCTBE,R0	;REACHED END OF TABLE?
	BNE	11$		;NO.
	MOV	#TRCTBS,R0	;YES, SET TO BEGINNING
11$:	MOV	2(SP),(R0)+	;STORE PC IN TABLE
	MOV	4(SP),(R0)+	;STORE PS IN TABLE
	MOV	R0,TRCPTR	;STORE UPDATED POINTER
;
; THIS IS A GOOD PLACE TO PUT AD-HOCK DEBUGGING CODE, FOR EXAMPLE,
;  TO CHECK FOR A LOCATION BEING WIPED OUT.
;
12$:
.IF NE,DEBUG
	BR	14$		;NO SPECIAL CHECKS RIGHT NOW
;
; HERE ON FAILURE.
;
13$:	MOV	(SP)+,R0	;RESTORE R0
	STOPCD	DBG		;DEBUG STOP !!
;
; HERE ON NO FAILURE
;
14$:
.ENDC ;.IF NE,DEBUG
	MOV	(SP)+,R0	;RESTORE R0
	RTT			;DISMISS TRACE TRAP
.IFF
BPTINT:	STOPCD	ILS		;ILL INSTR IF NOT TRACING
.ENDC ;.IF NE,FTRACE
;
;
; SUBROUTINE TO RECORD AN EVENT IN THE TRACE TABLE.  CALLED
;  BY THE "TRACE" MACRO.
;
.IF NE,FTRACE
TRCSBR:	MFPS	-(SP)		;SAVE INTERRUPT LEVEL
	MTPS	#BR7		;DISABLE INTERRUPTS
	MOV	R0,-(SP)	;SAVE R0
	MOV	TRCPTR,R0	;GET TRACE TABLE POINTER
	CMP	#TRCTBE,R0	;END OF TABLE?
	BNE	12$		;NO.
	BIT	#TRCTBO,TRCHLT	;YES, STOP ON BUFFER OVERFLOW?
	BEQ	11$		;NO, WRAP AROUND.
	MOV	(SP)+,R0	;YES, RESTORE R0
	STOPCD	DBG		;TRACE BUFFER OVERFLOW
;
; HERE IF THE TRACE BUFFER IS TO WRAP AROUND.
;
11$:	MOV	#TRCTBS,R0	;START OVER AT FRONT OF BUFFER
12$:	MOV	4(SP),(R0)+	;STORE PC IN TABLE
	MOV	6(SP),(R0)+	;STORE ARGUMENT IN TABLE
	MOV	R0,TRCPTR	;STORE UPDATED TRACE POINTER
	MOV	(SP)+,R0	;RESTORE R0
	MTPS	(SP)+		;RESTORE INTERRUPT LEVEL
	MOV	(SP)+,(SP)	;REMOVE ARGUMENT FROM STACK
	RTS	PC		;RETURN.
.ENDC ;.IF NE,FTRACE
;
.SBTTL		CHUNK OWNER RECORDING
.IF NE,CHOWNR
;
; SUBROUTINE TO RECORD THE OWNER OF A CHUNK FOR DEBUGGING
;  PURPOSES.
;
; R0 = CHUNK ADDRESS
; R1 = OWNER ID (BIT 0 = 0)
;
CHOWNG:	MOV	R0,-(SP)	;SAVE CHUNK ADDRESS
	JSR	PC,CHOWNX	;COMPUTE INDEX INTO OWNER TABLE
	CMP	R0,#<CHOWNL*2>	;ROOM TO FIT IN TABLE?
	BHIS	11$		;NO, IGNORE IT.
	MOV	R1,CHOWNT(R0)	;YES, STORE IN TABLE
11$:	MOV	(SP)+,R0	;RESTORE CHUNK ADDRESS
	RTS	PC		;RETURN.
;
; SUBROUTINE TO MARK A CHUNK FREE IN THE OWNER TABLE.
;  THE ID OF THE OWNER IS NOT OBLITERATED.
;
; R0 = CHUNK ADDRESS
;
CHOWNF:	MOV	R0,-(SP)	;SAVE CHUNK ADDRESS
	JSR	PC,CHOWNX	;COMPUTE INDEX INTO CHUNK OWNER TABLE
	CMP	R0,#<CHOWNL*2>	;WILL THE TABLE HOLD THIS INDEX?
	BHIS	11$		;NO, IGNORE IT.
	BIS	#1,CHOWNT(R0)	;YES, FLAG CHUNK NOW FREE.
11$:	MOV	(SP)+,R0	;RESTORE CHUNK ADDRESS
	RTS	PC		;RETURN.
;
;
; SUBROUTINE TO COMPUTE THE INDEX INTO THE OWNER TABLE.
;
; R0 = CHUNK ADDRESS
;
; ON RETURN: 
;
; R0 = INDEX INTO THE OWNER TABLE
;
; IF THE CHUNK ADDRESS IS INVALID, THIS SUBROUTINE NEVER RETURNS.
;
CHOWNX:	MOV	R1,-(SP)	;SAVE R1
	MOV	R2,-(SP)	; AND R2
	SUB	#FIRZER,R0	;CONVERT CHUNK ADDRESS TO RELATIVE
	CLR	R1		;COMPARISON ADDRESS
	CLR	R2		;INDEX
11$:	CMP	R0,R1		;HAVE WE REACHED THE CHUNK?
	BEQ	12$		;YES, R2 HAS THE INDEX.
	ADD	#CHSIZE,R1	;NO, INCREASE COMPARISION ADDRESS
	ADD	#2,R2		; AND KEEP INDEX IN PARALLEL
	BR	11$		;SEE IF WE HAVE REACHED IT.
;
; HERE IF WE HAVE REACHED THE CHUNK ADDRESS
;
12$:	MOV	R2,R0		;PUT INDEX INTO R0
	MOV	(SP)+,R2	;RESTORE R2
	MOV	(SP)+,R1	; AND R1
	RTS	PC		;RETURN TO CALLER.
;
.ENDC ;.IF NE,CHOWNR
;
.SBTTL		KG11-A SIMULATION SUBROUTINE
;
; SUBROUTINE TO ACCUMULATE A CHARACTER INTO THE BCC.
;
; CALL:
;	MOV	ARG,-(SP)	;PUT ARG ON STACK
;	JSR	PC,KGSIMA	;ACCUMULATE BCC
;
; ALL REGISTERS ARE PRESERVED.
;
.IF NE,FTKG11
KGSIMA:	MOV	R0,-(SP)	;SAVE R0
	MOV	4(SP),R0	;GET ARGUMENT CHARACTER
	MOV	R1,-(SP)	;SAVE R1
	MOV	R2,-(SP)	;SAVE R2
	MOV	KGSIMW,R1	;R1 = ACCUMULATED CRC
	XOR	R1,R0		;EXCLUSIVE OR BYTE WITH OLD CRC
	MOV	R0,R2		;SAVE A COPY OF RESULT
	BIC	#177760,R0	;EXTRACT LOW 4 BITS
	ASL	R0		;BYTE ADDRESS , WORD INDEX
	MOV	KGTBL(R0),R0	;GET FIRST MODIFIER WORD
	BIC	#177417,R2	;NOW EXTRACT HIGH FOUR BITS
	ASR	R2		;SET UP TO ENTER SECOND HALF
	ASR	R2		;AGAIN BYTE ADDRESS TO
	ASR	R2		;WORD INDEX
	MOV	KGTBL+32.(R2),R2 ;GET SECOND MODIFIER WORD
	XOR	R2,R0		;EXCLUSIVE OR MODIFIER VALUES
	CLRB	R1		;CLEAR LOW BYTE OF OLD CRC
	SWAB	R1		;NOW WORK ON UPPER BYTE
	XOR	R0,R1		;PRODUCE UPDATED CRC
	MOV	R1,KGSIMW	;SAVE NEW VALUE OF CRC REGISTER
	MOV	(SP)+,R2	;RESTORE R2
	MOV	(SP)+,R1	;RESTORE R1
	MOV	(SP)+,R0	;RESTORE R0
	MOV	(SP)+,(SP)	;REMOVE ARGUMENT FROM STACK
	RTS	PC		;RETURN.
;
;
; THIS TABLE IS USED BY THE KG11-A SIMULATOR TO FORM
;  A BCC.  THE FIRST HALF OF THE TABLE IS INDEXED BY THE
;  LOW FOUR BITS, THE SECOND HALF BY THE HIGH FOUR BITS.
;
KGTBL:	.WORD	0		;FIRST HALF OF TABLE
	.WORD	140301
	.WORD	140601
	.WORD	500
	.WORD	141401
	.WORD	1700
	.WORD	1200
	.WORD	141101
	.WORD	143001
	.WORD	3300
	.WORD	3600
	.WORD	143501
	.WORD	2400
	.WORD	142701
	.WORD	142201
	.WORD	2100

	.WORD	0		;SECOND HALF OF TABLE
	.WORD	146001
	.WORD	154001
	.WORD	12000
	.WORD	170001
	.WORD	36000
	.WORD	24000
	.WORD	162001
	.WORD	120001
	.WORD	66000
	.WORD	74000
	.WORD	132001
	.WORD 	50000
	.WORD	116001
	.WORD	104001
	.WORD	42000
;
.ENDC ;.IF NE,FTKG11
;
; TTY ROUTINES FOR CHK11

	.CKTTS