Google
 

Trailing-Edge - PDP-10 Archives - BB-4170G-SM - sources/cdksdv.mac
There are 20 other files named cdksdv.mac in the archive. Click here to see a list.
;<3A.MONITOR>CDKSDV.MAC.57, 31-Aug-78 23:16:42, Edit by MCLEAN
;FIX MAP MASK FOR 21 PHYSICAL BITS AND FIX IMAGE MODE TO UPDATE ALL WORDS
;<3A.MONITOR>CDKSDV.MAC.56, 12-May-78 00:20:21, Edit by MCLEAN
;ANOTHER CHECK FOR NON-EX CARD READER
;<3A.MONITOR>CDKSDV.MAC.55, 22-Apr-78 18:02:47, Edit by MCLEAN
;<3A.MONITOR>CDKSDV.MAC.54, 22-Apr-78 17:55:47, Edit by MCLEAN
;<3A.MONITOR>CDKSDV.MAC.53, 22-Apr-78 17:14:08, Edit by MCLEAN
;<3A.MONITOR>CDKSDV.MAC.52, 21-Apr-78 13:38:28, Edit by MCLEAN
;<3A.MONITOR>CDKSDV.MAC.51, 21-Apr-78 12:55:30, Edit by MCLEAN
;<3A.MONITOR>CDKSDV.MAC.50, 17-Apr-78 17:18:23, Edit by MCLEAN
;<3A.MONITOR>CDKSDV.MAC.49, 17-Apr-78 16:09:59, Edit by MCLEAN
;<3A.MONITOR>CDKSDV.MAC.48, 17-Apr-78 16:01:37, Edit by MCLEAN
;<3A.MONITOR>CDKSDV.MAC.47, 17-Apr-78 15:59:23, Edit by MCLEAN
;<3A.MONITOR>CDKSDV.MAC.46, 17-Apr-78 15:47:32, Edit by MCLEAN
;<3A.MONITOR>CDKSDV.MAC.45, 17-Apr-78 15:23:42, Edit by MCLEAN
;<3A.MONITOR>CDKSDV.MAC.44, 17-Apr-78 00:24:33, Edit by MCLEAN
;<3A.MONITOR>CDKSDV.MAC.43, 15-Apr-78 18:14:39, Edit by MCLEAN
;<3A.MONITOR>CDKSDV.MAC.42, 15-Apr-78 17:39:02, Edit by MCLEAN
;<3A.MONITOR>CDKSDV.MAC.41, 15-Apr-78 17:38:29, Edit by MCLEAN
;<3A.MONITOR>CDKSDV.MAC.40, 15-Apr-78 16:35:17, Edit by MCLEAN
;<3A.MONITOR>CDKSDV.MAC.39, 15-Apr-78 15:49:31, Edit by MCLEAN
;<3A.MONITOR>CDKSDV.MAC.38, 15-Apr-78 14:55:05, Edit by MCLEAN
;<3A.MONITOR>CDKSDV.MAC.37, 15-Apr-78 14:52:45, Edit by MCLEAN
;<3A.MONITOR>CDKSDV.MAC.36, 15-Apr-78 14:51:16, Edit by MCLEAN
;<3A.MONITOR>CDKSDV.MAC.35, 13-Apr-78 01:17:48, Edit by MCLEAN
;<3A.MONITOR>CDKSDV.MAC.34, 13-Apr-78 01:13:33, Edit by MCLEAN
;<3A.MONITOR>CDKSDV.MAC.33, 12-Apr-78 19:02:33, Edit by MCLEAN
;<3A.MONITOR>CDKSDV.MAC.32, 11-Apr-78 00:56:58, Edit by MCLEAN
;<3A.MONITOR>CDKSDV.MAC.31, 11-Apr-78 00:53:40, Edit by MCLEAN
;<3A.MONITOR>CDKSDV.MAC.30, 10-Apr-78 22:30:26, Edit by MCLEAN
;<3A.MONITOR>CDKSDV.MAC.29, 10-Apr-78 18:16:43, Edit by MCLEAN
;<3A.MONITOR>CDKSDV.MAC.28, 10-Apr-78 18:11:28, Edit by MCLEAN
;<3A.MONITOR>CDKSDV.MAC.27, 10-Apr-78 18:09:02, Edit by MCLEAN
;<3A.MONITOR>CDKSDV.MAC.26, 10-Apr-78 18:05:39, Edit by MCLEAN
;<3A.MONITOR>CDKSDV.MAC.25,  9-Apr-78 15:31:55, Edit by MCLEAN
;<3A.MONITOR>CDKSDV.MAC.24,  9-Apr-78 15:04:29, Edit by MCLEAN
;<3A.MONITOR>CDKSDV.MAC.23,  9-Apr-78 14:33:10, Edit by MCLEAN
;<3A.MONITOR>CDKSDV.MAC.22,  9-Apr-78 14:31:37, Edit by MCLEAN
;<3A.MONITOR>CDKSDV.MAC.21,  9-Apr-78 14:27:15, Edit by MCLEAN
;<3A.MONITOR>CDKSDV.MAC.20,  9-Apr-78 14:24:30, Edit by MCLEAN
;<3A.MONITOR>CDKSDV.MAC.19,  9-Apr-78 14:21:17, Edit by MCLEAN
;<3A.MONITOR>CDKSDV.MAC.18,  9-Apr-78 13:04:40, Edit by MCLEAN
;<3A.MONITOR>CDKSDV.MAC.17,  9-Apr-78 01:14:31, Edit by MCLEAN
;<3A.MONITOR>CDKSDV.MAC.16,  9-Apr-78 00:48:50, Edit by MCLEAN
;<3A.MONITOR>CDKSDV.MAC.15,  7-Apr-78 00:58:35, Edit by MCLEAN
;<3A.MONITOR>CDKSDV.MAC.14,  7-Apr-78 00:52:40, Edit by MCLEAN
;<3A.MONITOR>CDKSDV.MAC.13, 19-Mar-78 21:48:00, Edit by MCLEAN
;<3A.MONITOR>CDKSDV.MAC.12, 19-Mar-78 21:45:05, Edit by MCLEAN
;<3A.MONITOR>CDKSDV.MAC.11, 19-Mar-78 21:40:06, Edit by MCLEAN
;<3A.MONITOR>CDKSDV.MAC.10, 19-Mar-78 21:39:05, Edit by MCLEAN
;<3A.MONITOR>CDKSDV.MAC.9, 19-Mar-78 21:24:32, Edit by MCLEAN
;<3A.MONITOR>CDKSDV.MAC.8, 16-Mar-78 23:48:45, Edit by MCLEAN
;<3A.MONITOR>CDKSDV.MAC.7, 11-Feb-78 19:16:33, Edit by MCLEAN
;<3A.MONITOR>CDKSDV.MAC.6, 11-Feb-78 19:13:49, Edit by MCLEAN
;<3A.MONITOR>CDKSDV.MAC.5,  5-Feb-78 17:37:11, Edit by MCLEAN
;<3A.MONITOR>CDKLDV.MAC.6,  5-Feb-78 16:00:11, Edit by MCLEAN
;<3A.MONITOR>CDKLDV.MAC.5,  5-Feb-78 15:30:31, Edit by MCLEAN
;CARDREADER SERVICE FOR KS10
	RESCD
	SEARCH PROKS,PROKL,SERCOD


