Trailing-Edge
-
PDP-10 Archives
-
BB-Y393F-SM
-
monitor-sources/ptr.mac
There are 42 other files named ptr.mac in the archive. Click here to see a list.
;<4-1-FIELD-IMAGE.MONITOR>PTR.MAC.2, 25-Feb-82 20:47:06, EDIT BY DONAHUE
;UPDATE COPYRIGHT DATE
;<4.MONITOR>PTR.MAC.3, 3-Jan-80 08:10:25, EDIT BY R.ACE
;UPDATE COPYRIGHT DATE
;<4.MONITOR>PTR.MAC.2, 6-Mar-79 09:40:10, EDIT BY KONEN
;UPDATE COPYRIGHT FOR RELEASE 4
;<OUYANG>PTR.MAC.3, 30-Nov-77 17:06:11, Edit by OUYANG
;<HELLIWELL.1065>PTR.MAC.6, 5-Sep-77 15:52:18, EDIT BY HELLIWELL
;<HELLIWELL.1065>PTR.MAC.5, 5-Sep-77 15:43:14, EDIT BY HELLIWELL
;<HELLIWELL.1065>PTR.MAC.4, 5-Sep-77 01:29:59, EDIT BY HELLIWELL
;<HELLIWELL.1065>PTR.MAC.3, 21-Aug-77 12:45:02, EDIT BY HELLIWELL
;<HELLIWELL.1065>PTR.MAC.2, 21-Aug-77 12:33:46, EDIT BY HELLIWELL
;REL 3 CHANGES
;COPYRIGHT (C) 1976,1977,1978,1979,1980,1981,1982 BY DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS.
SEARCH PROLOG
TTITLE (PTR,,< - PAPER TAPE READER SERVICE, R. HELLIWELL>)
;LOCAL STORAGE DECLARED IN STG.MAC
EXTN <PTRCHR>
EXTN <PTRBFZ,PTRBF1,PTRBF2,PTRSTS,PTRLCK,PTRCNT,PTRITC>
EXTN <PTRCHC,PTRPTR,PTRSIO>
;SPECIAL AC DEFINITIONS USED HEREIN
DEFAC (IOS,Q2) ;DEVICE STATUS
DEFAC (STS,P1) ;SEE GTJFN FOR FUNCTIONS
DEFAC (JFN,P2)
INTERN PTRSV,PTRRST
; Parameters
PTR=104 ; Ptr device code
PTRDON==10 ; Done coni/o bit
PTRBSY==20 ; Busy coni/o bit
PTRBIN==40 ; Binary mode coni/o bit
PTREOT==400 ; End of tape coni bit
DEFINE PTRPIF <
NOSKED
CHNOFF PTRCHN>
DEFINE PTRPIN <
CHNON PTRCHN
OKSKED>
; Flags in ptrsts and ios
FLG(ALTP,L,IOS,400000) ; Buffer 2 for prog
FLG(ALTI,L,IOS,200000) ; Buffer 2 for int
FLG(OPN,L,IOS,040000) ; Ptr is open
FLG(IMAGE,L,IOS,020000) ; Ptr operating in image mode (10)
FLG(PTRBI,L,IOS,010000) ; Ptr operating in binary mode (14)
FLG(PTRIB,L,IOS,004000) ; Ptr operation in image binary mode (13)
FLG(STOP,L,IOS,002000) ; Don't do datai next int
FLG(FIRST,L,IOS,001000) ; First word of binary block
FLG(EOTF,L,IOS,000400) ; End of tape seen -- eof
FLG(BUFEMP,L,IOS,000200) ; BUFFER ALREADY GIVEN TO I-LEVEL
; Initialize ptr
; Call: CALL PTRINI
; Returns
; +1 ; Always (used at system initialization time)
RESCD
PTRINI::CONO PTR,0
SETZM PTRSTS
SETOM PTRLCK
SETOM PTRCNT
RET
PTRRST: SKIPL PTRCNT
CONO PTR,PTRDON+PTRCHN
RET
SWAPCD
; Ptr dispatch table
PTRDTB::DTBBAD(DESX9) ; Set directory
DTBBAD(DESX9) ; Name lookup
DTBBAD(DESX9) ; Extension lookup
DTBBAD(DESX9) ; Version lookup
DTBBAD(DESX9) ; Protection insertion
DTBBAD(DESX9) ; Account insertion
DTBBAD(DESX9) ; Status insertion
DTBDSP(PTROPN) ; Open
DTBDSP(PTRSQI) ; Input
DTBBAD(DESX9) ; Output
DTBDSP(PTRCLZ) ; Close
DTBBAD(DESX9) ; Rename
DTBBAD(DESX9) ; Delete
DTBBAD(DUMPX6) ;DUMPI
DTBBAD(DUMPX6) ;DUMPO
DTBBAD(DESX9) ; Mount
DTBBAD(DESX9) ; Dismount
DTBBAD(DESX9) ; Init directory
DTBBAD(MTOX1) ; MTOPR
DTBBAD(DESX9) ; Get status
DTBBAD(DESX9) ; Set status
DTBDSP(RSKP) ; RECORD OUT
DTBDSP(RFTADN) ; READ TAD
DTBDSP(SFTADN) ; SET TAD
DTBDSP (BIOINP) ;SET JFN FOR INPUT
DTBDSP (BIOOUT) ;SET JFN FOR OUTPUT
DTBBAD (GJFX49) ;CHECK ATTRIBUTE
DTBLEN==:.-PTRDTB ;GLOBAL LENGTH OF DISPATCH TABLE
; Open ptr
; Call: JFN ; The job file number
; CALL PTROPN
; Return
; +1 ; Error, error number in 1
; +2 ; Success
PTROPN: LOCK PTRLCK,<CALL LCKTST> ; Lock up this routine
MOVE IOS,PTRSTS
TQNE <READF> ;MUST WANT READ,
TQNE <WRTF> ; BUT NOT WRITE
JRST [ UNLOCK PTRLCK ;OTHERWISE LOSE
MOVEI A,OPNX13 ;PTR DOESN'T OPEN THAT WAY
RETBAD()]
CONSO PTR,PTREOT ; Any tape in reader?
JRST [ UNLOCK PTRLCK ; No, fail
MOVEI A,OPNX8
RET]
TQOE <OPN> ; Set open bit, already open?
JRST [ UNLOCK PTRLCK ; Yes, give busy error
MOVEI A,OPNX9
RET]
TXZ IOS,ALTP!ALTI!IMAGE!PTRIB!PTRBI!STOP!FIRST
TXO IOS,BUFEMP
LDB A,[POINT 4,STS,35] ; Get mode
JUMPE A,[LDB A,PBYTSZ ; Mode 0, default format by byte size
CAIN A,8
TQO <IMAGE>
CAIN A,^D36
TQO <PTRBI,FIRST>
JRST PTROP1]
CAIN A,14 ; Binary?
TQO <PTRBI,FIRST> ; Yes, set binary and first flags
CAIN A,13 ; Image binary?
TQO <PTRIB> ; Yes, set image binary flag
CAIN A,10 ; Image?
TQO <IMAGE> ; Yes, set image flag
;..
PTROP1: MOVEI A,7 ; Store 7 bit bytes
TQNE <IMAGE> ; Unless image mode,
MOVEI A,8 ; Then store 8 bit bytes
TQNE <PTRBI,PTRIB> ; Unless binary or image binary
MOVEI A,44 ; Then 36 bit bytes
IORI A,4400
DPB A,[POINT 12,PTRPTR,11]
MOVEM IOS,PTRSTS
SETOM PTRCNT ; Zero full buffers
MOVEI A,5*<PTRBFZ-1> ; Character count
TQNE <IMAGE>
MOVEI A,4*<PTRBFZ-1> ; Unless image mode
TQNE <PTRBI,PTRIB>
MOVEI A,PTRBFZ-1 ; Unless binary mode
MOVEM A,PTRITC
MOVEI A,PTRBF1
TQNN <PTRBI>
MOVEI A,PTRBF1+1
HRRM A,PTRPTR
SETZM PTRCHC
SETZM PTRBF1 ;ZERO THE BUFFERS
MOVE A,[XWD PTRBF1,PTRBF1+1] ;SETUP BLT WORD
BLT A,PTRBF1+PTRBFZ-1 ;DO IT
SETZM PTRBF2 ;
MOVE A,[XWD PTRBF2,PTRBF2+1]
BLT A,PTRBF2+PTRBFZ-1 ;DO IT AGAIN
MOVEI A,PTRCHN
TQNE <PTRBI,PTRIB>
MOVEI A,PTRBIN(A)
CONO PTR,PTRBSY(A) ; Set busy and let it go
UNLOCK PTRLCK
SETZM FILLEN(JFN)
SETZM FILCNT(JFN)
RETSKP
; Ptr close
; Call: JFN ; Jfn
; CALL PTRCLZ
PTRCLZ: CALL PTRINI
RETSKP
; Ptr sequential input
; Call: JFN ; Jfn
; CALL PTRSQI
; Returns
; +1 ; Always, byte in a, sets eof if no more input
PTRSQI: MOVE IOS,PTRSTS
SKIPE FILCNT(JFN) ;SPACE IN BUFFER?
JRST PTRSQ1 ;YES, USE IT
CALL BUFDMP ;NO, DUMP BUFFER
SKIPGE PTRCNT ;IS THERE ANOTHER BUFFER FOR US YES?
JRST PTRWAT ;NO
MOVX IOS,BUFEMP
ANDCAB IOS,PTRSTS ;BUFFER NEEDS EMPTYING
MOVEI A,PTRBF1
TQNE <ALTP>
MOVEI A,PTRBF2
HRRZ B,(A) ; Get count
JUMPE B,PTRSQI ; Empty buffer, ignore it
PUSH P,B ; Save
HRRM A,FILBYT(JFN) ; Point byte pointer to the buffer
MOVEI C,0
DPB C,PBYTPO
MOVEI C,5 ; Number of bytes per word in ascii
TQNE <IMAGE>
MOVEI C,4 ; In image
TQNE <PTRBI,PTRIB>
MOVEI C,1
LDB B,PBYTSZ ; Users byte size
MOVEI A,^D36
IDIV A,B ; Bytes per word for user
POP P,B
IMUL A,B
IDIV A,C
MOVEM A,FILCNT(JFN)
ADDM A,FILLEN(JFN)
PTRSQ1: TQNE <EOFF>
RET
ILDB A,FILBYT(JFN) ;YES, STORE THE CHARACTER
SOSLE FILCNT(JFN) ;FINISH BUFFER?
RET ;NO, THEN RETURN
BUFDMP: TXNE IOS,BUFEMP ; BUFFER ALREADY DUMPED?
RET ; YES, LEAVE
SOSN PTRCNT ;GIVE BUFFER TO I-LEVEL
CALL PTRSTR ;START IF NECESSARY
MOVX IOS,ALTP ;SWITCH BUFFERS
XORB IOS,PTRSTS
MOVX IOS,BUFEMP
IORB IOS,PTRSTS
RET
PTRWAT: TQNE <EOTF> ;END OF TAPE?
JRST [ TQO <EOFF> ;YES, THERE WILL BE NO MORE BUFFERS
RET]
MOVE A,[XWD PTRCNT,DISGET] ;SET UP TO BLOCK
TQO <BLKF> ;MARK THAT A BLOCK IS TO BE DONE
RET ;LET BOUT ROUTINE BLOCK AFTER UNLOCKING
RESCD
PTRSTR: PUSH P,A
TQNN <PTRIB,PTRBI>
TDZA A,A
MOVEI A,PTRBIN
PTRPIF ; PREVENT PTR INTERRUPTS
MOVE IOS,PTRSTS ; SO THAT STATE DOESN'T CHANGE
TXZN IOS,STOP ; STOPPING?
CONO PTR,PTRDON!PTRCHN(A) ; NO--STOPPED. RESTART
MOVEM IOS,PTRSTS ; NEW STATE
PTRPIN
POP P,A
RET
; Ptr interrupt service routine
PTRSV: CONSZ PTR,7
CONSO PTR,PTRDON
RET
MOVEM IOS,PTRSIO ; Save ios
MOVE IOS,PTRSTS
TQZE <STOP>
JRST [ CONO PTR,0
JRST PTRXIT]
CONSO PTR,PTREOT
JRST PTROFF ; End of tape
DATAI PTR,A ; Read the character
TQZE <FIRST>
JRST [ HRRZI B,(A) ; Get word conut
CAILE B,PTRBFZ-1 ; Too big?
HRRI A,PTRBFZ-1 ; Make it max
MOVEI B,1(A)
MOVEM B,PTRITC
JRST .+1]
TXNN IOS,IMAGE!PTRBI!PTRIB
JRST [ ANDI A,177 ; Ascii
JUMPE A,PTRXIT
CAIN A,177
JRST PTRXIT
JRST .+1]
IDPB A,PTRPTR
AOS B,PTRCHC
SOSLE PTRITC
JRST PTRXIT
PTRIN: MOVEI A,PTRBF1
TQCE <ALTI>
MOVEI A,PTRBF2
TQZN <FIRST>
TQNN <PTRBI>
HRRZM B,(A)
MOVEI A,PTRBF1
TQNE <ALTI>
MOVEI A,PTRBF2
SETZM PTRCHC
TQNN <PTRBI>
AOS A
HRRM A,PTRPTR
MOVEI A,44
DPB A,[POINT 6,PTRPTR,5]
MOVEI A,5*<PTRBFZ-1>
TQNE <IMAGE>
MOVEI A,4*<PTRBFZ-1>
TQNE <PTRIB,PTRBI>
MOVEI A,PTRBFZ-1
MOVEM A,PTRITC
TQNE <PTRBI>
TQO <FIRST>
AOSLE PTRCNT
TQO <STOP>
PTRXIT: MOVEM IOS,PTRSTS
MOVE IOS,PTRSIO
JRST PTRCHR
PTROFF: MOVE B,PTRCHC
TQO <EOTF>
CONO PTR,0
JRST PTRIN
TNXEND
END