;-*- Midas -*- GZ@MIT-MC, November, 1983 TITLE TYPE8 Type an 8-bit file T1==1 T2==2 T3==3 T4==4 A=5 B=6 ;Current input byte C=7 ;Number of bits left in file. D=10 E=11 IntAC=16 P=17 inch==1 outch==2 tyoch==3 tyich==4 call= return= pdllen==40 .vector pdl(pdllen) Jclbuf: block 40 ^C_35 IDev: sixbit/DSK/ IFn1: 0 IFn2: sixbit/>/ ISnm: 0 define syscal op,args .call [setz ? sixbit/op/ ? args ((setz))] termin tsiot: setz sixbit/SIOT/ %Climm,,tyoch T2 T1 ((setz)) define type &string movei T1,<.length string> move T2,[440700,,[ascii string]] .call tsiot .Lose %LsSys termin Tsint: loc 42 -Tsintl,,Tsint loc Tsint P 0 ? 1_tyich ? 0 ? <1_tyich>\<1_outch> ? Flush 0 ? 1_outch ? 0 ? 0 ? More Tsintl==.-Tsint Flush: movei IntAC,tyich .ityic IntAC, jrst intret caie IntAC,^G cain IntAC,^S jrst flush1 intret: syscal dismis,[p] .Lose %LsSys flush1: .reset tyoch, syscal ttyfls,[%clbit,,1 ? %climm,,tyich] .Lose %LsSys .iot tyoch,IntAC Jrst Die More: push p,T1 push p,T2 type "--More--" syscal iot,[%clbit,,%tipek ? %climm,,tyich ? %clout,,IntAc] .Lose %LsFil caie IntAc,40 cain IntAc,177 .iot tyich,IntAc caie IntAc,40 jrst [type "Flushed" jrst Die] type "A" pop p,T2 pop p,T1 jrst intret RSIXTP: return $$RFN==1 .insrt dsk:syseng;rfn > FType: move T1,IDev call 6Type .iot tyoch,[":] move T1,ISnm call 6Type .iot tyoch,[";] move T1,IFn1 call 6Type .iot tyoch,[40] move T1,IFn2 6Type: setz T2, rotc T1,6 addi T2,40 .iot tyoch,T2 jumpn T1,6Type return Begin: move p,[-pdllen,,pdl-1] syscal open,[%clbit,,.uao\%tjdis ? %climm,,tyoch ? [sixbit/TTY/]] .Lose %LsFil .suset [-2,,[.rHsname,,ISnm ? .rXuname,,IFn1]] .break 12,[..rJCL,,Jclbuf] skipn Jclbuf jrst Help ldb T1,[261600,,Jclbuf] cain T1,_-26 jrst Help movei B,IDev move D,[440700,,Jclbuf] call RFN"rfn syscal open,[%clbit,,.uii ? %climm,,inch ? IDev ? IFn1 ? IFn2 ? ISnm] jrst [type "A" call FType type " - file not found." jrst Die] syscal fillen,[%climm,,inch ? %clout,,C] .Lose %LsFil jumpe C,Die .iot inch,T1 ;Flush COM header if any camn T1,[sixbit/DSK8/] sosa C .access inch,[0] ; .suset [.rMemt,,T1] ; movei T2,FBuf(C) ; camg T2,T1 ; jrst Snarf ; movei T1,1777(T2) ; trz T1,1777 ; .suset [.sMemt,,T1] ;Snarf: move T1,[004400,,FBuf] ; move T2,C ; syscal siot,[%climm,,inch ? T1 ? T2] ; .Lose %LsFil ; .close inch, syscal open,[%clbit,,.uao ? %climm,,outch ? [sixbit/TTY/]] .Lose %LsFil syscal open,[%clbit,,.uai ? %climm,,tyich ? [sixbit /TTY/]] .Lose %LsFil ; syscal ttyset,[%climm,,tyich ? [424242,,424242] ? [434242,,424242]] syscal ttyset,[%climm,,tyich ? [222222,,222222] ? [230222,,220222]] .Lose %LsSys .suset [-2,,[.sOption,,[optint,,] ? .sMSK2,,[<1_tyich>\<1_outch>]]] ; move B,[441000,,FBuf] ; imuli C,4 ;outp: sojl C,Die ; ildb T1,B ; cain T1,^Z ; jrst Die ; .iot outch,T1 ; jrst outp outp: sojl C,Die .iot inch,A move B,[441000,,A] outp1: ildb T1,B cain T1,^Z jrst Die .iot outch,T1 tlne B,700000 jrst outp1 jrst outp Help: type "A:TYPE8 input file Types an ascii file encoded in 8-bit bytes. Stops at first ^Z." Die: .break 16,120000 VARIAB junk: CONSTA FBuf: 0 end begin