CDVTKS==.
	IFIW!KSRD		;READ A CARD
	IFIW!KSCLZ		;CLOSE
	IFIW!KSRST		;RESTART
	IFIW!KSINI		;INIT
	IFIW!CDKSST		;STATUS
	IFIW!KSSWP		;PUT BUFFER IN CORRECT FORMAT FOR KL

;KS10 RESIDENT STORAGE

ASCBSZ:	POINT 18,0		;ASCII POINTER FOR UNSWAPPED BUFFER


RS (CDIACS,20)			;INTERRUPT ACS
CDSTSZ=40			;SIZE OF CARDREADER STACK
RS (CDRSTK,CDSTSZ)		;CARD READER STACK

RS (CDRINB,4)

;CDRTBL ENTRY OF EXTERNAL PAGE ADDRESSES

CDRTBL::CD11BA			;BASE ADDRESS OF CD11
KSINI:	SKIPN PROFLG		;IF PROFLG NOT SET DO NOTHING
	RET
	SETZ U,0		;DO ONLY UNIT 0 (ONLY ONE SUPPORTED)
	MOVE T1,CDRTBL(U)	;GET BASE ADDRESS OF THIS UNIT
	CALL UBGOOD		;CHECK FOR DEVICE
	RET			;NO DEVICE
	SETONE CDEXST,(Q2)	;INFORM WORLD WE EXIST
	MOVEM Q2,CDUNIT		;SAVE UNIT NUMBER
	MOVEI T1,KSTYP		;SET TYPE
	STOR T1,CDRTYP,(Q2)
	MOVE T1,[XPCW CDRINB]	;POINT TO INTERRUPT ROUTINE
	HLR T2,CDRTBL(U)	;GET UBA NUMBER
	MOVE T2,SMTEPT(T2)	;GET VECTOR TABLE
	MOVEM T1,CDRIVT(T2)	;STORE VECTOR
	MOVEI T1,CDRINT		;SET UP INTERRUPT VECTOR IN INTERRUPT BLOCK
	MOVEM T1,CDRINB+3
	SETZM CDRINB+2		;INSURE NEW FLAGS 0
	HLR T1,CDRTBL(U)	;GET UBA NUMBER
	MOVEI T2,1		;ONE WINDOW NEEDE
	CALL ALUBWA		;GET UNIBUS WINDOW
	BUG(HLT,NCDWA,<KSINI: NO CARDREADER UBA WINDOW>)
	MOVEM T1,CDUBAD(U)	;SAVE UBA ADDRESS
	MOVEM T2,CD11A(U)	;SAVE CONVERSION ADDRESS
