title DOWNLD - Print file in super-image mode to tty with interrupts locked out ;; Author: KMP ;; ;; Notes: ;; ;; Block mode io would help speed a lot. ;; ;; TTY input buffer should be regularly flushed so that input buffer overflow ;; from line noise doesn't cause ITS to type ^G's in middle of this. ;; ;; Should do 8-bit i/o .insrt syseng;$call macro ;; Register Allocation a=:1 b=:2 c=:3 d=:4 e=:5 ch=:6 part=:7 p=:17 ;; Channel Allocation in.tty==:0 ou.tty==:1 in.fil==:2 ;; Random Compile-Time Constants jclsiz==20 ; Give us 16. x 5 = 80. chars of JCL outsiz==2048. ; 2K words of storage ;; Useful macro support define syscal op,args .call [setz ? sixbit /op/ ? args ((setz))] termin call=: ; Just say "call routine" return=: ; Just say "return" skip.=: ; Use before return to get skip-return ;; Allocate Working Areas jclbuf: block jclsiz ; Allocate JCL buffer -1 ; end marker outbuf: block outsiz ; Allocate output buffer -1 ; end marker ;; Flags and other memory fn1: 0 fn2: sixbit /DOWNLD/ dev: sixbit /DSK/ dir: 0 file: ; for referencing previous 4 count: 0 j.end: -1 ; If zero, end of JCL downld: .suset [-2,,[ .RHSNAME,,DIR ? .RXUNAME,,FN1 ]] jclbeg: .break 12,[..RJCL,,JCLBUF] ; Read JCL move a,[440700,,JCLBUF] ; Init JCLBUF byte-pointer in a move part,[-4] ; Set part to -4 j.get: setz c, ; Zero out c setz d, ; Zero out d j.whit: move b,a ; Get a byte-pointer in b ildb ch,b ; Get a char caie ch,^I ; If a tab cain ch,40 ; or a rubout jrst [move a,b ; update byte pointer jrst j.whit] ; and loop j.get1: move b,[440600,,d] ; 1-word buffer in d, pointer in b j.loop: aos c ; Increment char count ildb ch,a ; Load char from JCLBUF into ch caie ch,^M ; If char is a carriage return cain ch,^C ; or a control-c jrst j.exit ; or a control-_ cain ch,^_ ; then we're done jrst j.exit ; cain ch,": ; Look for colon, jrst j.coln cain ch,"; ; Look for semi, jrst j.semi cain ch,40 ; Look for space, jrst j.more caile c,6 ; Skip if greater than 6 chars jrst j.loop ; back to start of loop cail ch,140 ; Maybe upcase subi ch,40 ; Subtract 40 subi ch,40 ; subtract off some more andi ch,77 ; Get rid of this bit idpb ch,b ; Deposit jrst j.loop ; Try for another char j.coln: movem d,dev ; Device move jrst j.next j.semi: movem d,dir jrst j.next j.exit: setzm j.end ; Say we are done skipn d ; If no text, jrst openup ; Go print file j.more: movem d,file(part) ; Move to default location aosl part ; Increment. Skip if in range move part,[-4] ; mod negative 4 j.next: skipe j.end ; If done, jrst j.get ; go get more JCL openup: $call open,[#in.tty,[sixbit /tty/]][][#.uai] .lose %lsfil $call open,[#ou.tty,[sixbit /tty/]][][#.uao\%tjsio] .lose %lsfil $call open,[#in.fil,dev,fn1,fn2,dir][][#.uai] .lose %lsfil ttyset: $call ttyget,[#in.tty][a,b,c] jrst die ior c,[2,,] $call ttyset,[#in.tty,0,0,c] jrst die movei c,[%tdqot] ; Get a quote in c pr.top: .iot in.fil,a ; Get a char hlrz b,a ; Get left half in b cain b,-1 ; Check for left half of -1 jrst done ; Exit at end of file cain a,^C ; If ^C jrst done ; Exit also .iot ou.tty,c ; Output a quote .iot ou.tty,a ; Output a char jrst pr.top done: .iot ou.tty,[^M] .iot ou.tty,[^J] $call close,[#in.file] .lose %lsfil $call close,[#ou.tty] .lose %lsfil $call close,[#in.tty] .lose %lsfil die: .logout 1, end downld