Trailing-Edge
-
PDP-10 Archives
-
decuslib20-02
-
decus/20-0069/rtrans.mac
There are 2 other files named rtrans.mac in the archive. Click here to see a list.
TITLE RTRANS
ENTRY RTRANS
DEFINE ERRMES(A)
< JRST [TTCALL 3,[ASCIZ/A/]
EXIT]>
P=17
C=16
M=15
S=14
N1=13
N=12
SCNT=11
COL=10
PT=7
PU=6
AC=0
T1=1
INP=1
OUT=2
RTRANS: RESET
MOVE P,[IOWD PDLEN,PDLST]
seto
getlch
tlz (1b13)
setlch
SETZB SCNT,SCNCNT#
SETZB COL,BUFCNT#
SETZM TEXTF#
SETOM LFTMAR#
SETZM UNDFLG#
MOVE AC,[POINT 7,SBUF]
MOVEM AC,GETPNT#
MOVEM AC,BUFPNT#
MOVEM AC,SCNPNT#
GETIN: TTCALL 3,[ASCIZ/INPUT /]
PUSHJ P,GETNAM
MOVE NAME
MOVEM INAME
HLLZ NAME+1
MOVEM INAME+1
PUSHJ P,OPNIFL
JRST [ TTCALL 3,[ASCIZ/FILE NOT FOUND
/]
JRST GETIN]
GETOUT: TTCALL 3,[ASCIZ/OUTPUT /]
PUSHJ P,GETNAM
MOVE NAME
MOVEM ONAME
HLLZ NAME+1
MOVEM ONAME+1
PUSHJ P,OPNOFL
JRST [ TTCALL 3,[ASCIZ/CANNOT ENTER OUTPUT FILE
/]
JRST GETOUT]
MOVEI M,[ASCIZ/.SPACING 1
.TAB STOPS 8,16,24,32,40,48,56,64,72
/]
PUSHJ P,MESOUT
JRST LF1
LOOP: PUSHJ P,GETCHR
CAIN C,12
JRST LF
CAIN C,2
JRST .BREAK
OKOUT: PUSHJ P,PUTCHR
JRST LOOP
.BREAK: MOVEI M,[ASCIZ/
.BREAK
/]
PUSHJ P,MESOUT
SETOM LFTMAR
PUSHJ P,SCANI
MOVEI S,2
PUSHJ P,SCAN
CAIN S,12
JRST LOOP
JRST LF1
LF: PUSHJ P,PUTCHR
LF1: PUSHJ P,UNDSCN
pushj p,tabscn
SETZ N,
PUSHJ P,SCANI
LFSCAN: MOVEI S,2
PUSHJ P,SCAN
CAIN S,12
AOJA N,LFSCAN
JUMPG N,.SKIP
PUSHJ P,SCANI
PUSHJ P,SCAN1
CAIN S,"."
JRST COMAND
CAIN S,11
JRST LFTAB
CAIN S," "
JRST LFSPAC
CAIN S,14
JRST LFFORM
SKIPN LFTMAR
JRST LOOP
SETZB N,SAVN
JRST LFSP1A
UNDSCN: SETZB N,UNDFLG
PUSHJ P,SCANI
PUSHJ P,SCANLF
UNDLOP: PUSHJ P,SCAN1
CAIE S," "
CAIN S,11
AOJA N,UNDLOP
CAIN S,"-"
AOJA N,UNDLOP
CAIE S,15
POPJ P,
JUMPE N,CPOPJ
SETOM UNDFLG
POPJ P,
tabscn: pushj p,scani
tabslp: pushj p,scan1
JUMPE S,CPOPJ
cain s,15
popj p,
caie s," "
cain s,11
jrst tabslp
tbslp1: pushj p,scan1
jumpe s,cpopj
cain s,15
popj p,
caie s,11
jrst tbslp1
movei m,[asciz/
.break
/]
jrst mesout
.SKIP: MOVEI M,[ASCIZ/.SKIP /]
PUSHJ P,MESOUT
PUSHJ P,DECOUT
PUSHJ P,CRLF
SETOM LFTMAR
PUSHJ P,SCANI
.SKIP1: PUSHJ P,GETCHR
PUSHJ P,SCAN1
CAIE S,15
CAIN S,12
JRST .SKIP1
JRST LF1
COMAND: SETOM LFTMAR
PUSHJ P,SCAN1
JUMPE S,FINI
CAIN S,12
JRST LOOP
PUSHJ P,GETCHR
PUSHJ P,PUT
JRST COMAND
LFSPAC: MOVEI N,1
LFSPC1: PUSHJ P,SCAN1
CAIN S," "
AOJA N,LFSPC1
CAIN S,11
JRST LFTAB1
MOVEM N,SAVN#
LFSP1A: PUSHJ P,SCANLF
SKIPE UNDFLG
PUSHJ P,SCANLF
MOVEI N,0
LFSPC2: PUSHJ P,SCAN1
CAIN S," "
AOJA N,LFSPC2
CAIN S,11
JRST LFTAB2
CAMN N,SAVN
JRST SETLM
EXCH N,SAVN
CAME N,LFTMAR
JRST .INDEN
JRST LOOP
LFTAB: MOVEI N,8
JRST LFSPC1
LFTAB1: TRZ N,7
ADDI N,8
JRST LFSPC1
LFTAB2: TRZ N,7
ADDI N,8
JRST LFSPC2
LFFORM: PUSHJ P,GETCHR
PUSHJ P,SCAN1
JUMPE S,FINI
MOVEI M,[ASCIZ/.PAGE
/]
PUSHJ P,MESOUT
JRST LF
SETLM: CAMN N,LFTMAR
JRST LOOP
MOVEM N,LFTMAR#
MOVEI M,[ASCIZ/.LEFT MARGIN /]
PUSHJ P,MESOUT
PUSHJ P,DECOUT
PUSHJ P,CRLF
JRST LOOP
.INDEN: EXCH N,SAVN
CAMN N,LFTMAR
JRST .IDEN1
MOVEM N,LFTMAR
MOVEI M,[ASCIZ/.LEFT MARGIN /]
PUSHJ P,MESOUT
PUSHJ P,DECOUT
PUSHJ P,CRLF
.IDEN1: MOVE N,SAVN
MOVEI M,[ASCIZ/.INDENT /]
PUSHJ P,MESOUT
SUB N,LFTMAR
PUSHJ P,DECOUT
PUSHJ P,CRLF
JRST LOOP
OPNIFL: INIT INP,0
SIXBIT/DSK/
IBUF
ERRMES(<DSK NOT AVAILABLE>)
LOOKUP INP,INAME
POPJ P,
JRST CPOPJ1
OPNOFL: INIT OUT,0
SIXBIT/DSK/
XWD OBUF,0
ERRMES(<DSK NOT AVAILABLE>)
ENTER OUT,ONAME
CPOPJ: POPJ P,
CPOPJ1: AOS (P)
POPJ P,
GETERR: TTCALL 11,
TTCALL 3,[ASCIZ/
USE THE FORMAT: NAME.EXT<CR>
/]
GETNAM: TTCALL 3,[ASCIZ/FILE NAME? /]
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,
NAME: BLOCK 4
IBUF: BLOCK 3
OBUF: BLOCK 3
INAME: SIXBIT/INPUT/
0
0
0
0
ONAME: SIXBIT/OUTPUT/
0
0
0
0
0
GET: SOSGE IBUF+2
JRST GETBF
ILDB C,IBUF+1
JUMPE C,GET
POPJ P,
GETBF: IN INP,
JRST GET
GETSTS INP,AC
TRNE AC,74B23
ERRMES(<READ ERROR ON INPUT FILE>)
TRNN AC,1B22
ERRMES(<UNEXPLAINABLE INPUT FAILURE>)
MOVEI C,0
POPJ P,
PUTCHR: CAIN C,12
JRST [ SETZB COL,TEXTF
SKIPE UNDFLG
JRST CLRLIN
JRST PUT]
CAIN C,11
JRST PUTTAB
SKIPE UNDFLG
PUSHJ P,SCANU
CAIN C," "
JRST PUTSPA
CAIE C,"&"
CAIN C,"^"
PUSHJ P,PUTBAK
CAIE C,"#"
CAIN C,"\"
PUSHJ P,PUTBAK
CAIN C,"_"
PUSHJ P,PUTBAK
CAIN C,"."
PUSHJ P,[ SKIPE TEXTF
POPJ P,
JRST PUTBAK]
CAIL C,"A"
CAILE C,"Z"
SKIPA
PUSHJ P,PUTUP
SETOM TEXTF
AOJA COL,PUT
PUTBAK: MOVEM C,SAVC#
MOVEI C,"_"
JRST PUTUP1
PUTUP: MOVEM C,SAVC
MOVEI C,"^"
PUTUP1: PUSHJ P,PUT
MOVE C,SAVC
POPJ P,
PUTTAB: MOVE PT,COL
TRZ PT,7
ADDI PT,8
SKIPE TEXTF
JRST [MOVEM PT,COL
JRST PUT]
SUB PT,COL
MOVEI C," "
PUSHJ P,PUTCHR
SOJG PT,.-2
POPJ P,
PUTSPA: SKIPN TEXTF
JRST PUTSP1
CAMGE COL,LFTMAR
MOVEI C,"#"
PUSHJ P,PUT
PUTSP1: AOJA COL,CPOPJ
PUT: SOSG OBUF+2
JRST PUTBF
PUTC: IDPB C,OBUF+1
CAIN C,12
SETZB COL,TEXTF
POPJ P,
PUTBF: OUT OUT,
JRST PUTC
ERRMES(<OUTPUT ERROR>)
CLRLIN: PUSHJ P,PUT
SETZM UNDFLG
CLRLN1: PUSHJ P,GETCHR
JUMPE C,CPOPJ
CAIE C,12
JRST CLRLN1
POPJ P,
MESOUT: HRLI M,(POINT 7,0)
MESLOP: ILDB C,M
JUMPE C,CPOPJ
PUSHJ P,PUT
JRST MESLOP
CRLF: MOVEI C,15
PUSHJ P,PUT
MOVEI C,12
JRST PUT
DECOUT: JUMPGE N,DECOT0
MOVEI C,"-"
PUSHJ P,PUT
MOVMS N
DECOT0: IDIVI N,12
HRLM N1,(P)
SKIPE N
PUSHJ P,DECOT0
HLRZ C,(P)
ADDI C,60
JRST PUT
GETCHR: MOVE AC,GETPNT
CAMN AC,BUFPNT
JRST GETNXT
CAMN AC,[POINT 7,SBUFE,34]
MOVE AC,[POINT 7,SBUF]
ILDB C,AC
MOVEM AC,GETPNT
SKIPG SCNCNT
MOVEM AC,SCNPNT
SOSGE SCNCNT
SETZM SCNCNT
SOSGE BUFCNT
ERRMES(<BUFFER POINTER IS MESSED UP>)
JUMPE C,FINI
POPJ P,
GETNXT: PUSHJ P,GET
JUMPE C,FINI
POPJ P,
FINI: EXIT
SCAN1: MOVE AC,SCNPNT
CAMN AC,BUFPNT
JRST LODBUF
CAMN AC,[POINT 7,SBUFE,34]
MOVE AC,[POINT 7,SBUF]
MOVEM AC,SCNPNT
ILDB S,SCNPNT
AOS SCNCNT
CAIN S,2
JRST SCAN1
POPJ P,
LODBUF: PUSHJ P,GET
MOVE AC,BUFPNT
CAMN AC,[POINT 7,SBUFE,34]
MOVE AC,[POINT 7,SBUF]
MOVEM AC,BUFPNT
IDPB C,BUFPNT
AOS T1,BUFCNT
CAIG T1,BUFSIZ
JRST SCAN1
ERRMES(<OVERFLOWED BUFFER SPACE>)
SCANI: MOVE AC,GETPNT
MOVEM AC,SCNPNT
SETZM SCNCNT
POPJ P,
SCAN: MOVE SCNT,S
PUSHJ P,SCAN1
SOJG SCNT,.-1
POPJ P,
SCANLF: PUSHJ P,SCAN1
JUMPE S,CPOPJ
CAIE S,12
JRST SCANLF
POPJ P,
SCANU: PUSH P,SCNPNT
PUSH P,SCNCNT
PUSHJ P,SCANI
PUSHJ P,SCANLF
MOVE PU,COL
SULOP: PUSHJ P,SCAN1
CAIN S," "
SOJG PU,SULOP
CAIN S,"-"
SOJG PU,SULOP
CAIE S,11
JRST SUDONE
SUBM COL,PU
TRZ PU,7
ADDI PU,8
SUBM COL,PU
JUMPG PU,SULOP
JUMPL PU,SURET
SUDONE: JUMPN PU,SURET
PUSHJ P,SCAN1
CAIE S,"-"
JRST SURET
MOVEM C,SAVC
MOVEI C,"&"
PUSHJ P,PUT
MOVE C,SAVC
SURET: POP P,SCNCNT
POP P,SCNPNT
POPJ P,
PDLEN=10
PDLST: BLOCK PDLEN
SBUFSZ=100
BUFSIZ=SBUFSZ*5
SBUF: BLOCK SBUFSZ
SBUFE: 0
END RTRANS