KSRST:	MOVEI T2,CDPWR		;RESET THE DEVICE
	WRIO T2,@CDRTBL(U)
	MOVEI T2,CDIEN		;SET INTERRUPT ENABLE
	WRIO T2,@CDRTBL(U)
	RET			;RETURN
;INTERRUPT SERVICE ROUTINE FOR CARDREADER

CDRINT:	MOVEM 17,CDIACS+17	;SAVE A REGISTER
	MOVEI 17,CDIACS		;SAVE REST OF REGISTERS
	BLT 17,CDIACS+16
	MOVE P,[IOWD CDSTSZ,CDRSTK] ;INIT STACK
	MOVE T4,CDUNIT		;GET UNIT ADDRESS
	SETZ U,0		;SET UP FOR UNIT 0 (ONLY SUPPORTED UNIT FOR NOW)
	JE CDOPN,(T4),[	CALL CDINOK	;EXIT IF NOTHING OPEN
			JRST CDRIXT]
	RDIO T1,@CDRTBL(U)	;READ THE STATUS REGISTER
	TRNE T1,CDERR1		;CHECK FOR ERROR
	JRST [	CALL CDINOK	;ERROR GO DO STATUS REPORT
		JRST CDRIXT]	;AND EXIT
	LOAD T1,CDCNT,(T4)	;GET THE COUNT
	ADDI T1,^D160		;UPDATE COUNT
	STOR T1,CDCNT,(T4)
	AOS CARDCT(T4)		;INDICATE ANOTHER CARD HERE
	AOS CDRCT1(T4)		;ONE MORE BUFFER FILLED
	SETZRO CDBLK,(T4)	;NOT WAITING FOR A CARD ANYMORE
	CALL SETBF1		;FIND INT BUFFER
	LOAD C,CDBFI,(T4)	;GET INTERRUPT LEVEL BUFFER BIT
	XORI C,1		;TOGGLE IT
	STOR C,CDBFI,(T4)
	JN CDAII,(T4),[	LDB T1,[POINT ^D16,0(T1),15]
			TRC A,7417 ;SEE IF THIS IS AN EOF
			TRCE T1,17 ;IS IT?
			TRCN T1,7400 ;OR THIS FLAVOR?
			JRST CDRIXT	     ;IS AN EOF
			JRST .+1]    ;NOT AN EOF
	MOVEI T1,CDHCK		;HOPPER EMPTY?
	SKIPLE CDRCT1(T4)	;ANOTHER PI BUFFER AVAILABLE?
	JRST CDRIXT		;NOPE
	TION T1,@CDRTBL(U)	;CHECK FOR HOPPER EMPTY
	CALL RDCARD		;READ NEXT CARD
CDRIXT:	MOVSI 17,CDIACS		;RESTORE AC'S
	BLT 17,16
	MOVE 17,CDIACS+17
	XJEN CDRINB
; ROUTINE TO READ A CARD

KSRD:	MOVE T4,CDUNIT		;GET UNIT
	MOVE T3,CDRTBL(T4)	;GET EXTERNAL PAGE ADDRESS
	LOAD T1,CDWRD,(U)	;ADDRESS OF BUFFER
	MAP T1,0(T1)		;GET PHYSICAL ADDRESS
	AND T1,[7,,-1]		;MASK OFF JUNK BITS
	LSH T1,-^D9		;MAKE PAGE ADDRESS
	TXO T1,UNBD18+UNBVBT	;SET VALID BITS
	WRIO T1,@CDUBAD(U)	;STORE IN WINDOW
	LOAD T1,CDWRD,(U)	;GET BUFFER
	LSH T1,2		;MAKE PDP11 ADDRESS
	ANDI T1,1777		;MASK JUNK
	ADD T1,CD11A(U)		;OFFSET
	WRIO T1,CDBA(T3)	;SET UP TRANSFER ADDRESS
	MOVNI T1,^D80		;COL COUNT
	WRIO T1,CDCC(T3)	;WRITE COUNT
	MOVEI T1,CDIEN+CDRED	;START
	WRIO T1,CDST(T3)
	RETSKP
