	.SYSID <	.TITLE CDB >,< 134>

/

/COPYRIGHT (C) 1975

/DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS.

/

/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 PRO-

/VIDED 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 DOCUMENT IS SUBJECT TO CHANGE

/WITHOUT NOTICE AND SHOULD NOT BE CONSTRUED AS A COM-

/MITMENT BY DIGITAL EQUIPMENT CORPORATION.

/

/DEC ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY

/OF ITS SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPLIED BY DEC.

	.EJECT

/MAYNARD,MASS.

/CDB -- IOPS ASCII ONLY CARD READER HANDLER.

/TALKS TO CR01E, CR02B,CR03B, AND CR15 CARD READERS

/ALSO TO CR11 ON PDP11/05 VIA UNICHANNEL

/

/

/THIS HANDLER HAS BEEN REVISED SO

/THAT IT WILL OPERATE WITH THE DOS-15 AND BOSS-15

/(BATCH) OPERATING SYSTEM 

/

/IT ALSO USES THE EXPANDED ERROR MESSAGE

/FACILITY IN THE DOS-15 MONITOR

/

/

/ASSEMBLELY PARRAMETERS--- FOR THE CRO3B READER

/NO ASSIGNMENTS ARE NEEDED (029 CARD CODE)

/

/FOR THE CRO1E,AND CRO2B READERS DEFINE

/NOTGDI=0

/

/FOR THE CR15--DEFINE CR15=0

/

/FOR THE CR11 - DEFINE UC15=0

/IN THIS CASE, WE MUST HAVE A PDP-15;  OTHER

/ASSEMBLY PARAMETERS ARE ALLOWED DEC026,

/AND NOSPL TO DISABLE PDP-11 SPOOLING FOR CARD READER

/

/

/FOR 026 CARD CODE DEFINE DEC026=0

/

/

/

/

/E. MARISON, C. STAPLES

/EDIT #024 - 6/7/73  S. ROOT

/EDIT #025	JULY 2, 73 S.KRISHNAMURTHY

/	SPR BUG FIX FOR CR15

/EDIT #026	13-OCT-73	S.ROOT	MAKE UC15 CD !NOT!SPOOLED

/ EDIT #028 ATTEMPT FIX FOR HANDLER LOADING TOO HIGH

/   CORE BY USING BUFFER AND TCB ASSEMBLED INTO DOS

/ EDIT #029 S. ROOT COUNT COLUMNS XCPT CR15,UC15

/ EDIT #030 S. ROOT MODIFY CR15 ERROR HANDLING

/ EDIT #031 S. ROOT AND CR03B ERROR HANDLING

/EDIT #031 S. ROOT, MORE ERROR MODIFICATION

/EDIT #031 G. REID 4-15-75  ADD CODE TO GIVE IOPS24 ERROR WHENEVER

/				A UNIT OTHER THAN ZERO IS SPECIFIED.

/ 033	21-MAY-75 (RCHM)	MODIFY BINARY SEARCH TO HANDLE ALL TABLE TYPES.

/ 133	09-JUN-75 (RCHM)	MAKE XVM CHANGES.

/ 134	9-SEPT-75 (SCR)		CHECK FOR UC15 OFF

/

/

/

/IOPS4:

/	HOPPER EMPTY

/	STACKER FULL

/	NOT READY:	STOP BUTTON DEPRESSED

/			START BUTTON NOT DEPRESSED

/			VALIDITY CHECK WITH VALID. BUTTON ON

/	FEED CHECK

/	READ CHECK

/

/END-OF-MEDIUM:

