Trailing-Edge
-
PDP-10 Archives
-
cust_sup_cusp_bb-x130c-sb
-
10,7/unsmon/ptpser.mac
There are 6 other files named ptpser.mac in the archive. Click here to see a list.
TITLE PTPSER - PAPER TAPE PUNCH SERVICE ROUTINE - V445
SUBTTL /RCC/DAL 21-JUNE-88
SEARCH F,S,DEVPRM
$RELOC
;THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED
; OR COPIED ONLY IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE.
;
;COPYRIGHT (c) DIGITAL EQUIPMENT CORPORATION
; 1973,1974,1975,1976,1977,1978,1979,1980,1982,1984,1986,1988.
;ALL RIGHTS RESERVED.
.CPYRT<1973,1988>
XP VPTPSR,445 ;DEFINE GLOBAL VERSION NUMBER FOR LOADER MAP
PTPSER::ENTRY PTPSER
;PARAMETER ASSIGNMENTS
;PTP CONTROL REGISTER
PTPDON==10 ;DONE
PTPNTP==100 ;OUT OF TAPE
PTPFDN==200 ;FORMAT CONTROL
;SPECIAL IO STATUS WORD ASSIGNMENTS
IODISC==400000
PTPFED==200000
PTPEOL==20000
PTPBIN==4000 ;CHECKSUM BINARY
PTPIB==2000 ;IMAGE BINARY
;SPECIAL ASCII CHARACTERS (DEFINED WITH THE CORRECT PARITY)
HORTAB==11
FORMFD==14
VERTAB==213
RUBOUT==377
SUBTTL AUTOCONFIGURE
;DRIVER CHARARCTERISTICS
; PTP = PTPCNF
; PTP = PAPER TAPE PUNCH
; 7 = MAXIMUM DEVICES IN SYSTEM
; 0 = KONTROLLER TYPE
; 0 = MAXIMUM DRIVES PER KONTROLLER
; 0 = HIGHEST DRIVE NUMBER ON KONTROLLER
; MDSEC0 = SECTION FOR KDB/UDB
; MDSEC0 = SECTION FOR DDB
DRVCHR (PTP,PTP,7,0,0,0,MDSEC0,MDSEC0,<DR.GCC!DR.NET>)
.ORG DEVLEN
PTPCSO:! BLOCK 1 ;ADDRESS OF INTERRUPT CODE
PTPCNT:! BLOCK 1 ;BYTE COUNT
PTPCHA:! BLOCK 1 ;TEMPORARY LOCATION TO STORE CHARACTER
PTPIOB:! ;START OF I/O INSTRUCTIONS
PTPCNI:! BLOCK 1 ;CONI
PTPCNO:! BLOCK 1 ;CONO
PTPDTO:! BLOCK 1 ;DATAO
PTPIOE:! ;END OF I/O INSTRUCTIONS
PTPLEN:! ;LENGTH OF PTP DDB
.ORG
$LOW
PTPDDB: DDBBEG (PTP,PTPLEN)
SETWRD (DEVCHR,<4*HUNGST,,PTPSIZ##>) ;DEVCHR
SETWRD (DEVSER,<MCSEC0+PTPDSP>) ;DEVSER
SETWRD (DEVMOD,<DVOUT!DVPTP,,14403>) ;DEVMOD
SETWRD (DEVTYP,<<.TYPTP*.TYEST>!.SPPTP!DEPLEN,,0>) ;DEVTYP
SETWRD (DEVCPU,<PTPCHN##>) ;DEVCPU
SETWRD (PTPCNI,<CONI 000,T1>) ;CONI
SETWRD (PTPCNO,<CONO 000,(U)>) ;CONO
SETWRD (PTPDTO,<DATAO 000,T1>) ;DATAO
DDBEND
$HIGH
;CONSO SKIP CHAIN CODE (AUTCON WILL FILL IN THE BLANKS)
PTPICD: PHASE 0
CONSO 000,0 ;(00) SKIP IF INTERRUPT FOR THIS LPT
JRST .-1 ;(01) GO TO NEXT SKIP CHAIN ELEMENT
JSR PIERR## ;(02) SAVE ACS AND SETUP PDL
SKIPA F,.+1 ;(03) SET UP DDB ADDRESS
EXP 0 ;(04) DDB ADDRESS
XJRST .+1 ;(05) CALL INTERRUPT HANDLER
EXP 0 ;(06) INTERRUPT HANDLER ADDRESS
DEPHASE
PTPICL==.-PTPICD ;LENGTH OF CONSO SKIP CHAIN CODE
EQUATE (LOCAL,0,<PTPCKT,PTPKDB,PTPKLN,PTPUDB,PTPULN>)
EQUATE (LOCAL,0,<PTPULB,PTPULP>)
PPXDSP: DRVDSP (PTP,PTPCHN##,PTPDDB,PTPLEN,URDDIA##)
;DEFAULT MONGEN'ED DEVICE TABLE
DEFMDT: MDKL10 (7,100,0,0,<MD.KON>) ;DEVICE CODE 100
EXP 0
PTPCFG: XMOVEI T1,PTPMDT## ;MONGEN'ED DEVICE TABLE
XMOVEI T2,DEFMDT ;DEFAULT TABLE
MOVNI T3,1 ;NO MASSBUS UNIT OR DRIVE INFORMATION
MOVEI T4,MD.KON ;MATCH ON KONTROLLER DEFINITION
PUSHJ P,AUTMDT## ;SCAN THE TABLES
JRST CPOPJ1## ;NO MATCHES
PUSH P,T1 ;SAVE MDT DATA
MOVEI T1,PTPIOB ;WORD CONTAINING AN I/O INSTRUCTION
PUSHJ P,AUTFND## ;SEE IF THERE'S ALREADY A DDB
JRST PTPCF1 ;JUST MAKE SURE THE NUMBERS ARE OK
PUSHJ P,AUTADN## ;ALLOCATE A DEVICE NUMBER
HRLI T1,'PTP' ;INCLUDE GENERIC DEVICE NAME
SETZ T2, ;LOCAL DEVICE
PUSHJ P,AUTDDB## ;CREATE A DDB
JRST [POP P,T1 ;NO CORE
PJRST AUTDDN##] ;DEALLOCATE DEVICE NUMBER
PTPCF1: MOVSI T1,-<PTPIOE-PTPIOB> ;-LENGTH
XMOVEI T2,PTPIOB(F) ;STARTING ADDRESS
HRRZ T3,.CPDVC## ;DEVICE CODE
PUSHJ P,AUTDVC## ;FILL IN DEVICE CODES
SKIPE PTPCSO(F) ;BEEN HERE BEFORE?
JRST PTPCF3 ;THEN DON'T MESS WITH THE SKIP CHAIN
MOVE T1,F ;DATA BLOCK ADDRESS
XMOVEI T2,PTPINT ;INTERRUPT SERVICE
PUSHJ P,AUTICD## ;GENERATE INTERRUPT ROUTINES
SKIPA T2,F ;NO CORE
JRST PTPCF2 ;ONWARD
MOVEI T1,PTPLEN ;DDB ADDRESS
PUSHJ P,AUTKIL## ;DELETE THE DDB
PUSHJ P,AUTDDN## ;DEALLOCATE DEVICE NUMBER
JRST TPOPJ## ;PHASE STACK AND RETURN
PTPCF2: MOVEM T1,PTPCSO(F) ;SAVE ADDRESS
MOVEI T2,PTPCHN## ;PI CHANNEL
PUSHJ P,AUTCSO## ;LINK INTO CONSO SKIP CHAIN
PTPCF3: POP P,T1 ;RESTORE MDT DATA
POPJ P, ;ALL DONE
;PTP SERVICE DISPATCH TABLE
JRST CPOPJ1## ;IF YOU'RE ASKING, IT'S ONLINE
JRST ECOD2## ;SPECIAL ERROR STATUS
JRST REGSIZ## ;BUFFER LEN CAN BE GOTTEN FROM DDB
JRST PTPINI ;INITILIZE
JRST PTPREL ;HUNG DEVICE TIME-OUT ERROR.
PTPDSP: JRST PTPREL ;RELEASE
JRST PTPCLS ;CLOSE
JRST PTPOUT ;OUTPUT
JRST ILLINP## ;INPUT
PTPINI: MOVEI T1,PTPDDB ;ADDRESS OF PROTOTYPE
CAIN T1,(F) ;IF FIRST CALL,
JRST CPOPJ1## ;HOLD OUT FOR A REAL DEVICE
AOS (P) ;DO THE CONO EACH TIME
PTPREL: PUSH P,U ;SAVE U
SETZ U, ;NO BITS
XCT PTPCNO(F) ;TURN PUNCH OFF
HLLZS @PTPCSO(F) ;CLEAR CONSO FLAG BITS
JRST UPOPJ## ;RESTORE U AND RETURN
PTPCLS: PUSHJ P,OUT## ;OUTPUT REMAINING BUFFERS
PUSHJ P,WAIT1## ;WAIT FOR IOACT=0.
MOVE S,DEVIOS(F) ;C(S):=C(PTPIOS)
TLO S,IODISC+PTPFED+IOW ;IODISC:=IOW:=PTPFED:=1
PUSHJ P,SETACT## ;SET ACTIVE FLAG,STORE S,AND
;RESET HUNG DEVICE TIMEOUT COUNT
MOVEI T1,200
MOVEM T1,PTPCNT(F) ;PTPCNT:=200
MOVEI U,PTPDON ;SET CONSO FLAG
HRRM U,@PTPCSO(F)
ADDI U,PTPCHN## ;INCLUDE PI CHANNEL
XCT PTPCNO(F) ;SET DONE FLAG
JRST WAIT1## ;WAIT FOR IOACT=0, ALL BUFFERS FINISHED
PTPOUT: XCT PTPCNI(F) ;READ STATUS
TRNN T1,PTPNTP ;OUT OF TAPE?
JRST PTPIN0 ;NO, ENTER SERVICE
MOVEM T1,DEVSTS(F) ;SAVE STATUS
PUSHJ P,HNGSTP## ;ISSUE "DEVICE PTP OK?"
JRST PTPOUT ;TRY AGAIN WHEN "CONT" TYPED
PTPIN0: TLZE S,IOBEG ;VIRGIN DEVICE? (IOBEG:=0)
JRST PTPIN2 ;YES
PTPIN1: TLZ S,IODISC ;CLEAR DISCONNECT BIT
PUSHJ P,SETACT## ;SET ACTIVE FLAG,STORE S, AND
;RESET HUNG DEVICE TIMEOUT COUNT
MOVE U,[PTPDON,,PTPDON+PTPCHN##] ;CONSO FLAGS + PI CHANNEL
CONO PI,PI.OFF
XCT PTPCNO(F)
HLRM U,@PTPCSO(F)
CONO PI,PI.ON
POPJ P, ;RETURN
PTPIN2: LDB T1,PIOMOD##
TLO S,IOFST+PTPFED+IO ;IOFST:=PTPFED:=IO:=1
TLZ S,PTPBIN+PTPIB ;CLEAR BINARY AND IMAGE BINARY BITS
CAIN T1,IB ;IMAGE BINARY?
TLO S,PTPIB ;YES
CAIN T1,B ;MODE=BINARY?
TLO S,PTPBIN ;YES, PTPBIN:=1
MOVEI T1,PTPFDN ;PTPCNT:=PTPFDN
MOVEM T1,PTPCNT(F)
PUSHJ P,SETBYT## ;SETBYT
HLLM T1,DEVPTR(F) ;DEVPTR0-5:=DEVPTR12-13:=0,DEVPTR6-11:=BYTE
;SIZE;
JRST PTPIN1
;PUNCH INTERRUPT SERVICE
PTPINT: XCT PTPCNI(F) ;READ STATUS
MOVEM T1,DEVSTS(F) ;SAVE IT
TRNE T1,PTPNTP ;OUT OF TAPE?
JRST NOTAPE ;YES - GO HANDLE IT
MOVE S,DEVIOS(F) ;S:=C(PTPIOS)
TLNE S,PTPFED ;FEED REQUEST? (PTPFED=1?)
JRST PTPS2 ;YES
PUSHJ P,IOSET## ;J=C(DEVCTR)
;S:=C(PTRIOS)
TLZE S,IODISC ;DISCONNECT? (IODISC=1?)
JRST PTPADV ;YES
TLZE S,IOFST ;IOFST=1? IOFST:=0
JRST PTP9 ;YES
TLNN S,PTPBIN+PTPIB ;BINARY PUNCH MODE?
JRST PTP3 ;NO
MOVE T1,PTPCHA(F) ;BINARY OUTPUT BYTE SIZE=36
ROT T1,6
MOVEM T1,PTPCHA(F)
ANDI T1,77 ;T1:=XX, SIXBIT SUB-BYTE
ADDI T1,200
XCT PTPDTO(F) ;PUNCH 2XX
SOSL PTPCNT(F) ;C(PTPCNT):=C(PTPCNT)-1. WORD DONE?
JRST STOIOS## ;NO
SOSL DEVCTR(F) ;C(DEVCTR):=C(DEVCTR)-1. J COUNT .LT. 0?
JRST PTPB1 ;NO
TLNE S,PTPIB ;IMAGE BINARY?
TLOA S,IODISC ;YES, SUPPRESS TAPE FEED.
TLO S,IODISC+PTPFED ;IODISC:=PTPFED:=1
MOVEI T1,10
MOVEM T1,PTPCNT(F) ;PTPCNT:=10
JRST STOIOS##
PTPB1: MOVEI T1,5 ;PTPCNT:=5
MOVEM T1,PTPCNT(F)
MOVE U,@DEVPTR(F) ;PTPCHA:=OUTPUT DATA WORD
AOS DEVPTR(F) ;DEVPTR:=C(DEVPTR)+1. ADVANCE J POINTER.
MOVEM U,PTPCHA(F)
JRST STOIOS##
PTP3: MOVE T1,PTPCHA(F) ;GET CHARACTER
XCT PTPDTO(F) ;DATAO DEV,T1
TRNE S,14 ;IS MODE AN ALPHA MODE
JRST PTP1 ;NO
MOVE U,PTPCHA(F)
CAIE U,HORTAB ;HORIZONTAL OR VERTICAL TAB?
CAIN U,VERTAB
JRST PTPP1 ;YES
CAIE U,FORMFD ;FORM FEED?
JRST PTP1 ;NO
TLO S,PTPFED+PTPEOL ;PTPFED:=PTPEOL:=1
MOVEI U,20
MOVEM U,PTPCNT(F) ;PTPCNT:=20
JRST STOIOS##
PTP1: SOSGE DEVCTR(F) ;C(DEVCTR):=C(DEVCTR)-1. IS C(DEVCTR) .LT. 0?
JRST PTP5 ;YES
ILDB T3,DEVPTR(F) ;T3:=OUTPUT J
LDB T1,PIOMOD##
CAIN T1,I ;MODE=IMAGE?
JRST PTP6 ;YES
IORI T3,200 ;NO, INSERT EIGHTH HOLE
TRNN T1,14 ;AN ASCII MODE?
PUSHJ P,PEVEN8## ;YES. TURN EIGHTH HOLE OFF IF
; APPROPRIATE TO GET EVEN PARITY
JUMPE T3,PTP1 ;IF AN ASCII NULL, IGNORE IT.
; THEY ARE PUT IN BY PTPFED STUFF
; ELSE FALL INTO PTP6
PTP6: MOVEM T3,PTPCHA(F) ;PTPCHA:=OUTPUT J
JRST STOIOS##
PTPS2: SETZB T1,PTPCHA(F) ;FEED CHARACTER
XCT PTPDTO(F) ;DATAO DEV,T1
SOSG PTPCNT(F) ;COUNT FEED LINES
TLZ S,PTPFED ;PTPFED:=0
MOVEM S,DEVIOS(F) ;PTPIOS:=C(S)
POPJ P, ;RETURN
PTP5: TLO S,IODISC ;IODISC:=1
JRST STOIOS##
PTPBN: MOVEI T2,@DEVOAD(F) ;T2:=BUFFER ADDRESS
PUSHJ P,CKS12## ;T1:=CALCULATE CHECKSUM
ADD T2,DEVOAD(F)
HLLM T1,@T2 ;STORE CHECKSUM IN LEFT HALF OF FIRST BUFFER DATA WORD.
JRST PTPB1
PTPADV: PUSHJ P,ADVBFE## ;ADVANCE BUFFER
JRST PTPDSC ;EXIT1. NEXT BUFFER EMPTY
PUSHJ P,SETIOD## ;IN A WAIT? IOW:=0
PTP9: TLZ S,IOFST ;IOFST:=0
MOVE T1,DEVOAD(F)
AOS T1
HRRM T1,DEVPTR(F) ;DEVPTR18-35:=C(PTPADR18-35)+1
HRRZ J,@T1 ;J:=WORD COUNT
LDB T2,PTP91 ;PICK UP BYTE SIZE
PUSHJ P,ITMCT1## ;J:=WORD COUNT*[36/BYTE SIZE]
MOVEM J,DEVCTR(F) ;DEVCTR:=C(J)
JUMPE J,PTPADV ;IS J COUNT=0?
TLNE S,PTPBIN ;BINARY PUNCH MODE?
JRST PTPBN ;YES
TLNN S,PTPIB ;IMAGE BINARY?
JRST PTP1
AOS DEVPTR(F) ;YES
SOS DEVCTR(F)
JRST PTPB1
PTP91: POINT 6,DEVPTR(F),11
PTPP1: MOVEI U,RUBOUT ;PTPCHA:=RUBOUT
MOVEM U,PTPCHA(F)
TLO S,PTPEOL ;PTPEOL:=1
JRST STOIOS##
PTPDSC: PUSHJ P,PTPREL ;CLEAR PTP CONTROL REG AND CONSO BITS
TRZ S,IOACT ;IOACT:=0
TLO S,IOFST ;IOFST:=1
;IN A WAIT? IOW:=0
PUSHJ P,SETIOD## ;YES. IOWS:=1
JRST STOIOS## ;STORE S, RESET HUNG TIMEOUT COUNT AND
;DISMISS INTERRUPT
;WHEN END OF TAPE ENCOUNTERED, COME HERE TO FORCE A HUNG DEVICE
NOTAPE: SETZ U, ;NO BITS
XCT PTPCNO(F) ;TURN OFF PTP-RESTART NOT ALLOWED
POPJ P, ;DISMISS INTERRUPT-BUT NO MORE
;TO BE RECEIVED SINCE PTP NOW OFF
END