;ROUTINE TO RETURN STATUS OF CARDREADER

CDKSST:	MOVE T4,CDUNIT		;GET UNIT
	JE CDEXST,(U),R		;CHECK FOR EXISTANCE
	MOVEI T1,CDIEN		;CHECK FOR INTERRUPT ENABLE
	TIOE T1,@CDRTBL(T4)	;
	JRST CDINOK		;YUP ALL OK
	BUG(CHK,CDBDIN,<CD11 LOST INTERRUPT ENABLE>,T4)
	BSIOB T1,@CDRTBL(T4)
CDINOK:	CALLRET CDRSTT		;GET STATUS
;ROUTINE TO SET UP THE STATUS BLOCKS FOR THE CARD READER
;
; THE STATUS BLOCK IS IN THE FOLLOWING FORMAT:

;PDP11 WORD NUMBERS
;
; WORD	0	STATUS WORD 0 (DV.XXX)
; WORD	1	STATUS WORD 1 (DD.XXX)
; WORD	2	(HIGH 8 BITS) # BYTES OF DEVICE DEPENDENT INFO
;		(LOW BYTE) # BYTES OF DEVICE REGISTERS 
;
;  	DEVICE REGISTERS
; WORD 	3	STATUS AND CONTROL REGISTER
; WORD	4	COLUMN COUNT REGISTER
; WORD	5	CURRENT ADDRESS REGISTER
; WORD	6	DATA BUFFER REGISTER

; THE FOLLOWING BITS ARE USED IN THE STATUS WORDS:

;	DV.OFL	OFF-LINE
;	DV.OIR	HARD ERROR (DD.RCK,DD.PCK,DD.SCK)
;	DV.EOF	E-O-F BUTTON PUSHED
;	DV.LOG	ERROR LOGGING REQUIRED
;	DV.HNG	DEVICE HUNG

;	DD.RCK	READ CHECK
;	DD.PCK	PICK CHECK
;	DD.SCK	STACK CHECK
;	DD.HEM	HOPPER EMPTY
;	DD.SFL	STACKER FULL

CDERSZ==7			;SIZE OF BUFFER
CDSIZ==20			;SIZE OF 8-BIT BYTES IN STATUS

CDRSTT:	HRRZ T1,T4		;GET UNIT NUMBER
	JE CDEXST,(T1),CDNEXD
	IMULI T1,CDERSZ		;GET CORRECT BLOCK
	SETONE CDSHA,(U)	;SAY STATUS ARRIVED
	ADD T1,[POINT 8,CDERBF]	;POINT TO BUFFER
	MOVE P6,T1		;SAVE POINTER TO BUFFER
	MOVE P5,T1
	SETZ Q3,0		;SECONDARY STATUS
	SETZB Q2,T2
	MOVE T3,CDRTBL(T4)	;GET EXTERNAL PAGE ADDRESS
	RDIO P3,CDDB(T3)	;READ SECONDARY STATUS
	TRNE P3,CDBRCK		;READ CHECK
	TXO Q2,.DDRCK
	TRNE P3,CDBPCK		;PICK CHECK?
	TXO Q2,.DDPCK
	TRNE P3,CDBSCK		;STACK CHECK?
	TXO Q2,.DDSCK
	RDIO T1,CDST(T3)	;GET STATUS WORD
	TRNE T1,CDOFL		;CHECK FOR OFFLINE
	TXO T2,.DVFOL		;YES
	SKIPN Q2		;HARD ERRORS?
	TRNE T1,CDRDK+CDDLT+CDNXM+CDHCK
	TXO T2,.DVFHE!.DVFLG!.DVFOL ;SET HARD ERROR
	TRNE T1,CREOF		;CHECK FOR EOF
	TXO T2,.DVFEF	;YES SET EOF
	IDPB Q3,P5		;SET  FIRST STATUS
	IDPB T2,P5
	IDPB Q3,P5		;NEXT TW0 WORDS 0
	IDPB Q2,P5
	MOVEI T1,0		;NUMBER OF REGISTERS TO SAVE
	IDPB T1,P5
	MOVEI T1,10	
	IDPB T1,P5
	IDPB Q2,P5		;STORE NULL
	IDPB Q2,P5
	HRLI P5,(<POINT 16,0>)	;SET UP FOR 16 BIT WORDS
	IDPB T1,P5		;STORE STATUS
	RDIO T1,CDBA(T3)	;GET BADRESS
	IDPB T1,P5
	RDIO T1,CDCC(T3)	;GET BYTE COUNT
	IDPB T1,P5
	RDIO T1,CDDB(T3)	;GET PACKING REGISTER
	IDPB T1,P5
	TXNN T2,.DVFHE		;CHECK FOR HARD ERROR
	JRST CDNEXD		;NONE LEFT
	MOVEI T1,CDSIZ+FE%LEN	;GET LENGTH OF BUFFER NEEDED
	MOVEI T2,CDSIZ+FE%SIZ
	CALL ALCSEB		;ALLOCATE BUFFER
	JRST CDNEXD		;NO BUFFER QUIT
	SETZM FE%DTE+SEBDAT(T1)	;SET NO DET
	MOVEI T2,.FECDR		;GET DEVICE CODE
	HRLI T2,0(U)		;SET THE UNIT NUMBER
	MOVEM T2,FE%DEV+SEBDAT(T1)
	MOVNI T4,CDSIZ		;GET THE SIZE
	HRLM T4,FE%PTR+SEBDAT(T1) ;SAVE COUNT OF WORDS
	MOVEI T3,CDSIZ		;GET THE SIZE AGAIN
	MOVE T4,P6		;POINTER TO BUFFER
	MOVE T2,[POINT 8,FE%INF+SEBDAT(T1)] ;PONTER TO DEVICE DATA
	MOVEM T3,FE%BYT+SEBDAT(T1)