/	EOF CARD (ALL 1'S IN COLUMN 1)

/	EOF BUTTON DEPRESSED WITH HOPPER EMPTY

	.EJECT

/----CR15 STATUS AND AC BIT ASSIGNMENTS

/

/STATUS REGISTER BIT ASSIGNMENTS:

/

/	BIT	TRANSLATION

/

/	17	COLUMN READY

/	16	END OF CARD

/	15	DATA CHANNEL OVERFLOW

/	14	DATA CHANNEL ENABLED

/	13	READY TO READ

/	12	ON LINE

/	11	END OF FILE

/	10	BUSY

/	09	TROUBLE (= IOR BITS 4-8)

/	08	DATA MISSED

/	07	HOPPER EMPTY/STACKER FULL

/	06	PICKER ERROR

/	05	MOTION ERROR

/	04	PHOTO ERROR

/	03-00	UNUSED

/

/AC BIT ASSIGNMENT FOR CONDITION LOAD FUNCTION (CRLC):

/

/	BIT	FUNCTION

/

/	17	START READ

/	16	DATA CHANNEL ENABLE

/	15	INTERRUPT ENABLE

/	14	OFFSET CARD

/	13	CLEAR STATUS REGISTER

/

/STATUS REGISTER BITS CONNECTED TO FLAG AND INTERRUPT REQUEST:

/

/	17	DATA READY (ONLY IF DATA CHANNEL NOT ENABLED)

/	16	CARD DONE

/	15	DATA CHANNEL OVERFLOW

/	09	ERROR CONDITION

/

	.EJECT

.MED=3	/MONITOR ERROR DIAGNOSTICS

/

/

.SCOM=100	/SYSTEM COMMUNICATION AREA

/

EXERRS=.SCOM+37	/EXPANDED ERROR PROCESSOR

/

/

/

/--------------- CRO3B

/

	.IFUND UC15

	.IFUND	CR15

	.IFUND	NOTGDI

CRSC=706722	/SELECT A CARD

CROR=706702	/IOR DATA AND STATUS INTO AC

CRCS=706704	/CLEAR STATUS REGISTER AND DATA BUFFER

CRSI=706721	/SKIP IF COR INTERRUPT IS SET

CRLA=706724	/IOR DATA BUFFER AND STATUS REGISTER INTO AC.

CROC=706716	/CLEAR AC,IOR DATA+STATUS,CLEAR STATUS

	.ENDC

	.ENDC

	.ENDC

/-----

/

	.IFDEF	NOTGDI

CRSI=706701		/SKIP ON COLUMN READY FLAG.

CRSD=706721		/SKIP ON CARD DONE FLAG.

CRCD=706724		/CLEAR CARD DONE FLAG.

CRSC=706744		/SELECT CARD, BINARY MODE.

CRRB=706752		/READ BUFFER, BINARY MODE.

CRSR=706741		/SKIP ON READER READY.

CREF=706761		/SKIP ON EOF BUTTON (CR02 ONLY)

	.ENDC

/

	.IFDEF	CR15

CRSI=706701		/SKIP ON INTERRUPT

CRLC=706704		/LOAD READER CONDITIONS

CRRS=706732		/READ STATUS INTO AC

	.ENDC

/

	.IFDEF UC15

APISLT=55		/API VECTOR

APILVL=1		/API LEVEL

CRSI=APILVL*20+706101	/SKIP FUNCTION OF LEVEL!

SIOA=706001

LIOR=706006		/THIS AND LAST SEND REQ TO PDP-11

CAPI=APILVL*20+706104	/CLEAR INTRRUPTING FLAG

/

	.IFUND NOSPL

DEVCOD=5		/PIREX CODE FOR CARD READER DRIVER

	.ENDC

	.IFDEF NOSPL

DEVCOD=205		/SAME DRIVER, DISABLE SPOOLING!!

	.ENDC

	.ENDC

/

/

	.GLOBL	CDB.

CDB.	DAC CDCALP	/SAVE POINTER TO CAL INSTRUCTION.

	DAC CDARGP	/POINTER TO ARGUMENT LIST ALSO.

	ISZ CDARGP	/BUMP TO FUNCTION CODE.

	LAC* CDARGP	/PICK UP FUNCTION CODE.

	AND	(700000)	/(#032-GAR) ISOLATE THE UNIT NUMBER.

	SZA			/(#032-GAR) IS IT UNIT ZERO?

	JMP	CDER24		/(#032-GAR) NO, GO GIVE IOPS24 ERROR.

	LAC*	CDARGP		/(#032-GAR) YES, PICK UP FUNCTION CODE.

	ISZ CDARGP	/BUMP TO NEXT ARGUMENT OR TO RETURN.

	ADD (JMP CDBDSP	/FORM DISPATCH ADDRESS.

	DAC	CDBDSP

ONCE1	JMS ONCE		/DO ONCE ONLY .SETUP

CDBDSP	XX		/DISPATCH ON FUNCTION.

	JMP CDINIT	/1 -- .INIT 

CD7700	LAW 10000		/2 -- .OPER (IGNORED)

	JMP CDRBMP	/3 -- .SEEK (IGNORED)

	JMP CDERR6	/4 -- .ENTER (ILLEGAL)

	JMP CDERR6	/5 -- .CLEAR (ILLEGAL)

	JMP CDWAIT	/6 -- .CLOSE

	JMP CDIGNR	/7 -- .MTAPE (IGNORED)

	JMP CDREAD	/10 -- .READ

	JMP CDERR6	/11 -- .WRITE (ILLEGAL)

	JMP CDWATR	/12 -- .WAIT,.WAITR

CDERR6	LAW 6		/13 -- .TRAN (ILLEGAL)

CDRSKP	SKP		/GO TO .MED

CDERR7	LAW 7		/ILLEGAL DATA MODE.

	JMP* (.MED+1	/TO .MED.

CDER24	LAW	24	/(#032-GAR) ILLEGAL UNIT NUMBER SPECIFIED.

	JMP*	(.MED+1)	/(#032-GAR) GIVE IOPS24 ERROR MESSAGE.

CDER67	LAW 67			/(RCHM-133) FETCH ERROR NUMBER.
IOPSER	DAC	ERRNUM	/(SCR-134)SET UP ERROR PRINTOUT

ERRLOO	LAC	ERRNUM	/(SCR-134)LOOP, FETCHING # TO AC FOR MONITOR

	JMS*	(EXERRS	/(SCR-134)MONITOR ERROR ROUTINE

	JMP	ERRLOO	/(SCR-134)MISSED, TRY AGAIN

	LAW	-1	/(SCR-134)ONE SIXBIT WORD

	.SIXBT	'CDB'	/(SCR-134)

ERRNUM	-1		/(SCR-134)WHY START AT -1 ??

/

	.IFDEF	UC15	/(SCR-134)
CDER12	LAW	12	/(SCR-134)UC15 WENT AWAY!
	JMP	IOPSER	/(SCR-134)
CDER55	LAW	55	/(SCR-134)NO TCB AREA
	JMP	IOPSER
	.ENDC		/(SCR-134)

	.TITLE CARD READER FUNCTION HANDLING ROUTINES .INIT

/INITIALIZE CARD READER.-ONCE ONLY CODE

CDINIT	ISZ CDARGP	/BUMP TO BUFFER SIZE LOCATION.

	LAC (44		/GET STANDARD SIZE (36(10)).

	DAC* CDARGP	/INSERT BUFFER SIZE IN ARGUMENT LIST.

CDRBMP	ISZ CDARGP	/BUMP TO RETURN.

CDCALX	JMP CDIGNR	/RETURN TO CALLER

/			/ALSO USED AS 'LITERAL' TO FILL CDRRET

/

/ONE-TIME .SETUP TO MAKE INTERRUPT CONNECTION

ONCE	0

CDSETP	LAC CDRNOP	/ENTER ONE-TIME SECTION TO SET UP

CDWDCT	DAC	ONCE1	/NOP TO MAKE ONCE ONLY

/

	.IFDEF UC15

/

/  THERE FOLLOWS A SECTION TO SET UP ONCE ONLY

/  POINTERS TO A DATA BUFFER AND PDP-11 COMMUNICATION BLOCK

/  CALLED A 'TCB' ASSEMBLED INTO DOS FOR UNICHANNEL

/  SYSTEMS. THIS BECAUSE PDP-11 CANNOT SEE ABOVE 50000

/  INPDP-15 CORE TO PLACE DATA IN BUFFER AND TO GET

/  INFORMATION FROM TCB.

/

/  THE ONCE ONLY CODE IS ALSO USED FOR STORAGE

/  AND TEMPORARY LOCATIONS, REFLECTED BY LABELS.

/

CDT1	LAC*	(.SCOM+100	/POINTER TO POINTERS

	SNA!SPA		/(SCR-134)BETTER BE >0 IF UC15 STILL HERE
	JMP	CDER12	/(SCR-134)NO, IOPS12
CDTCB	AAC	2	/OUR POINTER SECOND
CDEV	DAC	CDT1	/FOR ANOTHER INDIRECTION
CDBUF	LAC*	CDT1	/ADDRESS OF OUR AREA TO TCB+BUFFER
	SNA!SPA		/(SCR-134)HAS TO BE >0
	JMP	CDER55	/(SCR-134)MISSED, MONITOR HAS NO TCB FOR US

CDBUFD	DAC	CDTCB	/RECORD TCB ADDR

CDT2	DAC	CDT1	/POINTER TO INITIALIZE TCB

CDRLBH	AAC	2	/POINT TO EVENT VARIABLE

CDCKSM	DAC	CDEV

CDRAC	AAC	2	/ADDR OF SLOT IN TCB POINTING TO BUFFER

	DAC	CDT2	/HOLD FOR NOW, DO LATER

	AAC	3	/BUFFER+1 CHECKSUM LOCATION. CHECKSUM

/			/NOT PRESENTLY IMPLEMENTED

	DAC	CDCKSM	/POINTER TO CHECKSUM WORD IN BUFFER

	IAC		/BUFFER+2, FIRST !DATA! LOCATION

	DAC	CDBUFD

/

/  MAKE TCB

/

	LAC	(APISLT*400+APILVL /TELL PDP-11 WHERE TO COME BACK

	DAC*	CDT1	/INTO FIRST TCB LOCATION

	LAC	(DEVCOD	/CODE TO TELL PIREX WHICH DRIVER

	ISZ	CDT1	/POINT TO TCB+1

	DAC*	CDT1

/

/  LOOP TO ZERO THRU FIRST BUFFER LOCATION

/  CDIOSW ASSEMBLED WITH LOOP CONTROL, WILL BE LEFT WITH

/  EXPECTED 0!

/

	ISZ	CDT1	/NEXT LOCATION

	DZM*	CDT1

	ISZ	CDIOSW	/LOOP CONTROL

	JMP	.-3

	LAC	CDT1	/NOW HAS BUFFER ADDRESS!!

	DAC*	CDT2	/PLACE IN TCB BUFFER POINTER

	DAC	CDBUF	/AND OUR BUFFER HEADER POINTR

/

	CAL	APISLT	/SETUP CAL

	.ENDC

	.IFUND UC15

CDRAC	CAL+55

	.ENDC

CDROUT	16		/SKIP CHAIN AND API CHANNEL REGISTER.

CDCPTR	CRSI

CDTLEN	CDRINT		/INTERRUPT HANDLER.

CDR7CT=CDTLEN

	.IFDEF	NOTGDI

	CAL+55		/SECOND CARD READER SKIP IOT.

	16		/CALL .SETUP AGAIN.

CDRWD3	CRSD		/FOR CARD DONE FLAG.

CDRLBH	CDRINT		/SAME PLACE.

	.ENDC

CDIPTR	LAC* (.SCOM+52	/CHECK TO SEE IF

CDTPTR	AND (200000	/WE HAVE READ A

CDRVAL	SAD (200000	/BOSS CONTROL CARD

CDR5CT	JMP RDINHB	/YES--HANDLE

CDCOLC	JMP*	ONCE	/EXIT

RDINHB	JMS BOSCHK	/IN USER MODE

CDWDSV	JMP* ONCE		/NO-DON'T INHIBIT CARD SELECTION

CDLPTR	LAC JMPEOM	/INHIBIT THE SELECTION

CDRWD1	DAC BOSSRD	/OF A CARD

CDRWD2	JMP*	ONCE	/EXIT

	.TITLE .WAIT,.WAITR AND .CLOSE

/WAIT FOR CARD READER.

CDWATR	LAW 1000

	AND* CDCALP	/WAIT?

	SNA		/NO, WAITR

	JMP CDWAIT

	LAC (700000	/GET LINK ECT AND

	AND CDCALP	/THROW AWAY ADDRESS BITS

	DAC CDCALP

	LAC* CDARGP	/GET WAITR ADDRESS

	AND (77777

	XOR CDCALP	/COMBINE WAITR ADDR WITH LINK, ETC

	ISZ CDARGP	/BUMP FOR I/O DONE RETURN

	DAC CDCALP	/SETUP FOR I/O UNDERWAY RETURN

CDWAIT	JMS IOUWAY	/GO SEE IF PREVIOUS INPUT IS COMPLETE.

CDIGNR	DBR		/ALL FINISHED, DEBREAK FROM LEVEL 4.

	XCT .+1

	JMP* CDARGP	/AND RETURN BELOW ARGUMENT LIST.

CDRBSY	DBR		/NOT DONE YET, DEBREAK.

	XCT .+1

	JMP* CDCALP	/AND RETURN TO CAL.

	.TITLE .READ

/INITIATE READ TO CARD READER.

CDREAD	JMS IOUWAY	/ARE WE DONE YET WITH PREVIOUS READ?

	LAW 7000	/YES, PICK UP CAL -- DATA MODE IN 6-8.

	AND* CDCALP		/MASK OUT 6-8.

	XOR (2000		/ZERO IOPS ASCII INDICATOR.

	SZA		/WILL SKIP IF IOPS ASCII IS WANTED.

	JMP CDERR7	/NOT IOPS ASCII, COMPLAIN.

/

/UPDATE READ ARGUMENTS

/

	LAC* CDARGP	/GET LINE BUFFER ADDRESS

	DAC CDRLBH	/GIVE TO POINTER

	TAD (2		/SKIP OVER HEADER WORD PAIR

	DAC CDLPTR

	ISZ CDARGP	/BUMP TO WORD COUNT

	LAC CDRLBH		/(RCHM-133) FETCH BEGINNING OF USER BUFFER.

	AND (700000)		/(RCHM-133) EXTRACT HIGH MEMORY BITS.

	SZA			/(RCHM-133) ARE ANY OF THEM ON?

	JMP CDER67		/(RCHM-133) YES, GO GENERATE ERROR.

	LAC* CDARGP	/GET IT

	DAC CDWDSV	/SAVE IT FOR IOPS4

	TAD	(2	/ADJUST FOR APPENDED <CR>

	DAC CDWDCT

	ISZ CDARGP	/BUMP TO RETURN

	LAC CDCALX	/SET RETURN ADDRESS(JMP CDIGNR,NOW)

	DAC CDRRET		/FROM READ

	.IFDEF	NOTGDI

CDRRTN	CREF		/EOF BUTTON OR HOPPER EMPTY?

	JMP CDOK		/NO, GO ON

CDREOM	LAC (1005		/END-OF-FILE, GET HEADER INDICATOR.

	DAC* CDRLBH	/GIVE TO USER BUFFER

	DZM CDIOSW	/INDICATE NO IO IN PROGRESS.

	JMP CDIGNR	/THEN GO TO RETURN.

	.ENDC

/SET UP AND START I/O

CDOK	JMS SLCTSP	/SET UP POINTERS FOR READ

	.IFDEF NOTGDI

	CRSR	/ENSURE THAT READER IS READY

	JMP CDR4		/NOT READY, IOPS 4

	.ENDC

	.IFDEF	CR15

	CRRS		/READ STATUS

	DAC	CDSTAT	/AND SAVE

	LAC	(CDBUFF-1	/START OF HANDLER BUFFER-1

	DAC*	CDCA	/TO CA REGISTER

	DZM*	CDWC	/!!##030##!!STRANGE, BUT DOES

/			/BETTER IN ERROR HANDLING!!

/			/R. LARY POINTS OUT THAT A 7 FOOT

/			/CARD WOULD WIPE OUT SOME CORE.

	LAW	20

	AND	CDSTAT	/MAKE SURE READER IS READY

	SNA!CLA

	JMP	CDR4	/NOT READY-IOPS4

	.ENDC

BOSSRD	XCT BOSFLG	/IS BOS-15 CONTROL CARD FLAG UP

JMPEOM	JMP EOMEXT	/YES---HANDLE IT

	LAW -1		/SET I/O UNDERWAY SW

	DAC CDIOSW

	.IFUND	CR15

	.IFUND UC15

	CRSC		/SELECT A CARD

	.ENDC

	.ENDC

	.IFDEF	CR15

	LAW	27	/START READ, CLEAR

	CRLC		/STATUS AND ENABLE INTERRUPT

	.ENDC

	.IFDEF UC15

/

/  WARNING, AT PRESENT 80 CC ARE ALWAYS RECEIVED FROM PDP-11.

/  IF TRAILING BLANK SUPPRESION SHOULD BE IMPLEMEMTED IN DPP-11

/  DRIVER, RECOMMEND CLEARING CDBUFF AT THIS POINT!!

/

	JMS	CDIU	/INIT UNICHANNEL FOR REQUEST

	.ENDC

CDRRET	XX		/JMP CDIGNR OR CDIRET(FROM IOPS4 COND.)

/			/DEPENDING ON WHETHER RETRY FROM CAL LEVEL

/			/OR INTERRUPT LEVEL

/

/

/AN "EOF" IS GIVEN TO THE USER.

EOMEXT	LAC (1005	/GET EOF DATA WORD

	DAC* CDRLBH	/GIVE TO USER

	JMP CDIGNR	/EXIT TO USER

/

/VARIABLES USED FOR BOS-15

BOSFLG	SKP	/BOS FLAG

	.IFUND UC15

DOLLAR	002102		/CARD CODE FOR "$" BOTH 026&029

	.ENDC

	.IFDEF UC15

CDEOF	777440		/CHECK IF 12,11,0 PUNCHES ALL ON FOR EOF

DOLLAR	777553		/DOLLAR AFTER CDEOF HAS BEEN ADDED IN

CDALT	211		/ALT MODE (NO CDEOF ADD.) IN COMPR. COL.

	.ENDC

/

/

/SUBROUTINE SLCTSP

/SET POINTERS FOR READ

/

/

SLCTSP	0

	.IFUND UC15

	.IFUND CR15

	LAW	-120	/WANT EXACTLY 80 COLUMNS

	DAC	CDCOLC

	.ENDC

	LAC (CDBUFF	/SET UP POINTER TO HANDLER BUFFER

	.ENDC

	.IFDEF UC15

	LAC	CDBUF	/UNICHANNL, BUFFER IN MONITOR!

/			/GT OUR STORED POINTR TO IT

	.ENDC

	DAC CDIPTR

	DZM* CDIPTR	/ZERO 1'ST WORD IN BUFFER

	.IFDEF UC15

	DZM*	CDBUFD /FOR UNICHANNEL DATA STARTS AT BUFF+2

/			/ZERO TAHT ONE TO PREVENT FALSE COMPARES

/			/FOR  BOS CARD EOF CARD ETC.

	.ENDC

	DZM CDRVAL	/CLEAR VALIDITY BIT WORD

	LAC	CDRLBH	/RESET BUFFER

	TAD	(2

	DAC	CDLPTR

	LAC	CDWDSV

	TAD	(2	/FOR IOPS4-ILLEGAL PUNCH

/

	DAC	CDWDCT

	JMP* SLCTSP	/EXIT

/

/

/

	.IFUND UC15

/			/UNDER UNI-CHANNEL 11 DRIVER HANDLES ERRORS

/IOPS 4

CDR4	LAC	CDCALX	/SET UP CAL EXIT

	JMS	CDXTRA	/ROUTINE SETS UP CAL EXIT, CLEARS

/			/CDIOSW, AND LEAVES A LAW 4 IN AC

	JMS*	(EXERRS	/EXPANDED ERROR PROCESSOR IN DOS

	JMP	CDRRTN	/RETY CARD

	LAW -4

	.SIXBT	/CD NOT READY/

IOPS4A	LAC	CDINTX	/JUMP TO INTERRUPT  EXIT

	JMS	CDXTRA

	JMS*	(EXERRS	/TO EXPANDED ERROR PROC.

	JMP	CDRRTN	/REDO

	LAW	-6

	.SIXBT	/CD-ILLEGAL PUNCH  /

/

CDRERR	LAC	CDINTX

	JMS	CDXTRA

	JMS*	(EXERRS

	JMP	CDRRTN

	LAW	-6

	.SIXBT	'ERR CHK-CD, RLD-CD'

/

/  SUBROUTINE CDXTRA

/

/  CALL WITH INSTRUCTION IN AC TO BE PLACED IN THE EXIT

/   LOCATION CDRRET. ROUTINE CLEARS CDIOSW TO ALLOW

/   ^P. ROUTINE LEAVES LAW 4 IN AC FOR JMS* (EXERRS.

/

CDXTRA	0

	DAC	CDRRET

	DZM	CDIOSW

	LAW	4

	JMP*	CDXTRA

	.ENDC

/

/

	.IFUND NOTGDI

CDRRTN=CDOK

	.ENDC

	.TITLE SUBROUTINES IOUWAY AND CDRMAP

/

/IOUWAY CHECK THE I/O UNDERWAY FLAG

/AND IF UP JUMPS TO I/O BUSY RETURN

/

IOUWAY	0

	LAC CDIOSW	/IS I/O UNDERWAY

	SPA

	JMP CDRBSY	/YES

	JMP* IOUWAY	/NO--EXIT TO CALLER

/

/

/SUBROUTINE CDRMAP MAPS THE CURRENT

/CARD CARD IMAGE INTO THE USER BUFFER

/IN 5/7 ASCII.

/

/

	.IFUND UC15

CDRMAP	0

	LAC (CDBUFF	/GET COLUMN-DATA BUFFER.

	DAC CDIPTR	/SET UP INPUT POINTER.

	LAW -20	/SETUP 5/7 ASCII COLUMN COUNTER

	DAC CDCOLC	/FOR FULL CARD (80 COLUMNS)

CDRM5	LAW -5		/SETUP 5-CHARACTER COUNTER.

	DAC CDR5CT	/..

CDRML2	LAC* CDIPTR	/GET CURRENT COLUMN DATA

	SAD CDRALT	/ALT MODE (12,1,8 PUNCH)

	JMP CDGALT	/YES

	LAC CDTABL	/GET TOP OF TABLE.	//TABLE LOOKUP

	DAC CDTPTR	/SET TOP OF CURRENT TABLE

	LAC CDTLN1	/SET INITIAL (FULL) TABLE LENGTH.

CDRML4	DAC CDTLEN	/CURRENT LENGTH/2.

	ADD CDTPTR	/CURRENT TABLE TOP + LENGTH/2

	DAC CDCPTR	/CURRENT ITEM IN TABLE

	LAC* CDCPTR	/GET CURRENT ITEM.

	AND (7777		/THROW AWAY JUNK.

	SZA!CLL		/MAKE UP COMPLETE 2'S COMPLEMENT OF ITEM

	ADD CD7700	/REST OF 2'S COMPLEMENT WORD.

	TAD* CDIPTR	/COMPARE CURRENT COLUMN

	SNA!CLA

	JMP CDCFND	/MATCH FOUND.

	SAD CDTLEN	/COLUMN .L. TABLE ENTRY AND CDTLEN .E. 0,

	JMP IOPS4A	/NO MATCH IN TABLE -IOPS4

	SNL		/L=0 JMP UP,L=1 JMP DOWN TABLE.

	JMP CDDPTR	/COLUMN .L. ENTRY.

	LAC CDCPTR	/SET TABLE TOP TO LOWER HALF.

	DAC CDTPTR	/NEW TABLE TOP.

	LAC CDTLEN		/(RCHM-032) FETCH CURRENT INCREMENT.

	SAD (1)			/(RCHM-032) DO WE HAVE TO FUDGE THE TABLE POINTER?

	ISZ CDTPTR		/(RCHM-032) YES, COMPARE THE NEXT HIGHER ENTRY.

CDDPTR	LAC CDTLEN	/UPDATE NEW TABLE LENGTH.

	CLL!RAR		/LENGTH = LENGTH/2

	JMP CDRML4	/GO GET NEW TABLE ENTRY.

CDGALT	LAW 4000		/ALT MODE

	JMP CDCPUT

/COME HERE ON MATCH FOUND.

CDCFND	LAC* CDCPTR	/FOUND, GET CURRENT ENTRY.

	CMA!CLL

	TAD CDTABL+1	/GENERATE LEFTMOST BIT.

	CMA

	XOR CDTABL+1	/RESTORE SIXTH BIT.

	RAR

CDCPUT	DAC CDRWD3

CDCLAW	LAW -7		/IN HEADER WORD.

	DAC CDR7CT	/SET UP FOR SHIFTING THE

CDCPL1	LAC CDRWD3

	RAL		/LEFTMOST 7-BITS OF

	DAC CDRWD3	/CDRWD3 INTO THE TWO

	LAC CDRWD2	/WORD BUILDER SET AT

	RAL		/CDRWD2+1.

	DAC CDRWD2

	LAC CDRWD1

	RAL

	DAC CDRWD1	/BUILD THE 5/7 ASCII

	ISZ CDR7CT

	JMP CDCPL1	/DOUBLE WORD

	ISZ CDIPTR	/BUMP TO NEXT COLUMN

	ISZ CDR5CT	/BUMP 5-CHAR COUNTER DO WE HAVE

	JMP CDRML2	/5 CHAR'S BUILT--NO GET NEXT COLUMN

	LAC CDWDCT	/YES

	TAD (2		/UPDATE WORD COUNT

	DAC CDWDCT	/HAVE WE ALL THE COLUMNS REQUESTED (LESS THAN ALL 80)

	SMA

	JMP CDVER2	/YES--GO PUT IN CR & MAKE UP HEADER WORD PAIR

	LAC CDRWD2	/NO--FINISH 5/7 ASCII BUILD

	CLL!RAL

	DAC CDRWD2

	LAC CDRWD1

	RAL

	DAC* CDLPTR	/STORE 5/7 ASCII IN USER BUFFER

	ISZ CDLPTR

	LAC CDRWD2

	DAC* CDLPTR

	ISZ CDLPTR	/BUMP USER BUFFER

	ISZ CDCOLC	/DO WE HAVE ALL 80 COLUMNS

	JMP CDRM5	/NO---GET SOME MORE

	.ENDC

	.IFDEF UC15

/

/   IN THE CASE OF THE UNICHANNEL, WE RECIEVE A 42(10) WORD

/  BUFFER. THE FIRST WORD IS A BYTE COUNT (NOW ALWAYS 80(10)).

/  NOTE THAT AN EOF CARD HAS A BYTE COUNT OF 1!!

/  SPOOLER DOES CHECKSUM CALCULATION, NOT US.

/  THE SECOND IS A CHECKSUM SO ENTIRE BUFFER ADDS TO 0

/  !!!###MODULO 2^16 THAT IS###!!!. THEN ARE 40(10) WORDS

/  OF 'COMPRESSED COLUMN'. (SEE CR-11 DRIVER MANUAL). EACH

/  WORD HAS TWO EXTRANEOUS BITS AT LEFT, THE !SECOND CHAR!

/  OF THE PAIR, AND FINALLY THE FIRST CHAR OF PAIR AT RIGHTMOST

/  OF WORD. THE PDP-11 HAS ALREADY CHECKED FOR VALID PUNCH

/  COMBINATIONS (64 VALID CARD ASCII, PLUS 12-1-8 FOR ALTMODE).

/

/

CDRMAP	0

	LAC	CDBUFD	/DATA STARTS AT BUFF+2

	CLL!RAL		/TOP 17 BITS ADDRESS, LAST IS RIGHT-LEFT FLOP

	DAC	CDIPTR	/TO GET INCOMING CHAR'S

	LAW	-120	/80 CHAR'S

	DAC	CDCOLC	/NOTE WE USE COUNTERS DIFERENT ALSO

PKINT	LAC	PAKI	/INIT 5/7 PACKER TO EXPECT

	DAC	PAKSW	/1ST CHAR OF A BUNCH OF FIVE

	LAC	CDWDCT	/WE USE AS COUNT OF PAIRS, NOT WORDS

	CLL!RAR		/SO DIVIDE BY TWO

	DAC	CDWDCT

CDRML2	LAC	CDIPTR	/WATCH IT! TOP 17 BITS ADDR, LOW BIT LEFT

	ISZ	CDIPTR	/RIGHT FLIP-FLOP. AND!! POINTER POINTS TO

/			/NEXT CHAR, NOT LAST ONE RETREIVED.

	CLL!RAR		/FLIP-FLOP TO LINK, ADDR AC

	DAC	CDT1	/HOLD POINTER IN TEMPORARY

	LAC*	CDT1	/GET CHARACTER PAIR

	SZL!RAL		/THESE THREE GET CORRECT CHAR

	SWHA!SKP	/TO LOW ORDER 8 BITS OF WORD

	RAR

	AND	(377	/STRIP OTHER CHARACTER

/			/AT THIS POINT HAVE CLOMNS 12,11,0,9,8,1-7

/			/WHERE 1-7 CODED IN THREE BITS

	DAC	CDT1	/HOLD

	SAD	CDALT	/ALT MODE SPECIAL CASE, NO REMAP

	JMP	CDGALT	/REJOIN AS SPECIAL CASE

	AND	(20	/IF NINE PUNCH, PECIAL CASE, REMAP TO 8,1 PUNCH

	SZA		/COMBO FOR OUR TRANSLATE. SKIP IF NOT NINE

	LAW	-7	/ADDED TO '9' GIVES '8' AND '1'

	TAD	CDT1	/REMAPPED, 

	DAC	CDT1	/SAVE, NOW TO MOVE BOTTOM FOUR BITS LEFT ONE

	AND	(17	/POSITION (9 POSITION NOW VACATED!)

	TAD	CDT1	/THIS DOES IT, LEAVING LOW ORDER BIT ZERO

/			/NOW COLUMNS 12,11,0,8,1-7,ZERO BIT!

	SKP!CLL		/HIDE YOUR HEAD. CLL FOR COMING RTR.SKIP

/			/OVER ALT-MODE RE-ENTRY

CDGALT	LAC	(240	/INDEX TO ALT MODE

	RTR		/RIGHT-LEFT TO LINK, INDEX TO AC

	TAD	(CDTABL	/TABLE ADDR

	DAC	CDT1

	LAC*	CDT1	/GET PAIR FROM TRANSLATE TABLE

	SNL		/HERE 0 IS LEFT, IN NORMAL SENSE

	SWHA

	JMS	PAK57	/5/7/ PACKER (IT STRIPS XTRA BITS)

	ISZ	CDCOLC	/80?

	JMP	CDRML2	/NO

	JMP	CDCLOS	/YES

/

/  TRANSLATE TABLE 4 GROUPS OF 16 CHAR'S, TWO PER WORD. 8 WORD

/  SPACE BETWEEN LAST TWO GROUPS, IN WHICH WE PUT OTHER STUFF

/  CONDITIONALIZED FOR 026-029 OF COURSE. LEFT HAND CHAR IS FIRST.

/

	.IFUND DEC026

CDTABL	040061	/BLANK, 1-PUNCH

	062063	/2-PUNCH,3-PUNCH

	064065	/4,5

	066067	/6,7

	070071	/8,9(ORDERED AS 8-1)

	072043	/8-2,8-3

	100047	/8-4,8-5

	075042	/8-6,8-7

	060057	/0,0-1

	123124	/0-2,0-3

	125126	/0-4,0-5

	127130	/0-6,0-7

	131132	/0-8,0-9(ORDERED AS 0-8-1)

	135054	/0-8-2,0-8-3

	045137	/0-8-4,0-8-5

	076077	/0-8-6,0-8-7

	055112	/11,11-1

	113114	/11-2,11-3

	115116	/11-4,11-5

	117120	/11-6,11-7

	121122	/11-8,11-9(ORDERED AS 11-8-1)

	041044	/11-8-2,11-8-3

	052051	/11-8-4,11-8-5

	073134	/11-8-6,11-8-7

	.ENDC

	.IFDEF DEC026

CDTABL	040061

	062063

	064065

	066067

	070071

	137075

	100136

	047134

	060057

	123124

	125126

	127130

	131132

	073054

	050042

	043045

	055112

	113114

	115116

	117120

	121122

	072044

	052133

	076046

	.ENDC

/

/  NOW THE 8 LOC. BREAK IN THE TABLE

/

/  THE 5/7 PACKER, A LITTLE TRICKY PAKSW KEEPS A PC WHICH

/  'REMEMBERS' WHICH CHARQCTER OF 5 WE ARE AT. TO INIT PACKER,

/  SEE TWO LINES OF CODE AT PAKINT. NORMAL 'FLUSH' OUT WOULD

/  BE TO SEND NUL CHAR'S UNTIL PAKSW=PAKI. IN THIS

/  HANDLER, PAST HISTORY SAYS WE TRUNCATE ALWAYS AT A WORD

/  PAIR BOUNDARY, EVEN FOR SHORT BUFFERS. I AM AFRAID TO

/  CHANGE THIS, EVEN THOUGH I DON'T LIKE IT.

/

PAK57	0		/CALL WITH CHAR IN AC, (DESTROYED)

/			/PUSHES CHAR'S THRU CDLPTR. EARLY END CHECK

/			/IN CDWDCT.

	AND	(177	/STIP XTRA

	CLL		/FOR ALL ROTATES AND SWAPS!

	JMP*	PAKSW	/TO WHATEVER ACTION THIS CHAR. NEEDS.

PAKSW	HLT		/POINTER TO ACTINS FOR CHARACTER

	JMP*	PAK57	/THAT'S ALL, OUT

PAKI	PAKST		/INIT PAKSW FOR FIRST CHAR.

PAKT	0		/TEMPORARY FOR PARTIAL WORDS

/

/  REST OF TRANSLATE TABLE

/

	.IFUND DEC026

	046101	/12,12-1

	102103	/12-2,12-3

	104105	/12-4,12-5

	106107	/12-6,12-7

	110111	/12-8,12-9(ORDERED AS 12-8-1)

	133056	/12-8-2,12-8-3

	074050	/12-8-4,12-8-5

	053136	/12-8-6,12-8-7

	.ENDC

	.IFDEF DEC026

	053101

	102103

	104105

	106107

	110111

	077056

	051135

	074041

	.ENDC

	175000		/ALT MODE, FOR BOTH PUNCH SETS.

/

/  NOW REST OF 5/7 PACKER

/

PAKQ	JMS	PAKSW	/5TH CHAR WRAP BACK TO 1ST. JMS TO PAKSW

/			/LEAVES ADDR OF ACTION FOR 1ST.!.

PAKST	RTL		/1ST CHARACTER ACTION, MOVE TO LEFT OF WORD

	SWHA

	DAC	PAKT	/HOLD AS PARTIALLY ASSEMBLED WORD

	JMS	PAKSW	/LEAVE POINTER TO 2ND CHAR

/

	RTL		/2ND CHAR ACTION

	RTL

	XOR	PAKT	/MARGE WITH FIRST

	DAC	PAKT	/WAIT FOR PART OF 3RD TO FILL WORD

	JMS	PAKSW	/LEAVE POINTER TO THIRD

/

	RTR		/3RD, TWO PARTS, FIRST IS TOP 4 BITS

	RAR		/RIGHT JUSTIFIED 1ST WORD OF PAIR

	DAC	PAKSW	/VERY-TEMPORARY IN HERE

	AND	(17	/ZAP OTHER BITS

	XOR	PAKT	/COMPLETE 1ST WORD OF PAIR

	DAC*	CDLPTR	/PLACE IN USER BUFFER

	ISZ	CDLPTR	/MOVE HIS POINTER

	LAC	PAKSW	/GET BACK THIRD CHAR (LINK STILL OK!!!)

	RAR		/2ND JOB, LOW THREE BITS OF CHAR TOP OF

	AND	(700000	/2ND WORD OF PAIR

	DAC	PAKT	/WHEW!, HOLD THAT IN PARTIAL WORD

	JMS	PAKSW	/LEAVE POINTER FOR FOURTH

/

	SWHA		/4TH, SNUG UP TO 3 BITS ON TOP

	RAR

	XOR	PAKT	/TOGETHER

	DAC	PAKT

	JMS	PAKSW	/LEAVE POINTER FOR 5TH

/

	ISZ	CDWDCT	/OVERFLOW SHORT BUFFER?

	SKP!RAL		/NO,  RAL LEAVE XTRA BIT OF PAIR ON RIGHT

	JMP	PAKO	/UH-OH, GO CORRECT

	XOR	PAKT	/COMPLETE 2ND WORD OF PAIR

	DAC*	CDLPTR	/PLACE

	ISZ	CDLPTR	/MOVE POINTER

	JMP	PAKQ	/GO PLACE PAKSW FOR FIRST CHAR OF FIVE

/

/  EXIT EARLY IF USER BUFFER TOO SMALL!

/

PAKO	LAW	-1	/BACK UP POINTER TO START OF PAIR

	TAD	CDLPTR	/FOR TERMINATING CARRIAGE RETURN

	DAC	CDLPTR	/,ALWAYS IN BEGINNING OF LAST PAIR

	LAC	(60	/TOO CHORT BUFFER CODE FOR RETURNED HEADER

	DAC	CDRVAL

CDCLOS	LAC	(64000	/CARRIAGE RETURN

	DAC*	CDLPTR	/INTO LAST WORD PAIR

	LAC	CDRLBH	/CALCULATE # OF WORD PAIRS

	CMA!IAC		/SUBTRACT HEADER ADDR FROM ADDR OF <CR>

	TAD	CDLPTR

	CLL!RAR		/AND DIDVIDE BY TWO

	IAC		/WAIT! MUST INCLUDE HEADER IN COUNT.

	SWHA		/COUNT IN LEFT HALF

	AAC	2	/IOPS ASCII CODE FOR DATA MODE

	TAD	CDRVAL	/AND TOO SHORT BITS IF APPLICABLE

	DAC*	CDRLBH	/TO BUFFER HEADER

	JMP*	CDRMAP	/WHEW!

	.ENDC

	.IFUND UC15

/THE BUFFER HAS BEEN REMAPPED.

/STORE A CARRIAGE RETURN IN

/THE TRAILER WORD AND SET UP

/THE HEADER WORD.

/

CDCLOS	LAC (64000	/CARRIAGE RETURN

	DAC* CDLPTR	/STORE IN USER BUFFER

	LAC (22		/CALCULATE WORD PAIR COUNT

	TAD CDCOLC	/AND POSITION IN THE

	CLL!RAL		/1'ST WORD OF THE HEADER

	RTL

	RTL		/WORD PAIR

	RTL

	RTL

	TAD CDRVAL	/COMBINE WITH SHORT LINE FLAG

	TAD (2		/AND IOPS ASCII DATA MODE

CDPLBH	DAC* CDRLBH	/STORE IN 1ST WORD OF USERS BUFFER

	JMP* CDRMAP	/EXIT

CDVER2	LAC (60		/SET SHORT LINE FLAG

	DAC CDRVAL	/IN HEADER WORD PAIR

	JMP CDCLOS

	.TITLE CDB. CARD READER TABLE OF LEGAL CARD PUNCHES

/TABLE OF CODES.

CDTABL	CDTABL+1

	400000		/BLANK

	710001\7777+1	/9	/THIS TABLE REPRESENTS A SIX-BIT CODE (LEFT-MOST)

	700002\7777+1	/8	/AND THE 2'S COMPLEMENT OF VALID ASCII

	670004\7777+1	/7	/CARD PUNCHES (RIGHTMOST 12 BITS). 7777+1 IS

	.IFUND DEC026

	420006\7777+1	/"	/ADDED TO THE 12 BIT CARD CODE TO GENERATE ITS

	.ENDC

	.IFDEF DEC026

	340006\7777+1	/(\) BACKSLASH 026 MODE

	.ENDC

	660010\7777+1	/6	/(12-BIT) RECIPROCAL BY THE ASSEMBLER.

	.IFUND DEC026

	750012\7777+1	/=	/

	.ENDC

	.IFDEF DEC026

	470012\7777+1	/(') APOSTROPHE 026 MODE

	.ENDC

	650020\7777+1	/5	/IF THE PUNCHES IN A CARD COLUMN WERE

	.IFUND DEC026

	470022\7777+1	/,	/12-1 (A OR BINARY 4400) THE PROGRAM

	.ENDC

	.IFDEF DEC026

	360022\7777+1	/(^) UP-ARROW 026 MODE

	.ENDC

	640040\7777+1	/4	/WOULD JUMP HALFWAY INTO THIS TABLE AND

	000042\7777+1	/@	/PULL OUT A WORD. THE LEFTMOST 6-BITS.

	630100\7777+1	/3	/WOULD BE STRIPPED OFF AND REPLACED BY 77

	.IFUND DEC026

	430102\7777+1	/#	/TO COMPLETE THE NEGATION STARTED AT THE

	.ENDC

	.IFDEF DEC026

	750102\7777+1	/(=) EQUAL SIGN 026 MODE

	.ENDC

	620200\7777+1	/2	/ASSEMBLER LEVEL. THIS (NOW 18-BIT) NEGATIVE

	.IFUND DEC026

	720202\7777+1	/:	/NUMBER IS ADDED TO THE COLUMN BINARY A 0

	.ENDC

	.IFDEF DEC026

	370202\7777+1	/(_) LEFT ARROW 026 MODE

	.ENDC

	610400\7777+1	/1	/RESULT INDICATES A MATCH. A NON ZERO

	601000\7777+1	/0	/RESULT CAUSES A DECISION WHETHER TO JMP

	321001\7777+1	/Z	/HALFWAY INTO THE UPPER OR LOWER HALF,

	311002\7777+1	/Y	/EFFECTIVELY SHRINKING THE TABLE, UNTIL A

	301004\7777+1	/X	/MATCH IS FOUND.

	.IFUND DEC026

	771006\7777+1	/?	/

	.ENDC

	.IFDEF DEC026

	451006\7777+1	/(%) PER CENT SIGN 026 MODE

	.ENDC

	271010\7777+1	/W	/WHEN A MATCH OCCURS THE TABLE WORD IS

	.IFUND DEC026

	761012\7777+1	/>	/REFERENCED AGAIN TO GET THE ASCII

	.ENDC

	.IFDEF DEC026

	431012\7777+1	/(#) NUMBER SIGN 026 MODE

	.ENDC

	261020\7777+1	/V	/EQUIVALENT. IN THE EXAMPLE ABOVE

	.IFUND DEC026

	371022\7777+1	/RIGHT ARROW	/THE WORD POINTED TO BY A IS (013400).

	.ENDC

	.IFDEF DEC026

	421022\7777+1	/(") DOUBLE QUOTE 026 MODE

	.ENDC

	251040\7777+1	/U	/COMPLEMENT THIS NUMBER, CLEAR THE LINK,

	.IFUND DEC026

	451042\7777+1	/%	/AND ADD 400000 TO IT. (013400=764377)

	.ENDC

	.IFDEF DEC026

	501042\7777+1	/(()LEFT PAREN 026 MODE

	.ENDC

	241100\7777+1	/T	/(764377+400000)=364377 WITH LINK=1.

	541102\7777+1	/,	/

	231200\7777+1	/S	/COMPLEMENT THE RESULT (364377=413400)

	.IFUND DEC026

	351202\7777+1	/]	/XOR THE LEFTMOST BIT (41300=013400)

	.ENDC

	.IFDEF DEC026

	731202\7777+1	/(;) SEMI COLON 026 MODE

	.ENDC

	571400\7777+1	//	/ROTATE THE LINK INTO THE WORD AND

	552000\7777+1	/-	/STRIP OFF LOW ORDER 11-BITS.

	222001\7777+1	/R	/RESULT: A=(40400).

	212002\7777+1	/Q	/THIS RESULT IS SAVED AND SHIFTED LEFT

	202004\7777+1	/P	/7 TIMES. (404000=000101).

	.IFUND DEC026

	342006\7777+1	/\

	.ENDC

	.IFDEF DEC026

	462006\7777+1	/(&) AMPERSAND 026 MODE

	.ENDC

	172010\7777+1	/O

	.IFUND DEC026

	732012\7777+1	/;

	.ENDC

	.IFDEF DEC026

	762012\7777+1	/(>) GREATER THAN  026 MODE

	.ENDC

	162020\7777+1	/N

	.IFUND DEC026

	512022\7777+1	/)

	.ENDC

	.IFDEF DEC026

	332022\7777+1	/([) LEFT BRACKET  026 MODE

	.ENDC

	152040\7777+1	/M

	522042\7777+1	/*

	142100\7777+1	/L

	442102\7777+1	/$

	132200\7777+1	/K

	.IFUND DEC026

	412202\7777+1	/!

	.ENDC

	.IFDEF DEC026

	722202\7777+1	/(:) COLON  026 MODE

	.ENDC

	122400\7777+1	/J

	.IFUND DEC026

	464000\7777+1	/&

	.ENDC

	.IFDEF DEC026

	534000\7777+1	/(+) PLUS SIGN  026 MODE

	.ENDC

	114001\7777+1	/I

	104002\7777+1	/H

	074004\7777+1	/G

	.IFUND DEC026

	364006\7777+1	/^

	.ENDC

	.IFDEF DEC026

	414006\7777+1	/(!) EXCLAMATION  026 MODE

	.ENDC

	064010\7777+1	/F

	.IFUND DEC026

	534012\7777+1	/+

	.ENDC

	.IFDEF DEC026

	744012\7777+1	/(<)  .LESS THAN.  026 MODE

	.ENDC

	054020\7777+1	/E

	.IFUND DEC026

	504022\7777+1	/(

	.ENDC

	.IFDEF DEC026

	354022\7777+1	/(]) RIGHT BRACKET  026 MODE

	.ENDC

	044040\7777+1	/D

	.IFUND DEC026

	744042\7777+1	/<

	.ENDC

	.IFDEF DEC026

	514042\7777+1	/()) RIGHT PAREN  026 MODE

	.ENDC

	034100\7777+1	/C

	564102\7777+1	/.

	024200\7777+1	/B

	.IFUND DEC026

	334202\7777+1	/[

	.ENDC

	.IFDEF DEC026

	774202\7777+1	/(?) QUESTION MARK  026 MODE

	.ENDC

	014400\7777+1	/A

CDTLN1	.-1-CDTABL/2

CDRALT	4402

CDEOF1	7400		/EOF CARD (12,11,0,1)

CDEOF2	7777		/ALL ROWS PUNCHED (ALL 1'S)

	.ENDC

	.TITLE CDB. CARD READER INTERRUPT HANDLING SECTION

/CARD READER INTERRUPT SECTION.

CDRINT	SKP		/CONTROL COMES HERE ON PIC INTERRUPT.

	JMP CDRAPI	/CONTROL COMES HERE ON API INTERRUPT.

	DAC CDRAC		/PIC INTERRUPT, SAVE AC.

	LAC (700042	/GET ION CODE.

	DAC CDRSW		/SET TO TURN PIC BACK ON AT EXIT.

	.IFUND UC15

/

/  THIS NEXT IS A LITERAL ZERO WITH FULL COLUMN TRANSLATE TABLE

	LAC*	CDTABL+1 /GET LOCATION ZERO.

	.ENDC

	.IFDEF UC15

/

/  WITH UNICHANNEL WE WILL USE A PROSAIC (0; ARE YOU GUYS

/  REALLY THAT INCREDIBLY TIGHT ON CORE?!?!?!?!?!?!

	LAC*	(0	/PI OPERATION, INTERRUPT PC IN LOC 0.

	.ENDC

	JMP CDSVPC	/SAVE AS INTERRUPT PC.

CDRAPI	DAC CDRAC		/API ENTRY, SAVE AC.

	LAC CDRNOP	/GET NOP CODE.

	DAC CDRSW		/SET TO LEAVE PIC ALONE AT EXIT.

	LAC CDRINT	/GET ENTRY.

CDSVPC	DAC CDROUT	/SAVE AS RETURN.

	.IFUND  UC15

	.IFDEF	NOTGDI

	CRSI		/SKIP ON COLUMN READY

	JMP CRDONE	/NO--CARD IS DONE

	LAC CDCOLC	/COLUMN FLAG, GET CURRENT COUNT.

	RAL		/PUT OVERFLOW INDICATION IN LINK (0 IF SO).

	CRRB		/READ COLUMN, TURN OFF FLAG.

	SZL		/SKIP IF OVERFLOW HAS OCCURRED.

	.ENDC

/

/--------------------CR3B

/

	.IFUND CR15

	.IFUND	NOTGDI

	LAC	CDCOLC	/COLUMNS ALREADY RECEIVED, IF +

	RAL		/WE ALREADY HAVE TOO MANY

	CROC		/STATUS+ DATA IN AC, COUNT IN LINK

	SPA!CML		/SKIP IF NO ERRORS;REVERSE LINK, NOW

/			/IT IS 0 IF OK, 1 IF NOT

	SAD	(600002	/THIS PARTICULAR EROR, HOPPER MT AND

/			/CARD DONE, IF NOT REALLY AN ERROR

	SKP!RAR		/SKIP OVER ERROR EXIT.COLUMN DONE BIT TO LINK

	JMP	CDRERR	/GO ANNOUNCE AN ERROR

	SNL!RAL		/SKIP ON COLUMN DONE;COUNT BACK TO LINK!

	JMP	CRDONE	/NO COLUMN BIT, CARD MUST BE DONE, GO FINISH

	AND	(37774	/KEEP ONLY DATA BITS, IN CASE COUNT OK

	SNL!RTR		/SKIP ON COLUMN COUNT OVERFLOW, SO DAC*

/			/IS NOT DONE;ROTATE TO GET 12 DATA BITS

/			/IN RIGHT PLACE

	.ENDC

	.ENDC

/

/------------------CR15

/

	.IFDEF	CR15

	CRRS		/GET STATUS

	DAC	CDSTAT	/SAVE FOR ADDITIONAL TESTS

	LAW	20	/TURN OFF DEVICE

	CRLC

	LAC	CDSTAT

	AND	(400	/TROUBLE BIT

	SNA!CLA		/SKIP IF TROUBLE

	JMP	CRDONE	/NOT, GO DO DONE

	LAC CDSTAT

	AND (037000

	SAD (2000

	JMP CRDONE

	JMP	CDRERR

/

	.ENDC

/---------

	.IFUND CR15

	DAC* CDIPTR	/INSERT THIS COLUMN IN BUFFER.

	ISZ CDIPTR	/BUMP BUFFER POINTER FOR NEXT TIME.

	ISZ CDCOLC	/COUNT 80 COLUMNS SERVICE.

/			/NOP AT CDRNOP GUARDS AGAINST SKIP!

	.ENDC

	.ENDC

	.IFDEF UC15

	CAPI		/CLEAR OUR FLAG

	LAC*	CDEV	/OPERATION OK BY PIREX??

	RTL		/PDP-11 SIGN BIT TO OURS FOR TEST

	SMA!RTR		/SKIP IF BAD, RESTORE AC

	JMP	CRDONE	/OK

	AND	(177777	/KEEP ONLY PDP-11 SPUPPLIED BITS

	SAD	(177001	/CODE IN PIREX FOR OUT OF NODES

	JMP	CRMORE	/OUT, JUST RETRY UNTIL A NODE COMES FREE

	JMP*	(.MED+1 /SHOULDN'T GET HERE, IF WE DO, PRINT

/			/OUT AS AN IOPS ERROR

	.ENDC

CDRNOP	NOP

CDIRET	LAC CDRSKP	/GET SKIP CODE.

	DAC CDRINT	/RESTORE ENTRY IN CASE OF API INTERRUPT.

	LAC CDRAC		/RESTORE AC.

CDRSW	XX		/ION (IF ENTERED VIA PIC) OR NOP (IF ENTERED VIA API).

	DBR		/EXIT

	XCT .+1

	JMP* CDROUT

	.IFUND UC15

	.IFUND CR15

	.IFDEF NOTGDI

CRDONE	CRCD		/CLEAR COLUMN DONE FLOAG

	LAC	CDCOLC	/COUNTER MUST BE EXACTLY! 0

	SZA		/SKIP WHEN OK

	JMP	CDRERR	/HAVE EITHER LOST OR GAINED A COLUMN!

	LAC	CDBUFF	/GET FIRST COLUMN FOR EOF AND $ CHECKS

	.ENDC

	.IFUND NOTGDI

CRDONE	LAC	CDCOLC	/COUNT MUST BE EXACTLY 0

	SZA

	JMP	CDRERR	/ASK FOR CARD RETRY

	LAC	CDBUFF	/CHECK FOR EOF AND BOSS $

	.ENDC

	.ENDC

	.IFDEF	CR15

CRDONE	LAC	CDBUFF	/EOF CARD?

	.ENDC

	SAD CDEOF1	/IS IT EOF (12,11,0,1)

	JMP EOF		/YES

	SAD CDEOF2	/EOF? (ALL 1'S)

	JMP	EOF	/YES

	SAD DOLLAR	/IS IT A "$"

	.ENDC

	.IFDEF UC15

CRMORE	JMS	CDIU	/GO GET ANOTHER CARD IN PLACE OF ALT-ALT

	JMP	CDIRET	/EXIT FROM INTERRUPT LEAVING BUSY ON!

/			/ALSO USE AS A LITERAL TO SET UP CDRRET

CRDONE	LAC*	CDBUFD /1ST CHAR CHECK (IN BUFF+2 BECUASE OF HEADER)

	AND	(177777	/IS IT SPOOLER EOD ALT-ALT

	SAD	(104611	/ALT-ALT IN COMPRESSED COLUMN

	JMP	CRMORE	/FLUSH THAT CARD AND READ NEXT

	AND	(377	/FIRST CHAR ON RIGHT!

	TAD	CDEOF	/MASK, IFF ALL THREE TOP BITS 12,11,0 SET

/			/WE TREAT AS EOF.

	SMA		/IF EOF, CARRY TO POSITIVE

	JMP	EOF

	SAD	DOLLAR	/REMAINING BITS MATCH $ FOR BATCH??

	.ENDC

	JMS BCDCHK	/YES -- HANDLE IT

	JMS CDRMAP	/GO GIVE BUUFER TO USER

INTEXT	DZM CDIOSW	/CLEAR I/O UNDERWAY SWITCH

CDINTX	JMP CDIRET	/EXIT(USED AS 'LITERAL' TO FILL CDRRET

/

EOF	LAC (1005	/"EOF" DATA WORD TO

	DAC* CDRLBH	/USER BUFFER

	JMP INTEXT	/EXIT

/

/

/SUBROUTINE BCDCHK IS ENTERED WHEN

/A CARD IS READ WHITCH HAS A "$" IN THE 1'ST

/COLUMN (BOS-15 CONTROL CARD)

/IT DETERMINES IF THE CARD BELONGS TO BOS-15

/AND IF SO GIVES IT TO NON-RES BOSS VIA RESIDENT BOSS

/THE BOSS-15 FLAG

/IS SET AND AN EOM IS GIVEN TO THE USER

/

BCDCHK	0

	JMS BOSCHK	/IS BOS-15 IN CORE BUT

	JMP* BCDCHK	/NOT IN CONTROL---NO!

	LAC CDRNOP	/SET BOS-15 FLAG

	DAC BOSFLG

/

/GIVE USER AN EOM

/THEN PACK THE CARD IMAGE BUFFER IN 5/7 ACSII

/INTO ITSELF. THEN GO TO RESIDENT BOSS

/WITH THE BUFFER ADDRESS IN THE AC.

/UPON RETURN FROM RESIDENT BOS SET BIT 1

/IN .SCOM+52 AND EXIT IN THE NORMAL MANNER

/

	LAC (1005	/EOM TO USER

	DAC* CDRLBH

	.IFUND UC15

	LAC (CDBUFF	/RESET POINTERS

	.ENDC

	.IFDEF UC15

	LAC	CDBUF	/POINTER TO DOS MONITOR FOR UNICHANNEL

	.ENDC

	DAC CDRLBH	/AND COUNTERS

	TAD (2		/FOR "CDRMAP"

	DAC CDLPTR

	LAW -44		/MAKE SURE WE GET FULL CARD

	DAC CDWDCT

	JMS CDRMAP	/PACK BUFFER INTO ITSELF

	.IFUND UC15

	DZM* (CDBUFF+1	/ZERO CHECKSUM WORD

	.ENDC

	.IFDEF UC15

	DZM*	CDCKSM	/ZERO CHECKSUM WORD VIA POINTER

	.ENDC

	LAW -2		/CALCULATE ADDR OF .DAT-2

	TAD* (.SCOM+23

	DAC CDWDCT	/SAVE IT

	LAC (2		/CALCULATE ADDR IN RES BOSS

	TAD* CDWDCT	/TO JMS TOO

	DAC CDWDCT	/SAVE IT

	.IFUND UC15

	LAC (CDBUFF	/GET BUFFER ADDRESS

	.ENDC

	.IFDEF UC15

	LAC	CDBUF	/GET OUT POINTER TO MONITOR BUFFER

	.ENDC

	DAC* CDWDCT	/GIVE TO RES. BOSS

	LAC* (.SCOM+52	/SET BIT 1 IN .SCOM+52

	AND (577777

	XOR (200000

	DAC* (.SCOM+52

	JMP INTEXT	/RETURN

/

/

/

/

/

/SUBROUTINE BOSCHK CHECKS FOR RESIDENT BOSS (BOSS-15)

/BEING IN CORE

/

/CALL	JMS BOSCHK

/	RETURN IF BOS-15 IS NOT IN CORE

/	RETURN IF BOS-15 IS IN CORE

/

/

BOSCHK	0

	LAC*	(.SCOM+42 /BIT 17 HERE MUST BE SET

	RTR

	AND*	(.SCOM+52 /AND BIT 0 HERE MUST BE SET

	SPA		/SKIP WHEN EITHER TEST FAILS

	ISZ	BOSCHK	/BOTH BITS SET, MAKE SKIP EXIT

	JMP*	BOSCHK

/

	.IFUND UC15

/

/

/

CDIOSW	0		/NOT UC15, A  ZERO INITIAL BUSY SWITCH

CDBUFF	.BLOCK 120

	.IFUND	NOTGDI

CDRWD3		/7-LEFT MOST BITS=1 CARD COLUMN

CDRLBH		/LINE BUFFER POINTER (HEADER)

	.ENDC

	.IFDEF	CR15

CDSTAT			/TEMP STORAGE OF READER STATUS

CDCA	23		/CURRENT ADDRESS REGISTER FOR DATA CHANNEL

CDWC	22		/WORD COUNT REGISTER FOR DATA CHANNEL

	.ENDC

	.ENDC

	.IFDEF UC15

/

/  SEND REQUEST TO PDP-11

/

CDIU	0

	DZM*	CDEV	/CLEAR EVENT VARIABLE

	LAC	CDTCB	/ADDRESS OF CONTROL TABLE

	SIOA		/CAN IT TAKE IT

	JMP	.-1	/NOT YET (HEY, HOW LONG CAN THIS STICK HERE?)

	LIOR		/IT CAN, THERE IT GOES

	JMP*	CDIU

/

/  LOCATIONS FOR UC15 VERSION

/

CDIOSW	-5		/FIRST TIME THRU A LOOP CONTROL

/			/FOR TCB ZERO

/			/IN REAL LIFE A BUSY SWITCH 0 FOR

/			/FREE AND -1 FOR BUSY

/			/SUSPECT ANY MINUS WILL DO.

/

	.ENDC

/

/  AND FOR EVERYONE, AN ARGUMENT AND CAL POINTER

/

CDARGP	0

CDCALP	0

	.END
