Trailing-Edge
-
PDP-10 Archives
-
decus_20tap2_198111
-
decus/20-0038/magtap.doc
There are 2 other files named magtap.doc in the archive. Click here to see a list.
1
/*****PROGRAM MAGTAP.PAL, 1969*****
/HOWARD SHAPIRO* AND PETER LEMKIN**
/
/
/ **NATIONAL INSTITUTES OF HEALTH
/ BETHESDA, MD. 20014
/
/
/SUBMITTED BY PETER LEMKIN
/
/
/INTRODUCTION:
/-------------
/AN INPUT/OUTPUT DEVICE HANDLER IS GIVEN BELOW FOR THE
/TU20/TC58 MAGNETIC TAPE DRIVE AND CONTROLLER FOR THE PDP8.
/IT ENABLES THE READING, WRITING, READ-COMPARING, ADVANCING AND
/BACKSPACING RECORDS, AND WRINTING END OF FILES. IT ALSO LETS
/THE PROGRAMMER INTERROGATE THE MAGTAPE CONTROLLER ABOUT THE STATUS
/OF THE DRIVE/CONTROLLER . THE MAGTAPE ROUTINE WAS ORIGINALLY WRITTEN
/BY HOWARD SHAPIRO AND LATER MODIFIED FOR INTER FIELD OPERATION BY
/PETER LEMKIN.
/
/
/
/DESCRIPTION:
/--------------
/THE MAGTAPE INPUT/OUTPUT HANDLER SUBROUTINE FOR THE
/TC58 AND TU20 ON A PDP8 WAS ORIGINALLY
/WRITTEN BY HOWARD SHAPIRO AND MODIFIED BY
/P. LEMKIN. THE HANDLER ENABLES THE USER TO READ, WRITE
/READ-COMPARE, SPACE BACKWARD OR FORWARD, REWIND , OR
/WRITE END OF FILE. IT IS ASSEMBLED UNDER PAL10 OR PAL8.
/THE CALLING SEQUENCE IS:
/ JMS MAGTAP
/ N1 /OR # OF WORDS IN READ/WRITE, # RECORDS IN SPACING.
/ N2 /STARTING CORE ADDRESS FOR READ/WRITE
/ N3 /COMMAND....SEE TABLE BELOW
/ N4 /DATA FIELD FOR READ/WRITE 00, 10, OR 20. ETC.
/ NORMAL RETURN
/
/::::::COMMAND TABLE::::::
/ NOP 00
/ REWIND 10
/ READ 20
/ READ-COMPARE 30
/ WRITE 40
/ WRITE END FILE 50
/ SPACE FORWARD 60
/ SPACE BACKWARD 70
/
/
/COMMAND WORD DEFINITIONS:
/------------------------------
/THE COMMAND WORD SPECIFIES WHAT TYPE OF DRIVE AND TAPE FORMAT
/IS TO BE USED IN THE TAPE INSTRUCTIONS. THE FOLLOWING WILL
2
/ALLOW THE USER TO CONFIGURE THE HANDLER FOR HIS DRIVE.
/SEE THE SMALL COMPUTER HANDBOOK (DEC) 1970 FOR SPECIFICS PP 118,119.
/CURRENTLY THE HANDLER IS CONFIGURED FOR A 9 TRACK, ODD PARITY, 800BPI
/CORE DUMP MODE, UNIT 0, INTERRUPT DRIVEN HANDLER.
/
0003 DENSTY=3 /800=3
0200 CORDMP=200 /0 IF NO COREDUMP
0004 ENBINT=4 /ENABLE INTERRUPT. 0 IF DISABLED.
0400 PARITY=400 /0 IF EVEN, 400 IF ODD.
0000 EXTGAP=0 /100 IF EXTENDED GAP, 0 IF NONE.
0000 UNIT=0 /0 TO 7000 , UNIT #
0001 RINTSO=1 /RUN WITH INTERRUPTS OFF=0, IF ON=1.
/
/THE COMMAND WORD IS THEN CONSTRUCTED.
/
0607 CMDWRD=UNIT+PARITY+CORDMP+EXTGAP+ENBINT+DENSTY
/
/
/
/
/OPERATING INFORMATION:
/-----------------------
/THE USER MUST SUPPLY HIS OWN INTERRUPT ROUTINE IN ORDER
/TO OPERATE WITH THIS PACKAGE IF USED WITH INTERRUPT MODE.
/THIS ROUTINE SHOULD GENERATE A JMS TO SUBROUTINE TINT UPON
/DETECTION OF AN INTERRUPT FROM THE TAPE UNIT VIA THE
/MTSF=6701 INSTRUCTION ( SKIP ON TAPE INTERRUPT).
/ THERE ARE 5 ROUTINES OF INTERREST:
/1. SUBROUTINE MAGTAP IS USED TO DO I/O.
/2. SUBROUTINE TNTX IS USED TO TEST THE TAPE STATUS
/ AFTER AN INTERRUPT.
/3. SUBROUTINE TINT IS USED TO SERVICE AN INTERRUPT
/4. SUBROUTINE WTRDY IS USED TO WAIT UNTIL THE
/ TAPE UNIT IS READY.
/5. SUBROUTINE GOTAPE IS USED BY MAGTAP TO EXECUTE THE TAPE COMMAND.
/
/&
6711 MTCR=6711
6701 MTSF=6701
6721 MTTR=6721
6712 MTAF=6712
6716 MTLC=6716
6722 MTGO=6722
6706 MTRS=6706
/
0200 0000 MAGTAP, 0 /9 TRACK TAPE ROUTINE
0201 7200 CLA
0202 6214 RDF
0203 1235 TAD LCIF
0204 3232 DCA LLX
0205 4236 JMS WTRDY /WAIT READY
0206 7200 CLA /TRANSMIT N1
0207 1600 TAD I MAGTAP
0210 7041 CIA
0211 3700 DCA I WCLOC
3
0212 2200 ISZ MAGTAP
0213 7240 STA /TRANSMITT N2
0214 1600 TAD I MAGTAP
0215 3701 DCA I CALOC
0216 2200 ISZ MAGTAP
0217 1600 TAD I MAGTAP /FORM COMMAND WITH N3
0220 1234 TAD CCMD /GET MASK
0221 3227 DCA TN1 /SAVE COMMAND
0222 2200 ISZ MAGTAP
0223 1600 TAD I MAGTAP /GET N4 THE BUFFER FIELD
0224 3230 DCA TN2
0225 6201 CDF 00
0226 4252 JMS GOTAPE /EXECUTE
0227 0000 TN1, 0
0230 0000 TN2, 0 /DATA FIELD ARG FOR GOTAPE
IFZERO RINTSO </RUN WITH INTERRUPTS OFF
JMS WTRDY /WAIT FOR THE TAPE TO FINISH
JMS TINT /FAKE SERVICING IT.
>
0231 2200 ISZ MAGTAP
0232 6202 LLX, CIF 00
0233 5600 JMP I MAGTAP /RETURN
0234 0607 CCMD, CMDWRD / COMMAND MASK
0235 6202 LCIF, CIF 00
/
/
/
/
/SUBROUTINE WTRDY
/IS USED TO WAIT UNTIL THE MAGTAPE IS READY.
/CALLING SEQUENCE:
/ JMS WTRDY
/ NORMAL RETURN /TAPE UNIT READY
/&
0236 0000 WTRDY, 0 /WAIT TAPE READY
0237 7200 CLA
0240 6214 RDF
0241 1235 TAD LCIF
0242 3250 DCA WT1
0243 6201 CDF 00
0244 6711 WTLP2, MTCR /IS THE CONTROL READY?
0245 5244 JMP WTLP2 /NO
0246 6721 MTTR /IS THE DRIVE READY?
0247 5244 JMP WTLP2 /NO
/YES TO BOTH******
0250 6202 WT1, CIF 00
0251 5636 JMP I WTRDY /RETURN
/
/
/
/
/SUBROUTINE GOTAPE
/IS CALLED BY MAGTAP TO EXECUTE THE TAPE COMMAND.
/CALLING SEQUENCE:
/ JMS GOTAPE
4
/ COMMAND
/ DATA FIELD
/ NORMAL RETURN
/&
0252 0000 GOTAPE, 0 /PERFORM TAPE OPERATION
0253 6712 MTAF /CLEAR TAPE CONTROL REGS
0254 1652 TAD I GOTAPE /GET COMMAND
0255 6716 MTLC /LOAD COMMAND
0256 7200 CLA
0257 2252 ISZ GOTAPE
0260 7200 CLA
0261 1652 TAD I GOTAPE /GET DATA FIELD
IFNZRO RINTSO <
0262 6001 ION /TURN ON INTERRUPT
>
0263 6722 MTGO /GO ALREADY
0264 2252 ISZ GOTAPE
0265 5652 JMP I GOTAPE /RETURN
/
/
/
/SUBROUTINE TINT
/IS USED TO SERVICE THE MAGTAPE INTERRUPT.
/IT SAVES THE STATUS OF THE MAGTAP AT THE TIME OF
/INTERRUPT AND CLEARS THE COMMAND AND INTERRUPT REGISTERS.
/CALLING SEQUENCE:
/ JMS TINT
/ NORMAL RETURN
/
/&
0266 0000 TINT, 0 /TAPE SERVICE ROUTINE CALLED
0267 7300 CLA CLL
0270 6706 TPSRVC, MTRS /GET TAPE STATUS
0271 3276 DCA TSTAT /STATUSS TO TSTAT
0272 6724 6724 /GET COMMAND REG
0273 3277 DCA TCOM /COMMAND TO TCOM
0274 6712 MTAF /CLEAR STATUS AND COMMAND REGS
0275 5666 JMP I TINT /RETURN
0276 0000 TSTAT, 0 /HOLDS LAST STATUS
0277 0000 TCOM, 0 /HOLDS LAST COMMAND
0300 7752 WCLOC, 7752 /WORD COUNT LOCATION
0301 7753 CALOC, 7753 /CURRENT ADDRESS LOCATION
/
/......................................................
/
/
/SUBROUTINE TNTX
/SENSE TAPE CONDITION - THIS ROUTINE IS CALLED BY THE USER
/TO DETECT ERRORS, END OF FILE, BEGINNING OR END OF TAPE. IN
/ORDER FOR IT TO WORK PROPERLY, AN INTERRUPT MUST HAVE OC-
/CURRED AND HAVE BEEN PROCESSED BY TINT. HOWEVER, IF TNTX
/IS CALLED WHILE THE TAPE IS STIILL BUSY, IT WILL WAIT FOR
/TAPE TO BECOME READY, BY WHICH TIME AN INTERRUPT SHOULD
/BE FIELDED.
/CALLING SEQUENCE:
5
/ JMS TNTX
/ N4
/ CONTINUE HERE IF CONDITION HOLDS
/ CONTINUE HEEE IF CONDITION DOES NOT HOLD
/
/ N4 SPECIFIES THE CONDITION SOUGHT AS FOLLOWS:
/ N4 CONDITION
/ --- -----------
/ 0 FLATNESS OF EARTH (NOP)
/ 1 READ OR WRITE ERROR
/ 2 READ-COMPARE ERROR
/ 3 END FILE
/ 4 BEGINNING OF TAPE
/ 5 END OF TAPE
/
/&
0302 0000 TNTX, 0
0303 7200 CLA
0304 6214 RDF
0305 1235 TAD LCIF
0306 3322 DCA TN3 /SAVE RETURN FLD
0307 4236 JMS WTRDY /WAIT TAPE READY
0310 7200 CLA
0311 1702 TAD I TNTX /FORM STATUS MASK ADDRESS
0312 6201 CDF 00
0313 1324 TAD TN4
0314 3325 DCA TN5
0315 2302 ISZ TNTX
0316 1276 TAD TSTAT /GET STATUS
0317 0725 AND I TN5 /AND WITH MASK
0320 7450 SNA /SKIP IF CONDITION HOLDS
0321 2302 ISZ TNTX /FIX RETURN IF CONDITION DOES NOT HOLD
0322 6202 TN3, CIF 00
0323 5702 JMP I TNTX /RETURN
0324 0326 TN4, TCOND /MASK LIST BASE ADDR.
0325 0000 TN5, 0 /A OF MASK USED
0326 0000 TCOND, 0 /MASKS FOR SENSE TAPE CONDIYION
0327 1616 1616 /READ OR WRITE ERROR
0330 1636 1636 /READ-COMPARE ERROR
0331 0100 0100 /EOF
0332 1000 1000 /BOT
0333 0040 0040 /EOT
/HERE ENDETH THE 9 TRACK TAPE PACKAGE
/
/
/............................................
$