SYECD:	ILDB P5,T4		;GET BUFFER CHARACTERS
	IDPB P5,T2		;STORE CHARACTERS
	SOJG T3,SYECD
	MOVE T2,[-2,,[
			SEBPTR 0,SBTEVC,SEC%FE
			SEBPTR 0,SBTFNA,CDRSER]]
	MOVE Q2,T1		;SAVE POINTER TO ERROR BUFFER
	CALL SEBCPY
	JFCL			;NOP IF ERROR
	MOVE T1,Q2		;RESTORE BUFFER POINTER
	CALL QUESEB		;QUEUE ERROR
	CALL KSCLZ		;RESET
CDNEXD:	MOVE T2,CDUNIT		;
	MOVE T4,P6		;POINTER TO BUFFER
	CALLRET CDRTLS		;SAY STATUS RECEIVED

; CLOSE ROUTINE (FLUSH)

KSCLZ:	MOVE T4,CDUNIT
	MOVEI T1,CDPWR		;DO POWER CLEAR
	WRIO T1,@CDRTBL(T4)
	MOVEI T1,CDIEN		;INTERRUPT EANBLE
	WRIO T1,@CDRTBL(T4)
	RET			;QUIT

;ROUTINE CALLED TO DETERMINE OWNING PROCESS

CDRSER:	SETZ T2,		;GET UNIT
	JE CDOPN,(T2),[		;IS IT OPENED?
		MOVNI T3,-1	;NO. SAY UNASSIGNED
		JRST CDFKS]
	LOAD T2,CDFRK,(T2)	;GET FORK ID
	HLRZ T3,FKJOB(T2)	;FIND FORK
	HRLI T3,0(T2)		;UNIT
	MOVE T2,JOBDIR(T3)	;DIRECTORY
	HRLI T2,USRLH		;SET UP USER NUMBER
	MOVEM T2,FE%DIR+SEBDAT(T1) ;STORE DIRECTORY NUUMBER
	MOVE T2,JOBPNM(T3)	;GET NAME
	MOVEM T2,FE%NAM+SEBDAT(T1)
CDFKS:	MOVEM T3,FE%FJB+SEBDAT(T1)
	MOVEI T2,FE%INF		;START OF ERROR WORDS
	HRRM T2,FE%PTR+SEBDAT(T1)
	SETZM FE%ID+SEBDAT(T1)
	RET			;RETURN

KSSWP:	SAVET			;SAVE TEMPS
	MOVEI T4,^D40		;80 CHARS
	HRRZ T3,FILBYT(JFN)	;GET BUFFER POINTER
KSSWLP:	MOVE T1,0(T3)		;GET A WORD
	LSHC T1,-^D16		;SECOND CHARACTER
	LSH T1,-2		;JUNK BITS
	LSHC T1,-^D16		;FIRST CHARACTER
	MOVEM T2,0(T3)		;STORE CHARACTERS
	AOS T3
	SOJG T4,KSSWLP		;LOOP
	RET
	TNXEND
	END