1
0
mirror of https://github.com/PDP-10/its.git synced 2026-05-01 05:59:11 +00:00
Files
PDP-10.its/src/sysen1/stylog.35
Eric Swenson e793205336 Added STYLOG.
2016-12-11 11:10:04 -08:00

294 lines
7.0 KiB
Plaintext
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
title STYLOG -- Convert a PTY output file to a ascii log file
X=0
a=1
b=2
c=3
d=4
e=5
f=6
t=7
tt=10
sp=17
p=sp
pdllen==40
buflen==1000
dski==1
dsko==2
dspc==3
tboc==4
tyic==5
call=pushj sp,
ret=popj sp,
pjrst==jrst ;JRST hack JRST, I.e. PUSHJ SP, ? RET
$$RFN==-1 ;we want the RFN routine
$$SWITCH==-1 ;we want to handle switches
.insrt syseng;rfn >
define syscal a,b
.call [setz ? sixbit/a/ ? b ? setz+errret+calerr] termin
argi==1000,,0
val==2000,,0
errret==3000,,0
cnt==4000,,0
cnti==5000,,0
define type &string
move t,[440700,,[ascii string]]
movei tt,<.length string>
syscal siot,[argi dspc ? t ? tt]
.lose %lsfil
termin
go: move sp,[-pdllen,,pdl]
syscal open,[cnti .uao+%TJDIS
argi dspc
[sixbit /TTY/]]
.lose %lsfil
syscal open,[cnti .uai ;TTY input channel
argi tyic
[sixbit /TTY/]]
.lose %lsfil
syscal open,[cnti .uio+%TJSIO ;super-image output channel
argi tboc ; (TTY Buffer Output Channel)
[sixbit /TTY/]]
.lose %lsfil
.suset [.rsnam,,ifile+$dir]
.break 12,[5,,jclbuf] ;Get JCL
skipn jclbuf ;did he give JCL?
jrst help ; nope, give him help
ldb b,[350700,,jclbuf]
camn b,"? ;asking for help?
jrst help ; give it to him!
move d,[440700,,jclbuf]
movei b,ifile ;read it as the INPUT file
call rfn"rfn
skipn outp ;is this the output file instead?
jrst indef ; no, go default the input
move x,[ifile,,ofile]
blt x,ofile+3 ;make it the output file instead
setzm ifile
move x,[ifile,,ifile+1] ;Clear the input file block
blt x,ifile+3
movei b,ifile
call rfn"rfn ;read the input file again.
indef: skipn ifile+$dev ;was the device given?
jrst [move x,[sixbit /DSK/]
movem x,ifile+$dev
jrst .+1]
skipn ifile+$fn1 ;was the FN1 specified?
jrst [move x,[sixbit /STYOUT/]
movem x,ifile+$fn1
jrst .+1]
skipn ifile+$fn2 ;was the fn2 specified?
jrst [move x,[sixbit />/]
movem x,ifile+$fn2
jrst .+1]
skipn ifile+$dir ;was the dir specified?
.suset [.rsname,,ifile+$dir] ; use the default
syscal open,[cnti .uii
argi dski
ifile+$dev
ifile+$fn1
ifile+$fn2
ifile+$dir]
.lose %lsfil
outdef: skipn ttyswp ;is it /T
skipe out ; with no output file?
caia ; nope
jrst out ; yes, don't write a file
skipn ofile+$dev ;was the default specified?
jrst [move x,ifile+$dev
movem x,ofile+$dev
jrst .+1]
skipn ofile+$fn1 ;was the fn1 specivied?
jrst [move x,ifile+$fn1 ; no, use the input default!
movem x,ofile+$fn1
jrst .+1]
skipn ofile+$fn2 ;was the fn2 spec'd?
jrst [move x,[sixbit /STYLOG/]
movem x,ofile+$fn2
jrst .+1]
skipn ofile+$dir ;was the dir spec'd?
jrst [move x,ifile+$dir
movem x,ofile+$dir
jrst .+1]
syscal open,[cnti .uao ;open output channel
argi dsko
ofile+$dev
ofile+$fn1
ofile+$fn2
ofile+$dir]
.lose %lsfil
out: skipe ttyswp ;are we typeing?
jrst [type /C/ ; yes, clear the screen first!
jrst .+1]
setz b, ;not at end of file...
setz c, ;but have no characters left in buffer
outlop: call getchr ;get a character
skipe ttyswp ;is the /T switch on?
.iot tboc,d ; yes, type it out
skipn ttyswp ;is it /T
skipe out ; with no output file?
caia ; nope
jrst outlop ; yes, don't write a file
caige d,200 ;is it ascii?
.iot dsko,d ; yes, output it
cail d,%TDMAX ;is it legal?
jrst [type /AUnknown %TD code received!/
jrst outlop] ;continue
cail d,200 ;is it a buffer code?
xct buftab-200(d) ; yes, dispatch to an operation to handle
;it
jrst outlop ;keep on trucking!
;;; get a eight-bit character from disk
getchr: sosl c ;are there still chars in buffer?
jrst [ildb d,a ; yes, get the character
ret] ; and return it
skipe b ;is there more?
jrst [.close dsko, ; nope!
.logout 1,] ; all done!
move a,[444400,,buffer]
movei b,buflen
syscal SIOT,[argi dski ? a ? b]
.lose 1400
move a,[441000,,buffer]
movei c,buflen*4
movei d,(b)
imuli d,4
subi c,(d) ;approximate
jrst getchr ;and actually get the character
jclbuf: block 100
buffer: block buflen
block 2
buftab: call 4flush ;200 - %TDMOV flush 4 bytes
call 2flush ;201 - %TDMV1 flush 2 bytes
jfcl ;202 - %TDEOF nothing I can think of
jfcl ;203 - %TDEOL nothing I can think of
jfcl ;204 - %TDDLF nothing I can think of
jfcl ;205 - %TDMTF Ignore, no motors in files!
jfcl ;206 - %TDMTN Ignore, no motors in files!
call crlf ;207 - %TDCRL new line
jfcl ;210 - %TDNOP nothing at all
.iot dsko,[^H] ;211 - %TDBS backspace
.iot dsko,[^J] ;212 - %TDLF linefeed
.iot dsko,[^M] ;213 - %TDCR carraige return
jfcl ;214 - %TDORS Output reset?? Foo!
jfcl ;215 - %TDQOT quote next char
.iot dsko,[40] ;216 - %TDFS Space forward one
call 2flush ;217 - %TDMV0 flush 2 bytes
call [skipe pausep ;220 - %TDCLR clear screen ... just terpri
jrst [type /STZ/
.iot tyic,x
type /R/
jrst .+1]
pjrst crlf]
.iot dsko,[^G] ;221 - %TDBEL [DING]
jfcl ;222 - %TDINI System startup???
call [call crlf ;223 - %TDILP insert line
pjrst 1flush]
call [call crlf ;224 - %TDDLP delete line (insert a CRLF to
pjrst 1flush] ; avoid confusions
jfcl ;225 - %TDICP nothing I can think of
jfcl ;226 - %TDDCP nothing I can think of
jfcl ;227 - %TDBOW nothing I can think of
jfcl ;230 - %TDRST nothing I can think of
jfcl ;231 - I dunno what this is
jfcl ;232 - I dunno what this is
crlf: .iot dsko,[^M] ;CR
.iot dsko,[^J] ;LF
ret
1flush: call getchr ;Get a character
skipe ttyswp ;type it?
.iot tboc,d ; yes, gotta do it!
ret
2flush: call 1flush ;flush twice
pjrst 1flush
4flush: call 2flush ;flush twice twice
pjrst 2flush
pdl: block pdllen
$DEV==0 ;offsets into a file block
$FN1==1
$FN2==2
$DIR==3
IFILE: block 4 ;input file names go here
OFILE: block 4 ;output file names go here
outp: 0 ;non-zero if we got an output file
rsixtp: caie a,"/ ;is it a start of a switch?
cain a,"(
jrst popj1
caie a,"_ ;_ terminates
ret
setom outp ;note we got an output file first
popj1: aos (sp) ;skip return
ret
switch: cain a,"T ;is it a T?
setom ttyswp ; yes, so we want to type
cain a,"P ;is it a P?
setom pausep ; yes, so we want to pause on %TDCLR
ret
ttyswp: 0
pausep: 0
calerr: 0 ;error return for SYSCAL's
help: type /AUsage: :STYLOG <output file>_<input file>
Default output file is to use the same FN1 as the input file
or vice versa, and FN2 of STYLOG
There are 2 switches, T and P:
T means to print the file on the TTY instead, unless an explicit output file
was given.
P means to pause before clearing the screen.
/
.logout 1,
end go