Trailing-Edge
-
PDP-10 Archives
-
decuslib10-01
-
43,50012/edit8.mac
There are no other files named edit8.mac in the archive.
;THE FOLLOWING FEATURE SWITCHES CAN BE SET
;FTDT8=0 MONITOR CANNOT READ PDP8 TAPES(327!)
; =1 MONITOR CAN READ PDP 8 TAPES
;FTDTOU=0 NO PDP8 TAPES CAN BE MADE ONTHE PDP10
; =1 PDP8 TAPES CAN BE MADE
TITLE TST1
AC1=1
AC2=2
AC3=3
AC4=4
COUNT=5
FF=COUNT
FILE=6
BLKNR=7
EMPTY=10
FILL=11
TRROUT=12
OUTPTR=13
OUTCNT=14
MASK=OUTCNT
INPTR=15
INCNT=16
NFOUND=INCNT
PDP=17
LENGTH=14
TAC=AC1
BPTR=10
TAC1=AC1
TAC2=AC2
TTY=3
CH8=1
CH10=2
DIRDEV=4
IFNDEF FTDTOU,<FTDTOU=0>
IFNDEF FTDT8,<FTDT8=0>
IFNDEF FTTEST,<FTTEST=0>
EXTERN JOBREN
MLON
STRT: MOVEI AC1,PIP8
MOVEM AC1,JOBREN
PIP8: SETZM ALL
SETZM NAM10
SETZM NAM10+1
IFE FTDT8,<
SETOM QDIR
SETOM QDATA
>
;INTHE FOLLOWING PIECE OF CODE THE TTY I/O IS SET UP
CALLI 0
INIT TTY,0
SIXBIT /TTY/
XWD TTYOUT,TTYIN
JRST PIP8
;IS THIS IMPOSSIBLE ?
INBUF TTY,1
OUTBUF TTY,1
OUTPUT TTY,
;THE TTY I O IS SET UP NOW
;SET THE PUSH DOWN LIST TO ITS STARTING VALUE
MOVSI PDP,-LENGTH
HRRI PDP,LIST-1
IFN FTDTOU, <
PUSHJ PDP,INLMES
ASCIZ /8 TO 10 CONVERSION ?
/
SETZM DOTLOC
SETZM MODE
PUSHJ PDP,YESNO
JRST YESSIR
SETOM MODE
OPEN CH10,ININ
JRST QUEST
MOVE AC1,OUTIN+1
MOVEM AC1,EIGHCH+1
OPEN CH8,EIGHCH
JRST QUEST
MOVE AC1,[SIXBIT /INDTA/]
CALL AC1,[SIXBIT /DEVCHR/]
TLNN AC1,DIRDEV
JRST FGETIT
PUSHJ PDP,NAMES
LOOKUP CH10,NAM10
JRST INPUN
FGETIT: PUSHJ PDP,NAMES1
MOVE FILE,NAM8
JRST ENTR8
;INTHE CODE FOLLOWING THE PRECEDING QUESTION
;THE CASE WAS TRATED OF 10 TO 8 CONVERSION
;
>
;IN THE NEXT CODE THE 8 TO 10 CASE IS STARTED
YESSIR:
FN810: PUSHJ PDP,FUNCT
JRST TPDIR8
JRST TRTALL
PROC81: PUSHJ PDP,OPENF
MOVE AC1,[SIXBIT /OUTDTA/]
CALL AC1,[SIXBIT /DEVCHR/]
TLNN AC1,DIRDEV
JRST NLKUP
SETZM DOTLOC
SKIPL ALL
PUSHJ PDP,NAMES
ENTER CH10,NAM10
JRST FAILE
NLKUP: SETOM DOTLOC
PUSHJ PDP,DTAP8 ;CHECK IF INPUT IS ON A DTA
SKIPL ALL
PUSHJ PDP,NAMES1
JRST LKUP8
TRTALL: SETZM NAM10+1
SETOM ALL
SETOM FILE
MOVEI NFOUND,THRU
PUSHJ PDP,OPENF
PUSHJ PDP,SRCHDN
SKIPN TAC1
POPJ PDP, ;SKIP ZERO FILES
ADDI BPTR,1
LDB TAC2,BPTR
TRNE TAC2,6000 ;IF BOTH BITS ARE ZERO THEN ASCII
JRST NONE ;NO ASCII FILE
MOVEM TAC1,NAM8
LSH TAC1,^D12
MOVEM TAC1,NAM10
SUBI BPTR,1
PUSHJ PDP,SAVACS
JRST PROC81+1
;COME HERE WHEN THE TRANSFER OF A FILE HAS BEEN COMPLETED
BCKTRF: PUSHJ PDP,OPENF
MOVE FILE,NAM10 ;GET CORRECT DN BLOCK IN CORE
LSH FILE,-^D12
PUSHJ PDP,SRCHDN
POP PDP,TAC1
PUSHJ PDP,RESTACS
POPJ PDP,
NONE: SUBI BPTR,1
POPJ PDP,
THRU: PUSHJ PDP,INLMES
ASCIZ /TAPE DONE!
/
JRST PIP8
NAMES: PUSHJ PDP,INLMES
ASCIZ /WHAT IS THE PDP-10 FILE?
/
IN TTY,
PUSHJ PDP,GETNAM
JRST NAMES ;GETNAM GIVES A SKIP IF
;THE NAME IS NOT ZERO
MOVEM AC2,NAM10
CAIN AC4,15 ;CARRIAGE RETURN
POPJ PDP,
PUSHJ PDP,GETNAM
POPJ PDP,
HLLZM AC2,NAM10+1
POPJ PDP,
NAMES1: PUSHJ PDP,INLMES
ASCIZ /WHAT IS THE PDP8 FILE ? (4 CHARS)
/
IN TTY,
PUSHJ PDP,GETNAM
JRST NAMES1 ;AZERO NAME HAS BEEN GIVEN
LSH AC2,-14
MOVEM AC2,NAM8
POPJ PDP,
EFOUT: Z
NAM10: BLOCK 4
NAM8: Z
TPDIR8: PUSHJ PDP,OPENF
PUSHJ PDP,HDR8
SETO FILE,
MOVEI NFOUND,THRUD8
PUSHJ PDP,SRCHDN
SKIPN TAC1
POPJ PDP,
MOVEI FILL,4
LSHC TAC1,-^D24
SETZ TAC1,
LSHC TAC1,6
ADDI TAC1,40
PUSHJ PDP,OUTCHR
SOJG FILL,.-4
ADDI BPTR,1
LDB TAC1,BPTR
LSH TAC1,-^D10
PUSHJ PDP,@BLIST(TAC1)
SUBI BPTR,1
POPJ PDP,
THRUD8: CLOSE CH10,
CLOSE CH8,
MOVSI PDP,LENGTH
HRRI PDP,LIST-1
JRST FN810
OUTCHR: IDPB TAC1,TTYOUT+1
SOSG TTYOUT+2
OUTPUT TTY,
POPJ PDP,
SAVACS: MOVE [XWD 1,SAVE]
BLT SAVE+15
POPJ PDP,
RESTACS:
MOVE [XWD SAVE,1]
BLT 16
POPJ PDP,
DTAP8: MOVE AC1,[SIXBIT /INDTA/]
CALL AC1,[SIXBIT /DEVCHR/]
TLNE AC1,100 ;A DECTAPE ?
POPJ PDP,
PUSHJ PDP,INLMES ;NO TELLIT
ASCIZ /?INDTA IS NO DECTAPE
/
CALL [SIXBIT /EXIT/]
OPENF: MOVE AC1,ININ+1
MOVEM AC1,EIGHCH+1
OPEN CH8,EIGHCH
JRST QUEST
OPEN10: OPEN CH10,OUTIN
JRST QUEST
POPJ PDP,
HDR8: PUSHJ PDP,INLMES
ASCIZ /FILE TYPE
/
POPJ PDP,
ASCII: PUSHJ PDP,INLMES
ASCIZ / ASCI
/
POPJ PDP,
BINARY: PUSHJ PDP,INLMES
ASCIZ / BIN
/
POPJ PDP,
FBIN: PUSHJ PDP,INLMES
ASCIZ / FBIN
/
POPJ PDP,
SAVED: PUSHJ PDP,INLMES
ASCIZ / SAVE
/
POPJ PDP,
FUNCT: PUSHJ PDP,INLMES
ASCIZ /WHAT DO YOU WANT
/
INPUT TTY,
FOL: PUSHJ PDP,GETCHR
CAIN AC4,"D"
POPJ PDP,
AOS (PDP)
CAIN AC4,"A"
POPJ PDP,
AOS (PDP)
CAIN AC4,"I"
POPJ PDP,
CAIE AC4,15
CAIN AC4,12
JRST NXTLIN ;GET NEXT LINE
CAIN AC4,"E" ;EXIT?
CALLI 12 ;YES
CAIE AC4,40
JRST WRCHA
NXTLIN: SOS (PDP)
SOS (PDP)
JRST FOL
;TO TRANSFER A NUMBER OF CHARACTERS FROM A SOURCE
;TO A SINK, THE FOLLOWING CODE USES:
;INCNT NUMBER OF CHARACTERS IN SOURCE
;OUTPUT NUMBER OF CHARACTERS WHICH FIT IN REST OF SINK
;INPTR POINTER IN SOURCE AREA.
;OUTPTR POINTER IS SINK AREA
;(TRROUT) <0 NO TRANSFORMATION NEEDED
;(TRROUT) >0 THEN CONTENT=ADDRESS TRANSFORMATION ROUTINE.
;AC1 AND AC2 CONTAIN THE TRANSFORMED BYTES
;(AC2)=0 ONLY ONE BYTE IS PRODUCED BY TRANSFORMATION.
TRANSF: SOSG (INCNT) ;ARE THERE CHARACTERS AVAILABLE
PUSHJ PDP,(FILL) ;NO, REFILL SOURCE
ILDB AC1,(INPTR) ;LOAD CHARACTER
PUSHJ PDP,(TRROUT) ;TRANSFORM
OUT: CAIN AC1,14 ;THE LAST BLOCK IS FILLED TILL THE
;END OF THE BLOCK WITH THIS CHARACTER
;IT CAN HOWEVER BE PART OF THE TEXT
JRST ADDAT ;REMEMBER WE HAVE SEEN IT
SKIPE ATCHAR ;WERE FF CHARACTERS COUNTED?
PUSHJ PDP,ATOUT ;YES!
IDPB AC1,(OUTPTR) ;TRANSPORT TO SINK
SOSG (OUTCNT) ;SINK FULL?
PUSHJ PDP,(EMPTY)
TSTAC2: SKIPN AC1,AC2 ;SKIP IF (AC2) NE 0
;AC1_(AC2)
JRST TRANSF ;RESET CHARACTER FROM SOURCE
ANDI AC2,0 ;CLEAN AC2
JRST OUT
ADDAT: AOS ATCHAR ;COUNT THEM
JRST TSTAC2
ATOUT: PUSH PDP,AC1 ;SAVE
MOVEI AC1,14 ;FF CHAR!
DEPAT: IDPB AC1,(OUTPTR)
SOSG (OUTCNT)
PUSHJ PDP,(EMPTY)
SOSE ATCHAR
JRST DEPAT
POP PDP,AC1
POPJ PDP,
ATCHAR: Z
;HERE WE COME WHEN THE DEVICES HAVE BEEN INITED
;AND AN ENTER HAS BEEN DONE ON THE 10 DEVICE
LKUP8: SETZM ATCHAR ;OTHERWISE ^C START WOULD GIVE NOT ALWAYS
;THE SAME RESULT
MOVEI NFOUND,INPUN
MOVE FILE,NAM8
PUSHJ PDP,SRCHDN
HRRZ FILE,COUNT
MOVEI NFOUND,NODATA
PUSHJ PDP,FNDSAM
HRRZ BLKNR,COUNT
PUSHJ PDP,FIRST
SETZ AC2, ;THIS IS DONE FOR TRANSF
MOVEI EMPTY,OUT10
MOVEI AC1,CL10
MOVEM AC1,EFOUT
OUTPUT CH10,
NENTR8: MOVEI FILL,IN8
MOVEI TRROUT,TRA810
SETZ FF,
MOVEI AC1,CLOS8I
MOVEM AC1,EOFIN
MOVEI OUTCNT,OUTIN+5
MOVEI OUTPTR,OUTIN+4
JRST TRANSF+2
IFN FTDTOU, <
ENTR8: MOVEI NFOUND,NEW8F
PUSHJ PDP,SRCHDN
HRRZ FILE,COUNT
PUSHJ PDP,FNDSAM
DLETE: SUBI BPTR,1
IBP BPTR
IBP BPTR
LDB BPTR
ANDCAM MASK,
IDPB BPTR
PUSHJ PDP,RETURN
JRST DLETE
NEW8F: PUSHJ PDP,OUT8
PUSHJ PDP,IN10
MOVEI EMPTY,OUT8
MOVEI FILL,IN8
MOVEI TRROUT,TRA108
SETZM EFOUT
IFE FTDT8,<
MOVEI AC1,CLOS8O
>
MOVEM AC1,EOFIN
JRST TRANSF+2
>
IN8: MOVE AC3,LINK8
HRRI AC3,@DAC
ADDI AC3,^D42
LDB BLKNR,AC3
SKIPN BLKNR
JRST @EOFIN
FIRST: PUSH PDP,AC2 ;THIS ACCU IS DESTROYED BY DATA8 CODE
IFE FTDT8, <
PUSHJ PDP,DATA8
>
IFN FTDT8, <
USETI CH8,(BLKNR)
INPUT CH8,DACLST
>
MOVEI INCNT,^D256
MOVEM INCNT,INCNTR
MOVEI INCNT,INCNTR
MOVE INPTR,PD8PTR
HRRI INPTR,@DAC
SUBI INPTR,1
MOVEM INPTR,INPNTR
MOVEI INPTR,INPNTR
POP PDP,AC2
POPJ PDP,
IFN FTDTOU, <
OUT8: SETZ FILE
PUSHJ PDP,FNDSAM
HRRZ COUNT,COUNT
MOVEI AC3,LINK8
HRRI AC3,@DAC
ADDI AC3,^D42
IDPB COUNT,AC3
IFE FTDT8, <
PUSHJ PDP,DATA8
>
MOVEI OUTCNT,^D256
MOVE OUTPTR,PD8PTR
HRRI OUTPTR,@DAC
POPJ PDP,
IFE FTDT8, <
CLOS8O: USETO CH8,@QDATA
OUTPUT CH8,IOWD2D
>
>
CLOS8I: CLOSE CH8,
IFE FTDT8, <
PUSHJ PDP,EIGHTS ;FORGET ALL ABOUT 8 TAPE
>
SKIPE EFOUT
JRST @EFOUT
CLOSE CH10,
JRST @JOBREN
IFN FTDTOU, <
IN10: INPUT CH10,
MOVEI INCNT,ININ+5
MOVEI INPTR,ININ+4
POPJ PDP,
>
OUT10: OUTPUT CH10,
POPJ PDP,
CL10:
LASTO: OUTPUT CH10,
CLOSE CH10,
SKIPGE ALL
JRST BCKTRF
JRST @JOBREN
IFE FTDT8,<
EIGHTS: SETOM QDIR
SETOM QDATA
POPJ PDP,
QDIR: -1
BLTDIR: XWD BLDIR+200,BLDIR
IOWD2: IOWD 400,BLDIR
Z
IOWD1: IOWD 200,BLDIR+200
Z
BLDIR: BLOCK 400
CAC: Z
QDATA: -1
BLTDAT: XWD BLDATA+200,BLDATA
IOWD2D: IOWD 400,BLDATA
Z
IOWD1D: IOWD 200,BLDATA+200
Z
BLDATA: BLOCK 400
DAC: Z
DIRB: Z
>
MODE: Z
ALL: Z
GETNAM: SETZM AC2
MOVSI AC3,-6
PUSHJ PDP,GETCHR
CAIN AC4,40
JRST .-2
SKIPA ;TO ENABLE A ZERO EXTENSION
COLL: PUSHJ PDP,GETCHR
CAIE AC4,40
CAIN AC4,15
JRST FINI
CAIN AC4,"."
JRST DOTCH
VALID: CAIL AC4,60
CAILE AC4,132
JRST WRCHA
CAIL AC4,72
CAILE AC4,100
JRST GOODCH
JRST WRCHA
GOODCH: LSH AC2,6
SUBI AC4,40
ADD AC2,AC4
AOBJN AC3,COLL
JRST SKPRET
FINI: LSH AC2,6
AOBJN AC3,FINI
SKIPE AC2
SKPRET: AOS (PDP)
POPJ PDP,
DOTCH: SKIPE AC4,DOTLOC
JRST WRCHA
SETOM DOTLOC
SKIPN NAM10
JRST FINI ;FINDING FILE NAME AT THIS MOMENT
JRST GETNAM ;RESTART
IFE FTDT8,<
DATA8: MOVEI AC3,407
DIRINF: MOVE AC1,BLKNR
;LET US TEST THE BLOCK NUMBER AND SEE IF
;THIS CAUSES TROUBLE ,OTHERWISE WE WILL
;HANG DEVICE
CAIG AC1,2702 ;HIGHEST BLOCK # ON PDP 8 DECTAPE
CAIG AC1,1 ;0,1 CANOT BE READ AND ARE NOT NEEDED
IFE FTTEST,<
JRST BLKNOK
>
IFN FTTEST,<
JRST . ;TEST ON 120 MONITOR!
>
IMULI AC1,^D43
IDIVI AC1,^D128
SKIPG QDIR(AC3)
JRST INPUT8 ;NO OUTPUT YET DONE
CAMN AC1,QDIR(AC3)
JRST INCOR2
MOVE AC4,AC1
SUBI AC4,1
CAMN AC4,QDIR(AC3)
JRST INCOR1
FALL: SKIPN MODE
JRST INPUT8
USETO CH8,@QDIR(AC3)
OUTPUT CH8,IOWD2(AC3)
INPUT8: USETI CH8,(AC1)
INPUT CH8,IOWD2(AC3)
SETCTL: MOVEM AC1,QDIR(AC3)
INCOR2: MOVEI AC1,BLDIR(AC3)
ADDI AC1,(AC2)
MOVEM AC1,CAC(AC3)
POPJ PDP,
INCOR1: CAILE AC2,^D85
JRST FALL
INCORA: SKIPN MODE
JRST INPT81
USETO CH8,@QDIR(AC3)
OUTPUT CH8,IOWD2(AC3)
INPT81: MOVE AC4,BLTDIR(AC3)
BLT AC4,BLDIR+177(AC3)
USETI CH8,1(AC1)
INPUT CH8,IOWD1(AC3)
JRST SETCTL
>
DOTLOC: Z
ININ: Z
SIXBIT/INDTA/
XWD 0,.+1
BLOCK 3
OUTIN: Z
SIXBIT/OUTDTA/
XWD .+1,0
BLOCK 3
EIGHCH: 117
Z
Z
;THE CODE TRA810 TRANSFORMS PDP8 ASCII CODE IN PDP-10
;ASCII CODE, IF REQUIRED A SECOND CHARACTER IS OBTAINED WITH
;INPTR, THE ROUTINE REFILL IS IF NEEDED CALLED WITH PUSHJ
;THE RESULT BYTE IS DEPOSITED IN AC1
;FF IS A SWITCH, WHICH AT THE FIRST TIME MUST BE SET=0
;TWO FORM FEEDS INDICATE AN END OF FILE
;BIT 34 OF FF IF EQUAL 1 INDICATES, THAT THE PRECEDING CHARACTERS
;WAS A FORMFEED.
TRA810: CAIE AC1,77 ;A TAG CHARACTER?
JRST NOTAG ;NO
TRON FF,1 ;OR A TAGGED CHARACTER?
JRST NEXT ;IT WAS A TAG
TRZ FF,3 ;TURN SWITCHES OFF
POPJ PDP, ;RETURN A ?
NEXT: SOSG (INCNT) ;IS INPUT BUFFER EMPTY?
PUSHJ PDP,(FILL) ;GET NEW DATA
ILDB AC1,(INPTR) ;GET NEXT CHARACTER
JRST TRA810 ;PROCESS IT
NOTAG: TRZN FF,1 ;TURN TAG SWITCH OFF
JRST PREPC1 ;UNTAGGED CHARACTER
CAIL AC1,40 ;MUST A BIT BE ADDED
PREPCH: TRO AC1,100 ;YES
POPJ PDP,
PREPC1: CAIL AC1,40
JRST PREPCH+1
JRST PREPCH
;YESNO GIVES A NORMAL RETURN IF Y IS TYPED,
; AND A SKIP RETURN IF NO IS TYPED
;IF A WRONG CHAR IS TYPED THE ROUTINE WRCHA IS CALLED
YESNO: PUSH PDP,AC3
IN TTY,
SKIPA
JRST PIP8
CHLPI1: SOSGE TTYIN+2
JRST YESNO+1
ILDB AC3,TTYIN+1
CAIN AC3,"Y"
JRST CPOPJ
CAIN AC3,"N"
JRST CPOPJ1
CAIN AC3," "
JRST CHLPI1 ;SKIP BLANKS
JRST WRCHA
CPOPJ1: AOS -1(PDP)
CPOPJ: POP PDP,AC3
POPJ PDP,
;INLMES PRINTS A MESSAGE FOLLOWING PUSHJ PDP,INLMES
;ASCIZ/TEXT/
;A RETURN IS MADE AFTER THE TEXT
INLMES: MOVEM AC3,TEMP3
HRLI AC3,440700
HLLM AC3,(PDP)
CHRLP: ILDB AC3,(PDP) ;LOAD SUCCESSIVE BYTES
JUMPE AC3,TELLIT
IDPB AC3,TTYOUT+1
SOSE TTYOUT+2
JRST CHRLP
OUT TTY,
JRST CHRLP
JRST PIP8 ;ERROR RETURN
TELLIT: OUT TTY,
SKIPA
JRST PIP8 ;ERROR RETURN
AOS (PDP) ;SET RETURN ADDRESS
POP PDP,AC3 ;RESET PDP
MOVE AC3,TEMP3
JRST @1(PDP) ;COME BACK AFTER TEXT
TEMP3: 0
TTYIN: BLOCK 3
TTYOUT: BLOCK 3
;THIS IS A COLLECTION OF MESSAGES
;CALLED FROM PIP8
WRCHA: PUSHJ PDP,INLMES
ASCIZ /?WRONG CHAR IN INPUT
/
JRST PIP8
QUEST: PUSHJ PDP,INLMES
ASCIZ /?DID YOU ASSIGN INDTA OR OUTDTA?
/
JRST PIP8
FAILE: SKIPGE ALL
JRST NXTTAPE ;ASK FOR ANOTHER TAPE
PUSHJ PDP,INLMES
ASCIZ /?NO ROOM ON DECTAPE
/
JRST PIP8
GETCHR: SOSG TTYIN+2
INPUT TTY,
ILDB AC4,TTYIN+1
POPJ PDP,
INPUN: PUSHJ PDP,INLMES
ASCIZ /?INPUT FILE NOT FOUND
/
JRST PIP8
NOASC: PUSHJ PDP,INLMES
ASCIZ /?NO ASCII FILE!
/
JRST PIP8
NODATA: PUSHJ PDP,INLMES
ASCIZ /?NO DATA FOUND
/
JRST PIP8
POPJ PDP,
BLKNOK: PUSHJ PDP,INLMES
ASCIZ /?BLOCK # TOO HIGH
/
JRST PIP8
NXTTAPE: PUSHJ PDP,INLMES
ASCIZ /? A NEW TAPE IS NEEDED
/
PUSHJ PDP,YESNO
SKIPA
JRST PIP8
RELEASE CH10,
PUSHJ PDP,OPEN10
JRST NLKUP-2
IFN FTDTOU,<
;TRA108 PRODUCES TRIMMED 6 BIT OUT OF 7 BIT ASCII
;CODE THE TRANSFORMING ALGORITHM IS:
;000-037 TRANSFORM IN 77+LAST TWO OCTAL DIGITS
;032 IS AN END OF FILE CHARACTER JUMP TO EOFIN
;077 TRANSFORMS IN 7777
;40-76 AND 100-137 DROP THE SEVENTH BIT
;CHARACTERS ARE RETURNED IN AC1 AND AC2
TRA108: JUMPE AC1,SPEC
CAIL AC1,40 ;SKIP IF PREFIX NEEDED
CAILE AC1,137 ;SKIP IF NO PREFIX NEEDED
JRST PREFIX ;TEST FOR END OF FILE
CAIN AC1,77 ;IS IT A? ?
JRST PREFIX+3
TDZ AC1,100 ;SET BIT TO ZERO
POPJ PDP, ;READY
PREFIX: CAIN AC1,32 ;END OF FILE MARK
JRST @EOFIN ;YES
ANDI AC1,77 ;MASK SEVENTH BIT OFF
EXCH AC1,AC2 ;PREFIX MUST COME IN AC1
MOVEI AC1,77 ;77=PREFIX:
POPJ PDP,
SPEC: POP PDP,
JRST TRANSF ;SKIP FILLING CHARACTERS
>
;FNDSAM FINDS THE FIRST BLOCK OF A PDP-8
;ASCII FILE,
;(FILE)=FILE#
;(BLKNR)=BLOCK#, IF=0 THEN NO BLOCK
;HAS BEEN ASSIGNED TO THE FILE
;THE SAM BLOCK IS LOCATED IN AREA CAC
;BPTR2 IS THE BASIC BYTE POINTER FOR TWELVE BYTES
FNDSAM: SETZ AC3,
IFN FTDT8, <
USETI CH8,200
>
IFE FTDT8,<
MOVEI BLKNR,200 ;SAM BLOCK #1
SETOM DIRB
PUSHJ PDP,DIRINF ;READ SAM BLOCK
>
MOVE COUNT,[XWD ^D<-128>,0] ;COUNT
BL: IFN FTDT8,<
INPUT CH8,CACLST
>
MOVEI MASK,77 ;RIGHT HALF OF PDP-8 WORD
LBPTR: MOVSI BPTR,441400
HRRI BPTR,@CAC ;SET BYTE ADDRESS
LOAD: ILDB TAC,BPTR ;LOAD PDP-8 WORD:
AND TAC,MASK ;LOOK AT MASKED BITS
;ONLY
CAMN TAC, FILE ;FILE # FOUND?
POPJ PDP, ;YES
RETURN: AOBJN COUNT,LOAD ;SAM BLOCK HALF SCANNED
CAIE MASK,7700 ;ENTIRE BLOCK SCANNED
JRST NXTLP ;NO, NOT YET.
ILDB BLKNR,BPTR ;LOAD LINK
SKIPN BLKNR ;NIL ELEMENT
JRST (NFOUND)
IFN FTDT8, <
USETI CH8,(BLKNR)
>
IFE FTDT8, <
PUSHJ PDP,DIRINF ;NEXT SAM BLOCK
>
LSH FILE,-6
HRLI COUNT,^D<-128> ;REFRESH COUNT
JRST BL ;REFRESH MASK
NXTLP: HRLI COUNT,^D<-128> ;REFRESH COUNT
HRRI MASK,7700 ;NEW MASK:
LSH FILE,+6 ;SHIFT # BACK:
JRST LBPTR
;SRCHDN RETURNS THE FILE # OF A FILE WHOSE
;SIZEBIT TRIMMED CODE IS CONTAINED IN FILE
;(COUNT)R=FILE#, IF THE FILE IS NOT PRESENT
;THEN (COUNT) IS POSITIVE
;CALLED BY PUSHJ PDP,SRCHDN
SRCHDN: IFE FTDT8,<
SETZ AC3,
SETOM DIRB
MOVEI BLKNR,177 ;DN BLOCK NO 1
>
IFN FTDT8,<
USETI CH8,177
>
MOVE COUNT,[XWD^D<-25>,1]
;(COUNT)L=LOOP COUNT
;(COUNT)R=FILE#
SLOOP: IFE FTDT8,<
PUSHJ PDP,DIRINF ;READ DN BLOCK IN CAC
>
IFN FTDT8,<
INPUT CH8,CACLST
>
MOVSI BPTR,441400 ;LOAD BASIC POINTER
HRRI BPTR,@CAC ;INSERT BYTE ADDRESS
ADDI BPTR,1
TSTNAM: ILDB TAC1,BPTR ;LOAD FIRST 8 WORD
LSH TAC1,^D12 ;POSITIVE IS LEFT
ILDB TAC2,BPTR ;LOAD SECOND 8 WORD
ADD TAC1,TAC2 ;GET NAME OF FILE.
CAMN TAC1,[XWD 1,100]
JRST (NFOUND)
SKIPG FILE
PUSHJ PDP,@(PDP)
CAMN TAC1,FILE ;FILE NAME FOUND?
JRST CHECK ;YES
ADDI BPTR,1 ;RESET DN ENTRY
AOBJN COUNT,TSTNAM ;DN BLOCK EMPTY?
ILDB BLKNR,BPTR ;YES, LOAD REST OF BLOCK
JUMPE BLKNR,(NFOUND) ;FILE UNKNOWN
HRLI COUNT,^D<-25> ;REFRESH COUNT
IFN FTDT8, <
USETI CH8,BLKNR
>
JRST SLOOP ;RESET DN BLOCK
CHECK: ADDI BPTR,1 ;GET TEST VALUE FROM
LDB TAC1,BPTR ;DN BLOCK ENTRY
TRNE TAC1,6000 ;ASCII NE 6000
JRST NOASC ;NO ASCII FILE
POPJ PDP, ;RETURN
NFL8: IDPB TAC1,BPTR ;TAC1=0!
IDPB TAC1,BPTR
MOVEI TAC1,(COUNT) ;INSERT FILE NUMBER
DPB TAC1,BPTR
SUBI BPTR,1
MOVE TAC1,NAM8
IDPB TAC1,BPTR ;DEPOSIT THE LAST TWELVE BITS
LSH TAC1,-^D12
SUBI BPTR,1
IBP BPTR
DPB TAC1,BPTR
POPJ PDP,
IFN FTDT8,<
CACLST: IOWD ^D43,DIRIN8
Z
CAC: .+1
DIRIN8: BLOCK ^D43
DACLST: IOWD ^D43,DATIN8
Z
DAC: .+1
DATIN8: BLOCK ^D43
>
INCNTR: 0
INPNTR: 0
SAVE: BLOCK 20
LIST: BLOCK LENGTH
EOFIN: Z
LINK8: POINT ^D12,DAC+^D42,^D35
BLIST: EXP ASCII,BINARY,FBIN,SAVED
PD8PTR: POINT 6,DAC-1,^D34
END STRT