Trailing-Edge
-
PDP-10 Archives
-
BB-F493Z-DD_1986
-
10,7/cdrser.mac
There are 7 other files named cdrser.mac in the archive. Click here to see a list.
TITLE CDRSER - CARD READER SERVICE FOR MULTIPLE CARD READERS - V123
SUBTTL T. WACHS/TW/CF/WM/JE TS 10 SEP 85
SEARCH F,S
$RELOC
$HIGH
;THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY ONLY BE USED
; OR COPIED IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE.
;
.CPYRT<1973,1986>
;COPYRIGHT (C) 1973,1974,1975,1976,1977,1978,1979,1980,1982,1984,1986
;BY DIGITAL EQUIPMENT CORP., MAYNARD, MASS.
;ALL RIGHTS RESERVED.
; DATE LOAD EDIT #
; ---- ---- ------
;
;
;
XP VCDRSX,123
;PUT VERSION NUMBER IN GLOB LISTING AND LOADER STORAGE MAP
ENTRY CDRSER
COD029==5252 ;12-0-2-4-6-8
COD026==4242 ;12-2-4-8
CODEOF==7400 ;12-11-0-1
NEWEOF==0017 ;6-7-8-9 PUNCH.
;BITS IN LH OF S
COLUM1==100 ;SET WHEN FIRST COL HAS NOT BEEN READ.
COLUM2==200 ;SET WHEN SECOND COL HAS NOT BEEN READ.
CR029==400 ;SET WHEN 029 TRANSLTN TO BE MADE.
FORGET==1000 ;SET TO AVOID BUFFER ADVANCEMENT.
IGNRBT==2000 ;SET TO AVOID USER BUFFER OVERFLOW.
CRTRBL==4000
;BITS IN RH OF S
SPIMBT==1B29 ;IO STATUS BIT FOR SUPER-IMAGE MODE.
;BUFFER SIZES
ASBFSZ==^D18 ;BUFFER SIZE FOR ASCII MODE.
BIBFSZ==^D27 ;BUFFER SIZE FOR BINARY MODE.
IMBFSZ==^D28 ;BUFFER SIZE FOR IMAGE MODE.
SIBFSZ==^D81 ;BUFFER SIZE FOR SUPER-IMAGE MODE.
;HARDWARE STATUS FLAGS FOR CDR
ITREN==1B18 ;TROUBLE ENABLED.
IRDEN==1B19 ;READY-TO-READ ENABLED.
F27PK==1B20 ;PICK FAILURE FLAG, SET WITH ITRBL.
F27PC==1B21 ;PHOTO CELL ERROR, SET WITH ITRBL.
F27CM==1B22 ;CARD MOTION ERROR, SET WITH ITRBL.
F27ST==1B23 ;STOP FLAG, SET WITH ITRBL OR EXTERNALLY.
FCIRD==1B24 ;CARD IN READ FLAG.
F27HS==1B25 ;HOPPER EMPTY/STACKER FULL FLAG, SET WITH ITRBL.
FRDCD==1B26 ;READING CARD FLAG.
ITRBL==1B27 ;TROUBLE INTERRUPT.
IDMSD==1B28 ;DATA MISSED INTERRUPT.
IRDYR==:1B29 ;READY-TO-READ INTERRUPT.
IEOFL==1B30 ;END OF FILE INTERRUPT.
IEOCD==1B31 ;END OF CARD INTERRUPT.
IDRDY==:1B32 ;DATA READY INTERRUPT.
NOTRDY==:ITRBL+IDMSD+IEOFL+IEOCD ;SYMBOL FOR TEST IN DDB'S
;DISPATCH TABLE
JRST CDRONL ;CHECK TO SEE IF CDR IS ON LINE
JRST ECOD2## ;SPECIAL ERROR STATUS
JRST GTBFSZ ;GET BUFFER SIZE AS FCTN OF MODE
JRST CDRINI ;INITIALIZATION
JRST CDRHNG ;HUNG DEVICE
CDRDSP::JRST CDRREL ;RELEASE
JRST ILLOUT## ;CLOSE CALLED ONLY ON ILLEGAL OUTPUT
JRST ILLOUT## ;OUTPUT IS ILLEGAL
;HERE ON INPUT UUO TO START READER.
CDRSER::
TLZN S,CRTRBL ;TROUBLE DETECTED ON INTERRUPT?
JRST CDSET ;NO
MOVEM S,CDRIOS##(F) ;YES, SAVE S (CRTRBL OFF)
JRST TKUSER ;AND CALL HNGSTP
CDSET: PUSHJ P,CDRONL ;CDR ON LINE?
JRST TKUSER ;NO, READER MUST BE OFF, TELL USER.
CDSET1: TLNN S,IOBEG
JRST CDRGO
TLZ S,CR029+FORGET+IGNRBT ;YES. SET UP FOR 1ST TIME
MOVSI T2,PCDRAS## ;SET UP FOR ASCII CARDS
TRNN S,10 ;REALLY ASCII?
JRST SETPTR ;YES.
MOVSI T2,PCDRBI## ;BINARY AND IMAGE BYTE SIZE= 12.
TRNE S,SPIMBT ;IS THIS SUPER-IMAGE MODE?
MOVSI T2,PCDRSI## ;SUPER-IMAGE BYTE SIZE = 36.
SETPTR: MOVEM T2,CDRPTR##(F) ;SET BYTE SIZE
CDRGO: TLZ S,IOBEG ;CLEAR VIRGIN DEVICE BIT.
PUSHJ P,NEWBUF## ;INITIALIZE NEW BUFFER
JRST ADRERR## ;ADDRESS ERROR
CDRGO1: SETZM CDRMIS##(F)
MOVEI U,IEOFL
XCT CDRCSO##(F) ;EOF BUTTON PRESSED?
TLNE S,IOEND ;EOF?
JRST EOF ;YES-PROCESS IT NOW
TRNE S,SPIMBT ;IS S SET FOR SUPER-IMAGE MODE?
PUSHJ P,SETSPI ;YES, SET UP THE BLKI PTR: SUPIMG.
TLO S,COLUM1+COLUM2 ;NO. INIT FOR COLUMN 1
MOVEI T1,1670 ;SET UP CONO FOR NEXT CARD
MOVEI U,ITREN+IRDYR
XCT CDRCSO##(F) ;WAS TROUBLE ENCOUNTERED OR CARD READY?
MOVEI T1,370 ;YES. SET CONO FOR READY-TO-READ
MOVE U,T1 ;GET BITS FOR CONO INTO U
ANDI T1,500 ;GET INTERRUPT ENABLE BITS
ADDI T1,270 ;GET OTHER INTERRUPT BITS
PUSHJ P,SETDLV ;SET UP DATA LEVEL INTERRUPT
TRO S,IOACT ;CANT USE SETACT AS IT ZEROES IOW
JRST STOIOS## ;WHICH MAY BE ON AFTER IGNORING A CARD
TKUSER: HRRZ T2,DEVBUF(F) ;ADR OF BUFFER HDR
EXCTUX <HRRZ T1,@T2> ;CURRENT USER BUFFER
PUSHJ P,UADRCK##
EXCTUX <SKIPGE @T1> ;DOES IT CONTAIN DATA?
PJRST RTEVM## ;YES, GIVE IT TO THE USER
MOVSI T1,DVOFLN ;OFF-LINE BIT
IORM T1,DEVCHR(F) ;LITE IT
PUSHJ P,HNGSTP## ;PROBLEM. OPR CAN CORRECT AND CONT.
JRST CDSET1 ;TRY IT AGAIN.
;SUBROUTINE TO SEE IF THE CDR IS ON LINE
; RETURN CPOPJ1 IF IT IS
CDRONL: MOVEI U,F27ST+F27HS ;STOP CONDITION TO BE CONTINUED BY THE OPR?
XCT CDRCSZ##(F) ;CONSZ FROM DDB
POPJ P, ;YES, TELL THE OPR
MOVEI U,IRDYR+IEOFL ;IF WE ARE HERE, READER CAN BE ON OR OFF
XCT CDRCSO##(F) ;BUT IF ON, THIS BETTER SKIP
POPJ P, ;OFF
JRST CPOPJ1## ;ON
;HERE TO GET BUFFER SIZE, CALLED DURING INIT UUO.
GTBFSZ: MOVEI T1,ASBFSZ ;ASSUME ASCII.
TRNN M,10 ;C(UUO) IS USER'S INIT ARG.
JRST GPBFS1 ;ASCII.
MOVEI T1,BIBFSZ ;NOT ASCII. ASSUME BINARY.
TRNE M,4 ;BINARY?
JRST GPBFS1 ;YES.
MOVEI T1,IMBFSZ ;MUST BE IMAGE MODE.
TRNE M,1B29 ;SUPER-IMAGE?
MOVEI T1,SIBFSZ ;YES, 80 WORDS OF DATA/BUFFER.
POPJ P, ;RETURN WITH BUFFER SIZE IN TAC.
GPBFS1: TRZ M,1B29 ;SUPER-IMAGE ALLOWED ONLY
POPJ P, ;IF INITIALIZED FOR IMAGE MODE.
;HERE TO INITIALIZE BLKI PTR USED FOR SUPER-IMAGE MODE.
SETSPI: MOVN T1,CDRCTR##(F) ;NEG NUMBER OF BYTES.
HRLZ T1,T1 ;MAKE IT THE NEG CNTR IN BLKI PTR.
HRRI T1,@CDRPTR##(F) ;PICK UP ADDRESS TO FIRST SRD OF BUFFER.
MOVEM T1,CDRSUP##(F) ;SET PTR.
POPJ P, ;AND PRETURN READY TO PROCESS A CARD.
;SUBROUTINE TO DISABLE INTERRUPTS ON FLAG LEVEL AND ENABLE INTERRUPTS
;ON DATA LEVEL. CALLED WITH CONO BITS IN AC(U) AND CONSO BITS
;IN AC(T1)
SETDLV: HLLZS CRFCON##(F) ;DISABLE FLAG LEVEL PI
ADD U,CDRCH##(F) ;PIA
CONO PI,PI.OFF ;DISABLE PI'S WHILE CHANGING LEVELS
HRRM T1,CDRCON##(F) ;AND SET UP INTERRUPT LOCATION
XCT CDRCNO##(F) ;START CARD READER
CONO PI,PI.ON ;TURN PI SYSTEM BACK ON
POPJ P, ;AND RETURN
;THIS IS THE ENTRY POINT FOR THE INTERRUPT LEVEL SERVICE FOR THE CDR
CDRINT::
SKIPN CDRMIS##(F) ;DONT CHANGE STATUS IF ERROR
XCT CRXSTS##(F) ;STORE STATUS.
XCT CDRRDY##(F) ;SKIP IF DATA READY FLAG
JRST NOTDAT ;NOT DATA READY, FIND OUT WHAT
AOS CDRCOL##(F) ;COUNT FOR DETECTION OF SPURIOS EOC INTERRUPTS.
SKIPN CDRSUP##(F) ;SUPER-IMAGE MODE?
JRST NORMOD ;NO, PROCESS NORMALLY.
XCT CDRBKI##(F) ;YES, XMIT TO USER'S BUFFER.
JRST .+2 ;NON-SKIP IF CDRCTR COLUMNS PROCESSED.
JRST CDREX1##(F) ;ROOM FOR MORE COLUMNS, DISMISS INTERRUPT.
;HERE WHEN 80 CHARS HAVE BEEN XMTD TO USER.
MOVEM U,CDRSV2##(F) ;SAVE AC(U)
HRRZ U,CDRSUP##(F) ;PICK UP LAST PTR ADR
HRRM U,CDRPTR##(F) ; AND STORE IT FOR WRD CNT CALC.
SETZM CDRSUP##(F) ;TURN OFF SUPER-IMAGE TEMPORARILY.
MOVSI U,IGNRBT ;IGNORE THE REST OF THE WORD
IORM U,DEVIOS(F) ;SAVE IOS
JRST CDRXIT ;RESTORE U AND EXIT
;HERE TO PROCESS NON SUPER-IMAGE MODE INPUT.
NORMOD: MOVEM U,CDRSV2##(F) ;SAVE AC U
MOVE U,DEVIOS(F) ;GET STATUS WORD
TLNE U,FORGET+IGNRBT ;PROCESS IT?
JRST IGNORE ;NO, READ AND DISMISS
TRNN U,7 ;SKIP IF NOT ASCII OR IMAGE
TRNN U,10 ;SKIP IF IMAGE MODE
JRST NOTIMG ;ASCII OR BINARY
XCT CDRDTI##(F) ;READ DATA INTO U
IDPB U,CDRPTR##(F) ;PUT INTO USER'S BUFFER
MOVSI U,IGNRBT ;BIT TO IGNORE REST OF CARD
SOSG CDRCTR##(F) ;ROOM FOR MORE?
IORM U,DEVIOS(F) ;NO, SET IGNORE BIT
JRST CDRXIT ;RESTORE IT AND EXIT
;HERE TO READ AND THROW AWAY THE COLUMN
IGNORE: XCT CDRDTI##(F) ;READ THE COLUMN
CDRXIT: MOVE U,CDRSV2##(F) ;RESTORE U
JRST CDREX1##(F) ;AND EXIT
;HERE IF DATA IS IN ASCII MODE, READ AND CONVERT
NOTIMG: XCT CDRDTI##(F) ;READ THE COLUMN INTO U
EXCH U,CDRSV2##(F) ;SAVE DATA, RESTORE U
JSR CDRSVE##(F) ;SAVE INTERRUPT AC'S
HRRZ U,CDRSV2##(F) ;GET BACK DATA
MOVE S,DEVIOS(F) ;GET STATUS WORD TO S
TLZE S,COLUM1 ;FIRST COLUMN?
JRST FSTCOL ;YES, MAKE SPECIAL CHECKS
CDRDIS: TRNN S,10 ;ASCII?
JRST CDRASC ;YES, CONVERT IT
JRST DISRET ;NO, STORE BINARY DATA IN USER'S BUFFER
;HERE ON INTERRUPTS OTHER THAN DATA READY
NOTDAT: XCT CDRRTR##(F) ;SKIP IF READY TO READ INTERRUPT
JRST CRFLAG ;GO PROCESS NON-DATA INTERRUPT.
MOVEM U,CDRSV2##(F) ;READY TO READ, SAVE U
MOVEI U,670 ;GET INTERRUPT MASK
HRRM U,CDRCON##(F) ;AND SET UP INTERRUPT LOCATION
MOVEI U,1670 ;GET CONO BITS
ADD U,CDRCH##(F) ;PIA
XCT CDRCNO##(F) ;START CARD MOVING.
JRST CDRXIT ;RESTORE U AND EXIT
;HERE WHEN AN ASCII CHARACTER IS READ
CDRASC: SETZB T1,T2
JUMPE U,CDRAS2 ;0-PICK UP AN ASCII BLANK
CAIN U,5000
MOVEI U,4202
CAIN U,3000
MOVEI U,2202
LDB T2,[XWD 110300,U]
TRNE U,3
TRC T2,7
TRNE U,74
TRO T2,10
TRNE U,314
TRO T1,2
TRNE U,525
TRO T1,1
TLNE S,CR029 ;AN 029 CARD READ?
TRO T2,20 ;NO. BUMP T2 TO 026 TABLE
CDRAS2: LDB U,CRCVPT##(T1) ;PICK UP ASCII CHAR FROM TABLE
DISRET: IDPB U,CDRPTR##(F) ;STORE CHAR IN USERS BUFFER
SOSLE CDRCTR##(F) ;ROOM FOR MORE?
POPJ P, ;YES, EXIT
TLO S,IGNRBT ;IGNORE REST OF CARD
STODIS: MOVEM S,CDRIOS##(F) ;SAVE STATUS
POPJ P, ;AND EXIT
CRFLAG: MOVEM U,CDRSV2##(F) ;SAVE AC
HLLZS CDRCON##(F) ;DISABLE DATA LEVEL INTERRUPT
MOVEI U,660 ;SET UP FLAG LEVEL INTERRUPT
HRRM U,CRFCON##(F) ;TO CATCH CHANGE OF PI LEVELS
MOVEI U,CRFCHN##+ITRBL+IRDYR ;GET FLAG LEVEL PI
XCT CDRCNO##(F) ;CHANGE INTERRUPT LEVELS
JRST CDRXIT ;RESTORE U
;AND DISMISS
;HERE WHEN THE 1ST COLUMN OF A CARD HAS BEEN READ.
FSTCOL: TLNN S,COLUM2 ;REALLY FIRST COL?
JRST NOTFST ;NO, IT'S THE 2ND COL.
CAIE U,CODEOF+NEWEOF ;YES, IS IT AN EOF?
CAIN U,CODEOF ;MAYBE, CHECK ANOTHER STYLE OF EOF.
JRST EOFCRD ;YES, GO PROCESS.
CAIN U,NEWEOF ;MAYBE, SEE IF ITS THE NEW EOF.
JRST EOFCRD ;YES, PROCESS.
NOTFST: TRNE S,10 ;ASCII CARD?
JRST NOTASC ;NO
CAIN U,COD026 ;YES. IS IT AN 026 CARD?
JRST SET026 ;YES. HANDLE IT
CAIE U,COD029
JRST SETIOS
TLZ S,CR029
TLO S,FORGET
SETIOS: MOVEM S,CDRIOS##(F) ;SAVE S
TLNN S,FORGET ;FORGET REST OF CARD?
JRST CDRDIS ;NO. PROCESS IT
POPJ P, ;YES. DISMISS INTERRUPT
SETFRG: TLOA S,FORGET ;SET BIT TO FORGET ABOUT CARD
NOTASC: TRNN S,4 ;COL 1 OF A NOT ASCII CARD
JRST SETIOS ;IMAGE MODE - NO PROCESSING
TLZN S,COLUM2 ;COLUMN1?
JRST COL2IN ;NO. COLUMN2 JUST READ
MOVEI T1,-5(U) ;COL1 - IS THERE A 7-9 PUNCH?
TRNE T1,17
TRO S,IOIMPM ;NO. SET ERROR BIT
LSH U,-6 ;COLUMNS 12-3 ARE WORD COUNT
JUMPE U,SETFRG ;FORGET CARD IF WRDCNT=0
PUSH P,U ;SAVE U
IMULI U,3 ;COMPUTE ITEM COUNT
CAMGE U,CDRCTR##(F) ;MORE THAN THE BUFFER CAN HOLD?
MOVEM U,CDRCTR##(F) ;NO. SAVE AS REAL COUNT
POP P,U ;GET WRDCNT
HRRM U,@CDRPTR##(F) ;IN R.H. OF 1ST DATA WORD OF BUFFER
TLO S,COLUM1 ;SET TO PICK UP COLUMN2
JRST STODIS ;STORE S AND RETURN
;HERE WHEN COL 2 OF A BINARY CARD WAS READ
COL2IN: MOVSM U,CDRCHK##(F) ;COLUMN2 IS CHECKSUM
HRLM U,@CDRPTR##(F) ;ALSO IN L.H. OF 1ST DATA WORD
JRST STODIS ;STORE S AND RETURN
;HERE ON A NON-DATA CDR INTERRUPT
CRFINT::MOVE S,CDRIOS##(F) ;AND GET STATUS INTO S
MOVEI U,IEOCD
XCT CDRCSO##(F) ;END OF CARD?
JRST NOTEOC ;NO
MOVE U,CDRCOL##(F) ;YES, EOC INTERRUPT.
SKIPE CDRMIS##(F)
JRST DONCNT
CAIGE U,^D79
JRST SPUEOC ;NO, ASSUME SPURIOUS INTERRUPT.
DONCNT: SETOM CDRCOL##(F) ;YES, RE-INIT COL CNT.
AOS CDRCNT##(F)
TLZE S,FORGET ;FORGET ABOUT CARD?
JRST CDRGO1 ;YES, START TO READ NEXT CARD.
SKIPN CDRSUP##(F) ;IF CDRSUP NON-ZERO, CDRPTR MUST BE SET.
JRST NTSUPI ;CDRPTR ALREADY SET OR NOT IN SUPER-IMAGE MODE.
HRRZ U,CDRSUP##(F) ;PICK UP LWA OF XFR.
MOVEM U,CDRPTR##(F) ;SET IN PTR FOR WORD CNT CALC.
SETZM CDRSUP##(F) ;FLAG THAT ITS DONE.
NTSUPI: TRNE S,10 ;BINARY?
JRST BINEOC ;YES. CHECK CHKSUM
MOVEI U,15 ;NO. INSERT <CR>
IDPB U,CDRPTR##(F)
MOVEI U,12 ;INSERT <LF>
IDPB U,CDRPTR##(F)
NXTCRD: TLZ S,IGNRBT ;SET UP TO READ NEXT CARD
MOVEI T1,@CDRPTR##(F) ;LAST ADDRESS
MOVEI T2,@CDRIAD##(F) ;FIRST ADDRESS (-1)
SUBI T1,1(T2) ;COMPUTE NUMBER OF WORDS STORED
HRRM T1,1(T2) ;STORE IN 1ST WORD OF BUFFER
;IN IO WAIT?
PUSHJ P,SETIOD## ;YES. TAKE OUT
PUSHJ P,ADVBFF## ;ADVANCE BUFFERS
JRST CDROFF ;NEXT BUFFER NOT EMPTY
MOVEI U,F27PC+F27CM+IDMSD
XCT CDRCSZ##(F)
TRO S,IODERR
MOVEI U,F27ST+F27HS
XCT CDRCSO##(F) ;SKIP IF STOP CONDITION
TRNE S,IODERR+IOIMPM+IODTER ;BUFFER AVAILABLE, ANY ERRORS?
JRST CDROFF ;YES, TURN OFF CDR.
JRST CDRGO ;NO, PROCEES READING CARDS.
;HERE TO PROCESS SPURIOUS EOC INTERRUPTS.
SPUEOC: AOS CDRSPU##(F)
MOVEI T1,IEOCD ;SET TO CLEAR EOC
MOVEI U,ITREN
XCT CDRCSZ##(F) ;TROUBLE ENABLED?
TRO T1,ITRBL ;YES
MOVEI U,IRDEN
XCT CDRCSZ##(F) ;RDY TO READ ENABLED?
TRO T1,IRDYR ;YES
MOVE U,T1
ANDI T1,500
ADDI T1,270
PUSHJ P,SETDLV ;GO BACK TO DATA LEVEL
SKIPGE CDRCOL##(F) ;ARE WE ACTIVELY PROCESSING A CARD?
POPJ P, ;NO, DISMISS SINCE THIS SHOULDN'T HARM.
MOVEI U,^D79 ;YES, FLAG IT AND LET ANY FURTHER
MOVEM U,CDRCOL##(F) ; SPURIOUS INTERRUPTS FOR THIS CARD PASS THRU.
JRST SETERR ;FLAG IT AND DISMISS.
;HERE ON THE END OF A BINARY CARD
BINEOC: TRNN S,4 ;REALLY BINARY?
JRST NXTCRD ;IMAGE MODE
MOVEI T2,@CDRIAD##(F) ;ADDRESS OF BUFFER
PUSHJ P,CKS12## ;COMPUTE CHECKSUM
CAME T1,CDRCHK##(F) ;DOES IT COMPARE WITH CARD'S CHKSUM?
TRO S,IODTER ;NO. LIGHT A BIT
JRST NXTCRD ;START READ OF NEXT CARD
SET026: TLOA S,CR029 ;026 - RESET 029 BIT
EOFCRD: TLO S,IOEND ;EOF - LIGHT BIT
JRST SETFRG ;FORGET REST OF CARD
NOTEOC: MOVEI U,IEOFL
XCT CDRCSZ##(F) ;EOF BUTTON PRESSED?
JRST EOF ;YES.
MOVEI U,ITRBL
XCT CDRCSO##(F) ;TROUBLE?
JRST NOTRBL ;NO, PROCEED
MOVEI U,0
MOVEI T1,270
PUSHJ P,SETDLV ;GO BACK TO DATA LEVEL
NOTRBL: MOVEI U,F27PC+F27CM+IDMSD
XCT CDRCSO##(F) ;ERROR EXCEPT PICK OR STOP BUTTON?
JRST SETRDY ;NO. GO SET READY-TO-READ INTERRUPT
SETERR: TRO S,IODERR ;YES. SET ERROR BIT
MOVEI T1,670
MOVEI U,IDMSD
PUSHJ P,SETDLV ;GO BACK TO DATA LEVEL
SETOM CDRMIS##(F)
PJRST STOIOS##
STOERR: PUSHJ P,CDROFF ;DISABLE INTERRUPTS SINCE IOACT CLEARED BY DEVERR
TLO S,CRTRBL ;SET TROUBLE BIT IF CDR TROUBLE INTERCEPT
MOVEM S,CDRIOS##(F) ;STORE STATUS
PJRST DEVERR## ;AND REPORT ERROR
EOF: TLO S,IOEND+IOBEG ;EOF - LIGHT BIT
CDRREL: MOVEI T1,0 ;
DPB T1,PBUFSZ## ;ZERO OUT BUFFER SIZE.
SETOM CDRCOL##(F) ;INITIALIZE COLUMN COUNT.
SETZM CDRSUP##(F) ;TURN OFF SUPERIMAGE MODE.
TLZ S,CRTRBL ;CLEAR TROUBLE BIT
CDROFF: MOVEI U,10000 ;CONTROLLER RESET BIT
XCT CDRCNO##(F)
HLLZS CDRCON##(F) ;RESET INTERUPT LOC
HLLZS CRFCON##(F) ;ALSO FLAG LEVEL
PUSHJ P,SETIOD## ;TAKE OUT OF IO WAIT
PUSHJ P,RTEVM## ;RETRUN ANY EVM
JRST CLRACT## ;ZERO IOACT, STORE S AND RETURN
SETRDY: MOVEI U,F27HS
XCT CDRCSZ##(F)
JRST TSTINR
MOVEI U,10000 ;CONTROLLER RESET BIT
XCT CDRCNO##(F) ;RESET READ-A-CARD FLOP
JRST CDRGO ;ENABLE FOR READY TO READ
;HERE ON HOPPER/STACKER ERROR
TSTINR: MOVEI U,FCIRD
XCT CDRCSZ##(F) ;CARD IN READER?
POPJ P, ;YES, IGNORE INTERRUPT (TRBL NOT ENEBLED)
PJRST STOERR ;NO, GO INTERCEPT THE ERROR
CDRINI: MOVEI U,10000 ;CONTROLLER RESET BIT
XCT CDRCNO##(F)
HLLZS CDRCON##(F) ;CLEAR SKIP CHAIN MASK FLAGS
HLLZS CRFCON##(F) ; FOR BOTH DATA AND FLAGS
IFN FTMP,<
MOVE T1,CDRCOL##(F) ;INTERLOCK POINTS AT INTERRUPT CHAIN
ADDM T1,DEVCPU##(F) ;POINT IT AT FLAGS CHAIN
>
SETOM CDRCOL##(F) ;INITIALIZE COLUMN COUNT
SETZM CDRSUP##(F) ;TURN OFF SUPERIMAGE MODE
JRST CPOPJ1## ;SKIP RETURN TO FORCE CALL FOR EACH CDR
;HERE ON HUNG DEVICE TIME OUT IF TROUBLE INTERCEPT ENABLED
CDRHNG: MOVEI U,F27PC+F27CM+FCIRD ;IF PHOTO CELL DARK, CARD MOTION
XCT CDRCSZ##(F) ; ERROR, OR CARD IN READER AFTER TIME OUT
TRO S,IODERR ;LIGHT AN ERROR BIT
PUSHJ P,CDRREL ;RELEASE AND TURN OFF CDR
AOS (P) ;SKIP RETURN SO NO HUNG MESSAGE
PJRST STOERR ;AND RETURN
END