Trailing-Edge
-
PDP-10 Archives
-
decus_20tap2_198111
-
decus/20-0069/vted.mac
There are 2 other files named vted.mac in the archive. Click here to see a list.
TITLE VTED - TEXT RECEIVING AND EDITING PROGRAM
ENTRY VTED ;GUARANTEED NOT TO LOSE MUCH DATA ON A CRASH
loc 137
vvted:: 1
reloc
IFNDEF NOECHO,<NOECHO=-1>
DEFINE ERRMES(A)
< JRST [TTCALL 3,[ASCIZ/
A/]
SETZM .JBINT##
EXIT 1,
JRST VTED]>
P=17
C=16
M=15
P2=14
P1=13
AC=0
T1=10
T2=11
T3=12
T4=4
T5=5
TEMP=6
SAC=7
DSK=1
TTY=2
PRF=3
HORMAX=^D71
VERMAX=^D20
BELL=7
LF=12
CR=15
TAB=11
ALT=33
FORM=^D12
BAKSPC=10
RUBOUT=177
CRSRUP=32
EOL=36
HOME=^D29
EOS=^D31
UPARO=^D26
DWNARO=^D11
FORARO=^D24
BAKARO=^D8
BAKAR1=^D25
FRUST=4 ;N umber of ^C's before exiting
FLINES=5 ;Number of Line-Feeds in a Form-feed
NLINES=5 ;Lines typed on an append
TLINES=1 ;Lines typed on a search
IFE NOECHO,<
WIDTH=HORMAX
FREECR=2012
TTYMOD=500>
IFN NOECHO,<
WIDTH=1
FREECR=2010
TTYMOD=700>
VTED: RESET
MOVE P,[IOWD PDLEN,PDLST]
SETZM PRFFLG#
SETZM OLDCHR#
SETZM FASTF#
SETZM NXTCHR#
SETZM LSTCHR#
SETOM MOVFLG#
MOVEI FILL4
MOVEM FILFLG#
SETZM CAPSIM#
SETZM STOCNT
SETO AC,
GETLCH AC
MOVEM AC,SAVTTY#
TLZ AC,(1B13)
TRO AC,200000
HRRZM AC,IOINDX
HRRZM AC,FRMBLK+1
SETLCH AC
MOVEI 0,FREECR
MOVE 1,IOINDX
MOVEI 2,WIDT H
MOVSI 3,3
TRMOP. 3,
JFCL
MOVE AC,[XWD 3,FRMBLK]
TRMOP. AC
JFCL
PUSHJ P,GETNAM
PUSHJ P,OPNFIL
INIT TTY,TTYMOD
SIXBIT/TTY/
EXP TIBUF
ERRMES(<TTY not available>)
SETZM BUFF
MOVE P1,[XWD BUFF,BUFF+1]
BLT P1,BUFF+177
SETO AC,
GETLCH AC
TLO AC,(1B13)
SETLCH
MOVE .JBFF##
MOVEM STOBUF
PUSHJ P,GTBAUD
MOVEI C,EOS
PUSHJ P,TYPCHR
SETZM DONFLG#
SETZM INTBLK+2
MOVEI INTBLK
MOVEM .JBINT##
MOVE SAVTTY
TLNN (1B13)
SETOM CAPSIM
LOOP: PUSHJ P,GETCHR
IFE NOECHO,<
PUSHJ P,UPDATE>
CAIE C,BAKAR1
CAIN C,BAKARO
JRST BAK1WD
CAIN C,FORARO
JRST FOR1WD
CAIN C,UPARO
JRST BAK1LN
CAIN C,DWNARO
JRST FOR1LN
CAIN C,RUBOUT
JRST RUB1CH
CAIN C,ALT
JRST COMAND
CAIN C,EOL
JRST DELEOL
CAIN C,EOS
JRST DELEOS
IFN NOECHO,<
PUSHJ P,UPTYP>
PUSHJ P,PUTCHR
JRST LOOP
GETCHR: SKIPE NXTCHR
JRST GETNXT
GETCH: INCHRW C
GETCH2: PUSHJ P,CHKFIL
SKIPE DONFLG
JRST DONE
CAIN C,FORM
PUSHJ P,CHKFRM
CAIE C,LF
JRST GETCH1
MOVEI CR
CAMN LSTCHR
JRST GETCH1
AOS T1,NXTCHR
MOVEM C,SAVCHR-1(T1)
MOVEI C,BELL
PUSHJ P,TYPEC
MOVEI C,CR
IFE NOECHO,<
PUSHJ P,UPTYP>
GETCH1: MOVE LSTCHR
MOVEM OLDCHR
CAIE BAKARO
CAIN BAKAR1
PUSHJ P,CHKEOL
CAIN UPARO
PUSHJ P,CHKEOL
MOVEM C,LST CHR
IFE NOECHO,<
CAIN C,FORM
JRST TYPFRM>
POPJ P,
CHKEOL: CAIE C,BAKARO
CAIN C,BAKAR1
POPJ P,
CAIE C,UPARO
CAIN C,EOS
POPJ P,
TTCALL 15,[EOL]
POPJ P,
GETNXT: SOS C,NXTCHR
MOVE C,SAVCHR(C)
JRST GETCH2
CHKFRM: PUSHJ P,SCAN
CAIE C,FORM
CAIN C,LF
JRST [ MOVEI C,FORM
POPJ P,]
MOVEI C,FORM
AOS T1,NXTCHR
MOVEM C,SAVCHR-1(T1)
MOVEI C,LF
POPJ P,
SAVCHR: BLOCK 3
PUTCHR: JUMPE C,CPOPJ
SOSG OUTCNT
JRST PUTBF
IDPB C,OUTPNT
SKIPN FASTF
CAIE C,12
CPOPJ: POPJ P,
MOVE P1,BLKPNT
USETO DSK,(P1)
OUT DSK,CL
POPJ P,
PUTERR: ERRMES(<Output error - FATAL!>)
PUTBF: MOVE P1,[P OINT 7,BUFF]
MOVEM P1,OUTPNT
MOVEI P1,200*5
MOVEM P1,OUTCNT
MOVE P1,BLKPNT
JUMPE P1,PUTBF1
USETO DSK,(P1)
OUT DSK,CL
PUTBF1: AOSA P1,BLKPNT
JRST PUTERR
SETZM BUFF
MOVE P1,[XWD BUFF,BUFF+1]
BLT P1,BUFF+177
SKIPE FASTF
JRST PUTCHR
MOVE P1,BLKPNT
USETO DSK,(P1)
OUTPUT DSK,CL
CLOSE DSK,
LOOKUP DSK,NAME
ERRMES(<Lookup Error on File>)
HLLZS NAME+1
SETZM NAME+2
SETZM NAME+3
ENTER DSK,NAME
ERRMES(<ENTER Failure on File>)
JRST PUTCHR
BAK1WD:
IFE NOECHO,<
SETOM BAKFLG#
SKIPN MOVFLG
AOS BAKFLG>
PUSHJ P,SCAN
IFE NOECHO,<
CAIN C,TAB
AOS BAKFLG>
CAIE C,FORM
CAIN C,LF
JRST BAKLN1
JRST BAKWD4
BAKWD3: PUSHJ P,SCAN
BAKWD4: PUSHJ P,TEXT
JRST BAKWD5
PUSHJ P,DELETE
IFE NOECHO,<
AOSE BAKFLG>
PUSHJ P,BAKCSR
JUMPE C,LOOP
PUSHJ P,STOBYT
JRST BAKWD3
BAKWD1: PUSHJ P,SCAN
PUSHJ P,TEXT
SKIPA
JRST LOOP
BAKWD5: CAIE C,FORM
CAIN C,LF
JRST LOOP
BAKWD2: PUSHJ P,DELETE
IFE NOECHO,<
AOSE BAKFLG>
PUSHJ P,BAKCSR
JUMPE C,LOOP
PUSHJ P,STOBYT
JRST BAKWD1
FOR1WD:
IFE NOECHO,<
MOVEI C,BAKARO
SKIPE MOVFLG
PUSHJ P,UPTYP>
MOVEI C,EOL
PUSHJ P,TYPEC
PUSHJ P,GETBYT
JRST FORWD4
JRST FORWD6
FORWD2: PUSHJ P,GETBYT
JRST FORWD4
CAIE C,FORM
CAIN C,CR
JRST FORWD3
FORWD 6: PUSHJ P,PUTCHR
PUSHJ P,UPTYP
CAIN C,LF
JRST FORWD4
PUSHJ P,TEXT
JRST FORWD2
FORWD1: PUSHJ P,GETBYT
JRST FORWD4
CAIE C,FORM
CAIN C,CR
JRST FORWD3
PUSHJ P,TEXT
JRST FORWD3
PUSHJ P,PUTCHR
PUSHJ P,UPTYP
JRST FORWD1
FORWD3: PUSHJ P,STOBYT
FORWD4: JRST LOOP
CHKEND: CAIN C,TAB
JRST CHKETB
MOVE HORCNT
CAIGE HORMAX-1
POPJ P,
CAIN C,ALT
JRST CHKND1
CAIL C,40
CAIL C,175
POPJ P,
CAIL C,"A"
CAILE C,"Z"
JRST CHKND1
SKIPE CAPSIM
JRST CHKND2
CHKND1: CAIGE HORMAX
POPJ P,
CHKND2: MOVEI M,[BYTE (7)CR,LF,0]
JRST MESOUT
CHKETB: PUSH P,HORCNT
PUSH P,VERCNT
PUSHJ P,UPDATE
MOV E HORCNT
POP P,VERCNT
POP P,HORCNT
CAML HORCNT
POPJ P,
JRST CHKND2
BAK1LN:
IFE NOECHO,<
MOVEI C,DWNARO
SKIPE MOVFLG
PUSHJ P,UPTYP>
MOVEI C,CR
PUSHJ P,TYPCHR
BAKLN1: PUSHJ P,DELETE
PUSHJ P,SBKCSR
JUMPE C,LOOP
PUSHJ P,STOBYT
CAIE C,FORM
CAIN C,CR
JRST LOOP
JRST BAKLN1
FOR1LN:
IFE NOECHO,<
MOVEI C,UPARO
SKIPE MOVFLG
PUSHJ P,UPTYP>
MOVEI C,EOL
PUSHJ P,TYPEC
SETZM FORFLG#
FORLN1: PUSHJ P,GETBYT
JRST FORLN2
CAIE C,FORM
CAIN C,CR
JRST [ SKIPN FORFLG
JRST .+1
PUSHJ P,STOBYT
JRST FORLN2]
AOS FORFLG
PUSHJ P,PUTCHR
PUSHJ P,UPTYP
JRST FORLN1
FORLN2: MOVEI C,EOL
PUSHJ P,TYPEC
JRST LOOP
RUB1CH: PUSHJ P,DELETE
PUSHJ P,BAKCSR
CAIN C,LF
jrst [ pushj P,SCAN
CAIn C,CR
jrst rub1ch
jrst .+1]
MOVEI C,EOL
PUSHJ P,TYPEC
JRST LOOP
DELEOL: PUSHJ P,TYPEC
DEOL1: PUSHJ P,GETBYT
JRST LOOP
CAIN C,LF
JRST LOOP
JRST DEOL1
DELEOS: CAME C,OLDCHR
JRST LOOP
PUSHJ P,TYPEC
SETZM STOCNT
SETZM PRFFLG
JRST LOOP
COMAND: CAME C,OLDCHR
JRST [ PUSHJ P,PUTCHR
PUSHJ P,UPTYP
JRST LOOP]
PUSHJ P,DELETE
MOVEI C,EOS
PUSHJ P,TYPEC
COMND1: MOVEI M,[ASCIZ/
Enter command! /]
PUSHJ P,MESOUT
PUSHJ P,GETCHR
CAIE C,"S"
CAIN C,163
SKIPA
JRST COMERR
SET STS TTY,0
MOVEI M,[ASCIZ/Search for:
/]
PUSHJ P,MESOUT
MOVSI T4,1-SBUFL*5
MOVE T5,[POINT 7,SBUF]
COMLOP: INCHWL C
CAIE C,ALT
IDPB C,T5
CAIE C,ALT
AOBJN T4,COMLOP
TRNE T4,-1
HRRZM T4,SCNT#
SETZM LSTCHR
SETZM OLDCHR
JUMPGE T4,SBUFUL
SLOOP0: MOVE T4,[POINT 7,SBUF]
MOVE SAC,[POINT 7,SBUF1]
MOVE T5,SCNT
SETOM FASTF
SLOOP1: PUSHJ P,GETBYT
JRST SDONE
ILDB T3,T4
IDPB C,SAC
CAMN T3,C
JRST SLOOP3
CAIL T3,101
CAILE T3,132
JRST [ CAIL T3,141
CAILE T3,172
JRST NOMACH
JRST .+1]
TRC T3,40
CAME T3,C
JRST NOMACH
SLOOP3: SOJG T5,SLOOP1
MOVE T4,[POINT 7,SBUF1]
MOVE T5,SCNT
SLOOP 2: ILDB C,T4
PUSHJ P,PUTCHR
SOJG T5,SLOOP2
SDONE: SETZM FASTF
MOVEI M,[BYTE (7)HOME,EOS,0]
PUSHJ P,MESOUT
SETZB SAC,TEMP
SDONE1: PUSHJ P,DELETE
JUMPE C,SDONE2
PUSHJ P,STOBYT
AOS SAC
CAIE C,CR
JRST SDONE1
CAIGE TEMP,TLINES
AOJA TEMP,SDONE1
SDONE2: SETSTS TTY,TTYMOD
SDONE3: PUSHJ P,GETBYT
JRST LOOP
PUSHJ P,PUTCHR
PUSHJ P,UPTYP
SOJG SAC,SDONE3
JRST LOOP
NOMACH: MOVE T4,[POINT 7,SBUF1]
SUB T5,SCNT
MOVN SAC,T5
NOMAC1: JUMPE T5,NOMAC2
PUSH P,C
ILDB C,T4
PUSHJ P,PUTCHR
POP P,C
AOJA T5,NOMAC1
NOMAC2: PUSHJ P,PUTCHR
NOMAC3: JUMPE SAC,SLOOP0
PUSHJ P,DELETE
PUSHJ P,STOBYT
SOJA SA C,NOMAC3
COMERR: MOVEI C,"?"
PUSHJ P,TYPEC
JRST COMND1
SBUFUL: MOVEI M,[ASCIZ/
Maximum search string length reached... starting search!
/]
PUSHJ P,MESOUT
JRST SLOOP0
STOBYT: MOVE 1,STOCNT#
IDIVI 1,5
ADD 1,STOBUF
CAML 1,.JBREL
JRST GETCOR
DPB C,STOPNT(2)
AOS STOCNT
POPJ P,
GETBYT: SOSGE 1,STOCNT
JRST GETBP
IDIVI 1,5
ADD 1,STOBUF
LDB C,STOPNT(2)
CPOPJ1: AOS (P)
POPJ P,
GETBP: SETZM STOCNT
SKIPN PRFFLG
POPJ P,
JRST GETPRF
STOPNT: POINT 7,(1),6
POINT 7,(1),13
POINT 7,(1),20
POINT 7,(1),27
POINT 7,(1),34
GETCOR: MOVE .JBREL##
ADDI 2000
CORE
ERRMES(<NO MORE CORE AVAILABLE FOR TEMPORARY STORAGE>)
JRST STOBYT
SCAN: PUSHJ P,DELETE
JRST PUTCHR
DELETE: SETZM LSTRUB
MOVE AC,OUTCNT
CAIL AC,200*5
JRST BAKDSK
LDB T2,[POINT 6,OUTPNT,5]
IDIVI T2,7
SUBI T2,4
MOVNS T2
HRRZ T1,OUTPNT
SUBI T1,BUFF
BAKLOP: LDB AC,PNTTAB(T2)
MOVEM AC,LSTRUB#
AOS OUTCNT
JUMPN AC,BAKDON
SOJGE T2,BAKLOP
SOJGE T1,[ MOVEI T2,4
JRST BAKLOP]
BAKDSK: MOVE P1,BLKPNT
CAIN P1,1
JRST BAKDN1
USETO DSK,(P1)
OUTPUT DSK,CL
SOS P1,BLKPNT
SETZM OUTCNT
MOVEI T2,4
MOVEI T1,177
USETI DSK,(P1)
INPUT DSK,CL
JRST BAKLOP
BAKDON: MOVEI AC,0
DPB AC,PNTTAB(T2)
SOJGE T2,BAKDN2
MO VEI T2,4
SOJGE T1,BAKDN2
BAKDN1: MOVE AC,[POINT 7,BUFF]
JRST BAKDN3
BAKDN2: MOVE AC,PNTTAB(T2)
ADDI AC,(T1)
TLZ AC,37
BAKDN3: MOVEM AC,OUTPNT
MOVE C,LSTRUB
POPJ P,
SBKCSR: SETOM SILENT#
SKIPA
BAKCSR: SETZM SILENT
CAIN C,LF
JRST BAKLF
CAIN C,CR
JRST BAKCR
CAIN C,TAB
JRST BAKTAB
CAIN C,FORM
JRST BAKFRM
CAIN C,ALT
JRST BAKCS1
CAIL C,40
CAIL C,175
POPJ P,
BAKCS1: PUSH P,C
SKIPG HORCNT
PUSHJ P,BAKCS2
MOVEI C,BAKARO
SKIPN SILENT
PUSHJ P,TYPEC
PUSHJ P,UPDATE
SKIPE CAPSIM
PUSHJ P,BAKCAP
POP P,C
POPJ P,
BAKCS2: MOVEI C,UPARO
PUSHJ P,UPTYP
MOVEI C,CR
PUSHJ P,BAKCR
M OVE C,-1(P)
JRST UPTYP
BAKCAP: MOVE C,-1(P)
CAIL C,"A"
CAILE C,"Z"
POPJ P,
MOVEI C,"^"
JRST BAKCS1
BAKLF: MOVEI C,UPARO
PUSHJ P,UPTYP
MOVE C,LSTRUB
POPJ P,
BAKFRM: MOVEI C,UPARO
MOVEI P1,FLINES
PUSHJ P,UPTYP
SOJG P1,.-1
MOVEI C,CR
PUSHJ P,UPTYP
MOVEI C,FORM
POPJ P,
BAKCR: SETZM CRCNT#
PUSHJ P,UPTYP
MOVEI C,EOL
PUSHJ P,TYPEC
BAKCR0: PUSHJ P,DELETE
JUMPE C,BAKCR2
CAIE C,FORM
CAIN C,LF
JRST BAKCR1
PUSHJ P,STOBYT
AOS CRCNT
JRST BAKCR0
BAKCR1: PUSHJ P,PUTCHR
BAKCR2: PUSH P,VERCNT
PUSH P,HORCNT
BAKCR9: PUSH P,STOCNT
SETOM CRFLG#
SETZM CRCNT1#
BAKCR3: SOSGE CRCNT
JRST BAKCR4
PUSHJ P,GETBYT
JFCL
MOVE P1,HORCNT
AOSN CRFLG
SETZ P1,
PUSHJ P,UPDATE
CAMLE P1,HORCNT
JRST BAKCR5
AOS CRCNT1
JRST BAKCR3
BAKCR4: POP P,STOCNT
POP P,HORCNT
POP P,VERCNT
BAKCR7: SOSGE CRCNT1
JRST BAKCR6
PUSHJ P,GETBYT
JFCL
PUSHJ P,PUTCHR
PUSHJ P,UPTYP
JRST BAKCR7
BAKCR6: MOVEI C,CR
POPJ P,
BAKCR5: MOVEM P1,HORCNT
AOS CRCNT
POP P,STOCNT
BAKCR8: SOSGE CRCNT1
JRST BAKCR9
PUSHJ P,GETBYT
JFCL
PUSHJ P,PUTCHR
JRST BAKCR8
BAKTAB: SETZM TABCNT#
BAKTB0: PUSHJ P,DELETE
JUMPE C,BAKTB2
CAIN C,LF
JRST BAKTB1
PUSHJ P,STOBYT
AOS TABCNT
JRST BAKTB0
BAKTB1: PUSH J P,PUTCHR
BAKTB2: PUSH P,VERCNT
PUSH P,HORCNT
SETZM HORCNT
BAKTB3: SOSGE TABCNT
JRST BAKTB4
PUSHJ P,GETBYT
JFCL
PUSHJ P,PUTCHR
PUSHJ P,UPDATE
JRST BAKTB3
BAKTB4: MOVN P2,HORCNT
POP P,HORCNT
POP P,VERCNT
ADD P2,HORCNT
JUMPL P2,BAKTB6
BAKTB5: SOJL P2,BAKTB7
MOVEI C,BAKARO
PUSHJ P,UPTYP
JRST BAKTB5
BAKTB6: MOVEI C,UPARO
PUSHJ P,UPTYP
MOVEI C,CR
PUSHJ P,BAKCR
BAKTB7: MOVEI C,TAB
POPJ P,
TEXT: CAIE C,ALT
CAILE C," "
JRST CPOPJ1
POPJ P,
TYPFRM: MOVEI C,CR
PUSHJ P,UPTYP
MOVEI C,LF
MOVEI P1,FLINES
PUSHJ P,UPTYP
SOJG P1,.-1
MOVEI C,FORM
POPJ P,
MESOUT: PUSH P,C
HRLI M,(POINT 7,0)
MESOT1: ILDB C,M
JUMPE C,[POP P,C
POPJ P,]
PUSHJ P,UPTYP
JRST MESOT1
TYPEC: CAIE C,LF
JRST TYPE
PUSHJ P,TYPE
TTCALL 1,[EOL]
POPJ P,
TYPE: CAIN C,CR
TTCALL 1,[EOL]
TYPCHR: CAIN C,FORM
JRST TYPFRM
PUSHJ P,CHKEND
SKIPE CAPSIM
PUSHJ P,CHKCAP
CAIN C,ALT
JRST [ TTCALL 1,["$"]
POPJ P,]
TTCALL 1,C
CHKFIL: SKIPN TEMP,FILFLG
POPJ P,
CAIE C,LF
CAIN C,DWNARO
JRST (TEMP)
CAIE C,UPARO
CAIN C,EOS
JRST (TEMP)
CAIE C,HOME
POPJ P,
SETZM HORCNT
SETZM VERCNT
JRST (TEMP)
CHKCAP: CAIL C,"A"
CAILE C,"Z"
POPJ P,
PUSH P,C
MOVEI C,"^"
PUSHJ P,TYPEC
POP P,C
P OPJ P,
UPTYP: PUSHJ P,TYPEC
UPDATE: SETOM MOVFLG
CAIL C,40
CAIL C,175
JRST SPCCHR
UPDT1: SKIPGE HORCNT
SETZM HORCNT
SKIPE CAPSIM
PUSHJ P,CAPUP
AOS 1,HORCNT
CAIG 1,HORMAX
POPJ P,
IDIVI 1,HORMAX
MOVEM 2,HORCNT
SPLF: SKIPGE VERCNT
SETZM VERCNT
AOS 1,VERCNT
CAIGE 1,VERMAX
POPJ P,
MOVEI 1,VERMAX-1
MOVEM 1,VERCNT
POPJ P,
CAPUP: CAIL C,"A"
CAILE C,"Z"
POPJ P,
AOS HORCNT
POPJ P,
SPCCHR: CAIN C,11
JRST SPTAB
CAIN C,12
JRST SPLF
CAIN C,15
JRST SPCR
CAIN C,UPARO
JRST SPUPAR
CAIE C,BAKAR1
CAIN C,BAKARO
JRST SPBKAR
CAIN C,DWNARO
JRST SPDNAR
CAIN C,FORARO
JRST SP FRAR
CAIN C,ALT
JRST UPDT1
SETZM MOVFLG
POPJ P,
SPTAB: MOVE HORCNT
TRZ 7
ADDI 8
CAILE HORMAX
MOVEI 8
MOVEM HORCNT
POPJ P,
SPCR: SETZM HORCNT
POPJ P,
SPUPAR: SKIPG VERCNT
SETZM MOVFLG
MOVEI VERMAX-1
CAMGE VERCNT
MOVEM VERCNT
SOS VERCNT
POPJ P,
SPDNAR: MOVE VERCNT
CAIL VERMAX-1
SETZM MOVFLG
SKIPGE VERCNT
SETZM VERCNT
AOS VERCNT
POPJ P,
SPBKAR: SKIPG HORCNT
SETZM MOVFLG
MOVEI HORMAX
CAMGE HORCNT
MOVEM HORCNT
SOS HORCNT
POPJ P,
SPFRAR: MOVE HORCNT
CAIL HORMAX
SETZM MOVFLG
SKIPGE HORCNT
SETZM HORCNT
AOS HORCNT
POPJ P,
GETERR: TTCALL 11,
MOVEI M, [ASCIZ/
Use the format: NAME.EXT<CR>
/]
PUSHJ P,MESOUT
GETNAM: MOVEI M,[ASCIZ/File name? /]
PUSHJ P,MESOUT
MOVEI AC,6
MOVE T1,[POINT 6,NAME]
SETZM NAME
SETZM NAME+1
INCHWL C
JRST GETLP2
GETLOP: INCHSL C
JRST GETERR
GETLP2: CAIN C,15
JRST GETDON
CAIN C,"."
JRST GETEXT
SUBI C,40
IDPB C,T1
SOJG AC,GETLOP
GETLP1: INCHSL C
JRST GETERR
CAIN C,15
JRST GETDON
CAIE C,"."
JRST GETLP1
GETEXT: MOVEI AC,3
MOVE T1,[POINT 6,NAME+1]
GETELP: INCHSL C
JRST GETERR
CAIN C,15
JRST GETDON
SUBI C,40
IDPB C,T1
SOJG AC,GETELP
GETDON: TTCALL 11,
POPJ P,
PROOF: PUSHJ P,OVERWRITE
INIT PR F,0
SIXBIT /DSK/
EXP PIBUF
ERRMES (<DSK NOT AVAILABLE>)
INBUF PRF,2
HLLZS NAME1+1
SETZM NAME1+2
SETZM NAME1+3
LOOKUP PRF,NAME1
ERRMES(<Cannot find proof file.>)
SETOM PRFFLG
POPJ P,
GETPRF: SOSGE PIBUF+2
JRST GETPBF
ILDB C,PIBUF+1
JUMPE C,GETPRF
JRST CPOPJ1
GETPBF: IN PRF,
JRST GETPRF
SETZM PRFFLG
POPJ P,
PIBUF: BLOCK 3
OPNFIL: INIT 1,17
SIXBIT/DSK/
0
ERRMES(<DSK NOT AVAILABLE>)
SETZ P1,
LOOKUP DSK,NAME
JRST OPNFL1
MOVEI M,[ASCIZ/File already exists
Do you want to: Proof, Append, or Overwrite? /]
PUSHJ P,MESOUT
OPNFL2: INCHWL C
TTCALL 11,
CAIN C,"P"
JRST PROOF
CAIN C,"A"
JRST APPEND
CAIN C,"O"
JRST OVERWRITE
MOVEI M,[ASCIZ/ Answer A or O /]
PUSHJ P,MESOUT
JRST OPNFL2
APPEND: HLLZS NAME+1
SETZM NAME+2
HLRE P1,NAME+3
JUMPGE P1,OPNFL1
MOVMS P1
IDIVI P1,200
OPNFL1: AOS P1
MOVEM P1,BLKPNT
SETZM NAME+3
ENTER DSK,NAME
ERRMES(<ENTER FAILURE ON FILE>)
SETZM OUTCNT
MOVE P1,[POINT 7,BUFF]
MOVEM P1,OUTPNT
MOVEI P1,200*5
MOVEM P1,OUTCNT
MOVE P1,BLKPNT
USETO DSK,1(P1)
SETZM BUFF
MOVE T1,[XWD BUFF,BUFF+1]
BLT T1,BUFF+177
OUTPUT DSK,CL
CLOSE DSK,
LOOKUP DSK,NAME
ERRMES(<LOOKUP ERROR ON FILE>)
HLLZS NAME+1
SETZM NAME+2
SETZM NAME+3
EN TER DSK,NAME
ERRMES(<ENTER FAILURE ON FILE>)
MOVEI M,[BYTE (7)HOME,EOS,CR,0]
PUSHJ P,MESOUT
SETZM HORCNT#
SETZM VERCNT#
MOVEI T3,NLINES
APLOP: CAIG P1,1
POPJ P,
USETI DSK,-1(P1)
INPUT DSK,CL
MOVEI T1,177
ALP1: MOVEI T2,4
ALP2: LDB AC,PNTTAB(T2)
CAIN AC,12
SOJL T3,APTYP
ALP3: SOJGE T2,ALP2
SOJGE T1,ALP1
APTYP: SKIPGE T2
MOVEI T2,4
JUMPL T1,[ CAILE P1,2
SOJA P1,APLOP
MOVEI T2,4
JRST APTYP0]
APTYP0: MOVEI M,[BYTE (7)16,63,0]
PUSHJ P,MESOUT
PUSHJ P,FILL4
MOVEI C,40
TTCALL 1,C
MOVEI M,[ASCIZ/The last lines entered were:/]
PUSHJ P,MESOUT
MOVEI C,HOME
PUSHJ P,TYPEC
MOVE T3, PNTTAB(T2)
MOVE SAVTTY
TLNN (1B13)
SETOM CAPSIM
SETZM HORCNT
SETZM VERCNT
APTYP1: ILDB C,T3
JUMPE C,APTYP2
PUSHJ P,UPTYP
JRST APTYP1
APTYP2: IN DSK,CL
SKIPA T3,[POINT 7,BUFF]
POPJ P,
JRST APTYP1
PNTTAB: POINT 7,BUFF(T1),6
POINT 7,BUFF(T1),13
POINT 7,BUFF(T1),20
POINT 7,BUFF(T1),27
POINT 7,BUFF(T1),34
OVERWRITE: MOVEI AC,1000
MOVEI P1,0
OVLOOP: MOVEI T1,3
MOVE T2,[POINT 3,P1,26]
MOVE T3,[POINT 6,NAME1+1]
OVLP1: ILDB C,T2
ADDI C,20
IDPB C,T3
SOJG T1,OVLP1
MOVE T1,NAME
MOVEM T1,NAME1
HLLZS NAME1+1
SETZM NAME1+2
SETZM NAME1+3
LOOKUP DSK,NAME
ERRMES(<LOOKUP FAILURE ON F ILE>)
RENAME DSK,NAME1
JRST RFAIL
MOVEI M,[ASCIZ/Old file renamed to /]
PUSHJ P,MESOUT
MOVE T1,[POINT 6,NAME1]
RLOOP: ILDB C,T1
JUMPE C,REXT
ADDI C,40
PUSHJ P,TYPEC
TLNE T1,770000
JRST RLOOP
REXT: MOVEI C,"."
PUSHJ P,TYPEC
MOVE T1,[POINT 6,NAME1+1]
HLLZS NAME1+1
RELP: ILDB C,T1
JUMPE C,RDONE
ADDI C,40
PUSHJ P,TYPEC
JRST RELP
RDONE: MOVEI M,[ASCIZ/
/]
PUSHJ P,MESOUT
HLLZS NAME+1
SETZM NAME+2
SETZM NAME+3
SETZ P1,
JRST OPNFL1
RFAIL: AOS P1
SOJG AC,OVLOOP
ERRMES(<Cannot rename old file>)
INTBLK: XWD 4,INTLOC
EXP 2
0
0
INTLOC: PUSH P,1
AOS 1,DONFLG
CAIL 1,FRUST
ERRMES(<Job aborted without proper closing>)
HRRZ 1,INTBLK+2
CAIN 1,GETCH
JRST DONE
POP P,1
PUSH P,INTBLK+2
SETZM INTBLK+2
POPJ P,
DONE: SETZM INTBLK+2
SETZM CAPSIM
MOVEI TTY
RESDV.
JFCL
MOVEI C,EOS
PUSHJ P,TYPEC
MOVEI M,[ASCIZ/
Closing file.../]
PUSHJ P,MESOUT
SKIPN PRFFLG
SKIPE STOCNT
PUSHJ P,COPY
MOVE P1,BLKPNT
USETO DSK,(P1)
OUTPUT DSK,CL
CLOSE DSK,
MOVE SAVTTY
SETLCH
MOVEI 2010
MOVE 1,IOINDX
MOVEI 2,0
MOVSI 3,3
TRMOP. 3,
JFCL
SETZM .JBINT
MOVEI M,[ASCIZ/
Done!/]
PUSHJ P,MESOUT
EXIT 1,
JRST VTED
COPY: TTCALL 11,
SETOM FASTF
COPYA: PUSHJ P,GETBYT
POPJ P,
PUSHJ P,PUTCHR
JRST COPYA
GTBAUD: PJOB
TRMNO.
JFCL
MOVEM SOP+1
MOVEI P1,3
HRLOI P2,377777
GTWAIT: MOVE [XWD 2,SOP]
TRMOP.
SKIPA
JRST GTWAIT
MSTIME T2,
TTCALL 3,[BYTE (7)177,177,177,177,177,0]
GTLOOP: MOVE [XWD 2,SOP]
TRMOP.
SKIPA
JRST GTLOOP
MSTIME T1,
SUB T1,T2
CAMGE T1,P2
MOVE P2,T1
SOJG P1,GTWAIT
SETZ T1,
CAIG P2,5*^D33-^D17
MOVEI T1,FILL1
CAIG P2,5*^D16-^D17
MOVEI T1,FILL2
CAIG P2,5*^D8-^D17
MOVEI T1,FILL4
MOVEM T1,FILFLG
MOVEI 0,1017
MOVE 1,IOINDX
MOVSI 3,2
TRMOP. 3,
POPJ P,
MOVEI 1,FILL4
CAIN 3,0
POPJ P,
CAIN 3,1
MOVEI 1,FILL1
CAIN 3 ,2
MOVEI 1,FILL2
CAMGE 1,FILFLG
MOVEM 1,FILFLG
POPJ P,
FILL4: PUSHJ P,FILL2
FILL2: PUSHJ P,FILL1
FILL1: MOVEI TEMP,0
TTCALL 15,TEMP
POPJ P,
TIBUF: BLOCK 3
SOP: 2
0
SIPBLK: 1
IOINDX: 0
FRMBLK: 2006
0
1
NAME1: BLOCK 4
NAME: SIXBIT/FILE/
0
0
0
0
BLKPNT: 0
OUTPNT: 0
OUTCNT: 0
CL: IOWD 200,BUFF
0
PDLEN=20
PDLST: BLOCK PDLEN
SBUFL=^D20
SBUF: BLOCK SBUFL
SBUF1: BLOCK SBUFL
BUFF: BLOCK 200
0
STOBUF: 0
END VTED