Google
 

Trailing-Edge - PDP-10 Archives - BB-H348C-RM_1982 - swskit-v21/debugging-tools/kmcdmp.mac
There are no other files named kmcdmp.mac in the archive.
	.TITLE	KMCDMP - Dump an unsuspecting KMC
	.IDENT	/X01.02/
	.ENABL	LC

;
; COPYRIGHT (C) 1978
; DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASSACHUSETTS 01754
;
; THIS SOFTWARE IS  FURNISHED UNDER A LICENSE FOR USE ONLY ON A SINGLE
; COMPUTER  SYSTEM AND  MAY BE  COPIED ONLY  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
; EXCEPT FOR USE ON SUCH SYSTEM AND TO ONE WHO AGREES TO THESE LICENSE
; TERMS. TITLE  TO AND  OWNERSHIP OF THE  SOFTWARE  SHALL AT ALL TIMES
; REMAIN IN DEC.
;
; THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT NOTICE
; AND  SHOULD NOT BE  CONSTRUED AS A COMMITMENT BY  DIGITAL  EQUIPMENT
; CORPORATION.
;
; DEC ASSUMES  NO  RESPONSIBILITY  FOR THE USE OR  RELIABILITY OF ITS
; SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPLIED BY DEC.
;

;++
; FACILITY:
;	KMC micro-code debugging
;
; ABSTRACT:
;
;	This program dumps the contents of the KMC into a buffer
;	and then BPT's so that one can look at what the KMC was doing.
;	This version also includes the DUP CSRs.
;
; 
; ENVIRONMENT:
;	RSX11-S,-M, DN20 MCB
;
; AUTHOR: Bob Rosenbaum (copied by Scott Robinson), CREATION DATE: 01-APR-76
;
; MODIFIED BY:
;
; 	Scott G. Robinson, 12-JUN-79: VERSION X01
; 01	-Fix misc bugs in execution of micro-instructions
; 02	-Add code to save DUP CSRs
;--
	.SBTTL	DECLARATIONS
;
; INCLUDE FILES:
;

;
; MACROS:
;
 .MACRO	DO	INST
	MOV	INST,R1
	CALL	XCMC
	.ENDM
 .MACRO DOS	INST
	DO	INST
	MOVB	2(R0),(R5)+
	.ENDM
;
; EQUATED SYMBOLS:
;
DUPCSR=160300			;CSR for first DUP on this KMC
NUMDUP=4			;Number of DUPs on this KMC
KMCCSR=160540			;CSR for KMC
CD.RMI=1000			;Ram Input
CD.STP=400			;Step up
PS=-2				;Address of processor status
PR7=340				;Priority 7
;
; OWN STORAGE:
;
GTNPR0:	OUT	IBUS,INDAT1,OOCON
	OUT	IBUS,INDAT2,OOCON
	OUT	IBUS,IODAT1,OOCON
	OUT	IBUS,IODAT2,OOCON
	OUT	IBUS,IIBA1,OOCON
	OUT	IBUS,IIBA2,OOCON
	OUT	IBUS,IOBA1,OOCON
	OUT	IBUS,IOBA2,OOCON
	OUT	IBUS,NPR,OOCON
	OUT	IBUS,UBBR,OOCON
GTBRG:	OUT	BR,SELB,OOCON
GTSP0:	BRWRTE	SELA,SP0
	BRWRTE	SELA,SP1
	BRWRTE	SELA,SP2
	BRWRTE	SELA,SP3
	BRWRTE	SELA,SP4
	BRWRTE	SELA,SP5
	BRWRTE	SELA,SP6
	BRWRTE	SELA,SP7
	BRWRTE	SELA,SP10
	BRWRTE	SELA,SP11
	BRWRTE	SELA,SP12
	BRWRTE	SELA,SP13
	BRWRTE	SELA,SP14
	BRWRTE	SELA,SP15
	BRWRTE	SELA,SP16
	BRWRTE	SELA,SP17
INIMAR:	LDMA	IMM,0
INIMA1:	LDMAP	IMM,0
GTMEM:	OUT	MEMI,SELB,OOCON
;
; Buffer for Dump
;
CSRS:	.BLKW	NUMDUP*4
BUFFER:	.BLKW	550.
	.SBTTL	DUMP - Dump the KMC
;++
; FUNCTIONAL DESCRIPTION:
;
;	Dump the contents of the KMC including various interesting
;	registers and the memory to a buffer so we can look at it.
;
; CALLING SEQUENCE:
;
;	NONE
;
; INPUT PARAMETERS:
;
;	NONE
;
; IMPLICIT INPUTS:
;
;	NONE
;
; OUTPUT PARAMETERS:
;
;	NONE
;
; IMPLICIT OUTPUTS:
;
;	NONE
;
; COMPLETION CODES:
;
;	NONE
;
; SIDE EFFECTS:
;
;	BPTs when done
;
;--
DUMP:	MOV	PS,-(SP)		;Save old PS
	MOVB	#PR7,PS			;Shutdown interrupts
	MOV	#BUFFER,R5		;Buffer address is in R5
	MOV	#KMCCSR,R0		;R0 will point at CSR
	MOV	R0,-(SP)		;Save address
	MOV	(R0),(R5)+		;Store initial contents of CSR
	CLR	(R0)+			;Stop the KMC
	NOP				;Wait for a few
	NOP
	NOP
	MOV	(R0)+,(R5)+		;Save remainder of KMC registers
	MOV	(R0)+,(R5)+
	MOV	(R0)+,(R5)+

	MOV	#DUPCSR,R0		;First DUPs CSR
	MOV	#CSRS,R1		;First of CSR buffer
	MOV	#NUMDUP,R2		;Number of DUPs to dump
5$:	MOV	(R0)+,(R1)+		;CSR xx0
	MOV	(R0)+,(R1)+		;CSR xx2
	MOV	(R0)+,(R1)+		;CSR xx4
	MOV	(R0)+,(R1)+		;CSR xx6
	SOB	R2,5$			;Do all DUPs

	MOV	(SP)+,R0		;Restore CSR address

	MOV	#GTNPR0,R2		;Issue instructions from here
	MOV	#<GTBRG-GTNPR0+2>,R3	;This many instructions * 2
	ASR	R3			;Make number of instructions
10$:	DOS	(R2)+			;Do an instruction and store results
	SOB	R3,10$			;Loop on
	CLRB	(R5)+			;Put in zero byte

	MOV	#16.,R3			;Dump contents of SP0-SP17
	MOV	#GTSP0,R2
20$:	DO	(R2)+
	DOS	GTBRG
	SOB	R3,20$

	DO	INIMAR			;Dump memory
	DO	INIMA1
	MOV	#1024.,R3		;Number of bytes in memory
30$:	DOS	GTMEM
	SOB	R3,30$

	MOV	(SP)+,PS		;Restore processor status
	BPT				;Break point
;
;
; XCMC - Execute the KMC instruction
;
;
XCMC:	MOV	R1,6(R0)
	MOV	#CD.RMI,(R0)
	NOP
	NOP
	NOP
	BIS	#CD.STP,(R0)
	NOP
	NOP
	NOP
	CLR	(R0)
	RETURN


	.END	DUMP