Trailing-Edge
-
PDP-10 Archives
-
decus_20tap2_198111
-
decus/20-0038/magtap.pal
There are 2 other files named magtap.pal in the archive. Click here to see a list.
/*****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
/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.
/
DENSTY=3 /800=3
CORDMP=200 /0 IF NO COREDUMP
ENBINT=4 /ENABLE INTERRUPT. 0 IF DISABLED.
PARITY=400 /0 IF EVEN, 400 IF ODD.
EXTGAP=0 /100 IF EXTENDED GAP, 0 IF NONE.
UNIT=0 /0 TO 7000 , UNIT #
RINTSO=1 /RUN WITH INTERRUPTS OFF=0, IF ON=1.
/
/THE COMMAND WORD IS THEN CONSTRUCTED.
/
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.
/
/&
MTCR=6711
MTSF=6701
MTTR=6721
MTAF=6712
MTLC=6716
MTGO=6722
MTRS=6706
/
MAGTAP, 0 /9 TRACK TAPE ROUTINE
CLA
RDF
TAD LCIF
DCA LLX
JMS WTRDY /WAIT READY
CLA /TRANSMIT N1
TAD I MAGTAP
CIA
DCA I WCLOC
ISZ MAGTAP
STA /TRANSMITT N2
TAD I MAGTAP
DCA I CALOC
ISZ MAGTAP
TAD I MAGTAP /FORM COMMAND WITH N3
TAD CCMD /GET MASK
DCA TN1 /SAVE COMMAND
ISZ MAGTAP
TAD I MAGTAP /GET N4 THE BUFFER FIELD
DCA TN2
CDF 00
JMS GOTAPE /EXECUTE
TN1, 0
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.
>
ISZ MAGTAP
LLX, CIF 00
JMP I MAGTAP /RETURN
CCMD, CMDWRD / COMMAND MASK
LCIF, CIF 00
/
/
/
/
/SUBROUTINE WTRDY
/IS USED TO WAIT UNTIL THE MAGTAPE IS READY.
/CALLING SEQUENCE:
/ JMS WTRDY
/ NORMAL RETURN /TAPE UNIT READY
/&
WTRDY, 0 /WAIT TAPE READY
CLA
RDF
TAD LCIF
DCA WT1
CDF 00
WTLP2, MTCR /IS THE CONTROL READY?
JMP WTLP2 /NO
MTTR /IS THE DRIVE READY?
JMP WTLP2 /NO
/YES TO BOTH******
WT1, CIF 00
JMP I WTRDY /RETURN
/
/
/
/
/SUBROUTINE GOTAPE
/IS CALLED BY MAGTAP TO EXECUTE THE TAPE COMMAND.
/CALLING SEQUENCE:
/ JMS GOTAPE
/ COMMAND
/ DATA FIELD
/ NORMAL RETURN
/&
GOTAPE, 0 /PERFORM TAPE OPERATION
MTAF /CLEAR TAPE CONTROL REGS
TAD I GOTAPE /GET COMMAND
MTLC /LOAD COMMAND
CLA
ISZ GOTAPE
CLA
TAD I GOTAPE /GET DATA FIELD
IFNZRO RINTSO <
ION /TURN ON INTERRUPT
>
MTGO /GO ALREADY
ISZ GOTAPE
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
/
/&
TINT, 0 /TAPE SERVICE ROUTINE CALLED
CLA CLL
TPSRVC, MTRS /GET TAPE STATUS
DCA TSTAT /STATUSS TO TSTAT
6724 /GET COMMAND REG
DCA TCOM /COMMAND TO TCOM
MTAF /CLEAR STATUS AND COMMAND REGS
JMP I TINT /RETURN
TSTAT, 0 /HOLDS LAST STATUS
TCOM, 0 /HOLDS LAST COMMAND
WCLOC, 7752 /WORD COUNT LOCATION
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:
/ 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
/
/&
TNTX, 0
CLA
RDF
TAD LCIF
DCA TN3 /SAVE RETURN FLD
JMS WTRDY /WAIT TAPE READY
CLA
TAD I TNTX /FORM STATUS MASK ADDRESS
CDF 00
TAD TN4
DCA TN5
ISZ TNTX
TAD TSTAT /GET STATUS
AND I TN5 /AND WITH MASK
SNA /SKIP IF CONDITION HOLDS
ISZ TNTX /FIX RETURN IF CONDITION DOES NOT HOLD
TN3, CIF 00
JMP I TNTX /RETURN
TN4, TCOND /MASK LIST BASE ADDR.
TN5, 0 /A OF MASK USED
TCOND, 0 /MASKS FOR SENSE TAPE CONDIYION
1616 /READ OR WRITE ERROR
1636 /READ-COMPARE ERROR
0100 /EOF
1000 /BOT
0040 /EOT
/HERE ENDETH THE 9 TRACK TAPE PACKAGE
/
/
/............................................
$