; -*- MIDAS -*- title H3MAKE -- Run HOSTS3 under DRAGON to make SYSBIN;HOSTS3 > p==17 ? call==: ? ret==: .insrt DSK:SYSENG;T20MAC > .insrt DSK:SRA;USEFMT > debug: 0 tgtdev: sixbit 'DSK' tgtfn1: sixbit 'HOSTS3' tgtfn2: sixbit '>' ; must be ">" tgtdir: sixbit 'SYSBIN' srcdev: sixbit 'DSK' srcfn1: sixbit 'H3TEXT' srcfn2: sixbit '>' ; must be ">" srcdir: sixbit 'SYSHST' pgmdev: sixbit 'DSK' pgmfn1: sixbit 'HOSTS3' pgmfn2: sixbit 'BIN' pgmdir: sixbit 'SYSHST' pgmjnm=:pgmfn1 tyodev: sixbit 'DSK' ; These four must stay in order tyofn1: sixbit 'H3TYO' tyofn2: 0 ; Clobbered tyodir: sixbit 'SYSHST' tyoerr: sixbit 'H3ERR' usri==:0 usro==:1 dski==:2 dsko==:3 define syscall name,args .call [setz ? sixbit /name/ ? args((setz))] termin .scalar trudev, trudir, trufn1, trufn2 .vector jcl(jcllen==40), pdl(lpdl==200) ifndef ubpfj,ubpfj==:10 ; why doesn't this have a name??? begin: move p,[-lpdl,,pdl-1] .suset [.roption,,] tlo %opint\%opopc .suset [.soption,,] skipe debug ifskp. tlne %opddt ; running under DDT? .value [asciz " "] ; yeah, disown self endif. go: ;; Figure out if there's anything for us to do syscal open,[[.uai\%donrf,,dski] ? srcdev ? srcfn1 ? srcfn2 ? srcdir] .logout 1, ; No source, punt syscal rfname,[movei dski ? movem trudev movem trufn1 ? movem trufn2 ? movem trudir] .lose %lssys move 1,trufn2 movem 1,tyofn2 syscal open,[[.uai\%donrf,,dski] ? tgtdev ? tgtfn1 ? tgtfn2 ? tgtdir] .lose %lsfil syscal rfname,[movei dski ? repeat 3,[ ? movem 1]] .lose %lssys call sixnum ; Convert target fn2 move 2,1 move 1,trufn2 ; Convert source fn2 call sixnum camge 2,1 ; Check them ifskp. skipe debug .value [asciz ": Target newer than sources, done. CONTINUE"] .logout 1, endif. ;; Check for existing instance of compiler. syscal open,[[ubpfj+.uii,,usri] ? ['usr,,0] ? movei 0 ? pgmjnm] ifskp. ; Hmm, it exists .uset usri,[.rustp,,1] ; Is it running? tlne 1,100000 ; 4.7 (BUSRC) is the only bit that counts ifskp. ; Yeah, leave it alone skipe debug .value [asciz ": Previous instance of inferior running. "] .logout 1, ; Nothing left to do endif. ; We have a dead one on our hands skipe debug .value [asciz ": Dead previous instance of inferior!! "] call kvetch ; Go complain and die format -dsko,"There is already a dead job named ~S ~S.~@ Perhaps someone should examine the corpse.~ ",[myunam,pgmjnm] ret endif. ; No previous instance if get here ;; Check for previous attempt at compilation. syscal open,[[.uai\%donrf,,dski] ? tyodev ? tyofn1 ? tyofn2 ? tyodir] ifskp. skipe debug .value [asciz ": Previous attempt at compilation failed? "] call kvetch ; Go complain and die format -dsko,"It looks like a previous attempt failed.~@ The file ~S:~S;~S ~S might explain the problem.~ ",[tyodev,tyodir,tyofn1,tyofn2] ret endif. ;; Set up program. syscal open,[[.uio,,usro] ? ['usr,,0] ? movei 0 ? pgmjnm] .lose syscal open,[[.uii,,usri] ? ['usr,,0] ? movei 0 ? pgmjnm] .lose syscal open,[[.uii,,dski] ? pgmdev ? pgmfn1 ? pgmfn2 ? pgmdir] .lose ; get program file syscal load,[movei usro ? movei dski] .lose ; load program file .iot dski,3 ; get start address tlz 3,-1 ; clear random bits .close dski, ; done with disk channel .uset usri,[.supc,,3] ; set starting address .uset usri,[.soption,,[%opcmd,,]] ; say we have jcl .uset usri,[.rintb,,4] ; get job's interrupt bit .suset [.simsk2,,4] ; enable it for ourself syscall delete,[tyodev ? tyofn1 ? [sixbit '<'] ? tyodir] jfcl syscal tranad,[[2,,usri] ? [-1,,[sixbit 'tty']] ? [-4,,tyodev]] .lose ; translate TTY to output filename move 1,[440700,,jcl] ; generate appropriate JCL format 1,|~ GWHOSTS ALLSERVER OUTFMT HOSTS3 OUTFIL ~S: ~S; ~S ~S RFC810 INSERT ~S: ~S; ~S ~S~ ~%|,[tgtdev,tgtdir,tgtfn1,trufn2 trudev,trudir,trufn1,trufn2] ;; NB: null characters on preceeding line are intentional .uset usri,[.sustp,,[0]] ; start job movx 9,30.*5*60. ; give job a reasonable time .sleep 9, ; to start up .lose ; I think it's looping, Toto ; here on inferior interrupt intusr: skipe debug .value [asciz ": At INTUSR:... CONTINUE"] .uset usri,[.rsv40,,1] ; find out what caused interrupt hllz 2,1 ; get opcode and ac field came 2,[.break 12,] ; .BREAK 12, ? .lose .access usri,1 ; follow memory pointer .iot usri,1 ; read desired operation hlrz 2,1 ; get operation code caie 2,..rjcl ; JCL read? .lose .access usro,1 ; point at her JCL buffer movei 2,jcl ; point at our JCL buffer do. .iot usro,(2) ; write a word of JCL skipe (2) ; anything left? aoja 2,top. ; yeah, next word enddo. ; that's all the JCL .uset usri,[.sapirqc,,[%pibrk]] ; user can stop interrupting now skipe debug .value [asciz ": Ready to DISOWN... CONTINUE"] syscal disown,[movsi 5 ? movei usri] ; morefuckingmagicnumbers .lose ; disown and restart the job .logout 1, ; mission accomplished, bye. .lose ; huh? ;; Here to make noise if we found a stopped job that looks like it ;; was the inferior of a previous instantiation of this program. kvtdev: sixbit 'DSK' kvtfn1: sixbit 'MAIL' kvtfn2: sixbit '>' kvtdir: sixbit '.MAIL.' kvttn1: <770000,,0>\<.ofnm1_-6> kvttn2: sixbit 'OUTPUT' ;; People who should get our warning messages kvtusr: irp who,,[SRA,Alan,JTW,cent,MAP] sixbit ïwhoŠ termin repeat 10,[ ? 0 ] ; are there this many ITS users left? .scalar myjnam, myunam, myhnam kvetch: syscal open,[[.uai\%donrf\%donlk,,dski] tyodev ? tyoerr ? tyofn2 ? tyodir] caia .logout 1, ; Already did this once before... skipn debug ifskp. ; just flame self if debugging .suset [.rxuname,,kvtusr+0] setzm kvtusr+1 endif. syscal open,[[.uao,,dsko] ? kvtdev ? kvttn1 ?kvttn2 ? kvtdir] .lose %lsfil move 1,[-2,,[.runame,,myunam ? .rjname,,myjnam]] .suset 1 syscal sstatu,[repeat 6,[ ? movem myhnam]] .lose %lssys format -dsko,|FROM-PROGRAM:~S~%AUTHOR:~S~%|,[myjnam,myunam] setz 1, do. skipn kvtusr(1) exit. ;; format -dsko,|RCPT:(~S (R-MODE-SEND 0))~%|,[kvtusr(1)] format -dsko,|RCPT:~S~%|,[kvtusr(1)] aoja 1,top. enddo. format -dsko,|SUBJECT:~S would like some attention!~%TEXT;-1~@ Puff was unable to compile ~S:~S;~S ~S by running ~S because:~@ ~@ |,[myhnam,trudev,trudir,trufn1,trufn2,pgmjnm] call @(p) ; Not really a good idea to encourage people to do this ; format -dsko,|~2%(Please delete ~S:~S;~S ~S if you fix the problem.)~@ ; |,[tyodev,tyodir,tyoerr,tyofn2] format -dsko,|~2%| syscal renmwo,[movei dsko ? kvtfn1 ? kvtfn2] .lose %lssys syscal finish,[movei dsko] .lose %lssys syscal delete,[tyodev ? tyoerr ? [sixbit '<'] ? tyodir] jfcl syscal mlink,[tyodev ? tyoerr ? tyofn2 ? tyodir pgmjnm ? [sixbit 'LOST'] ? myunam] .lose %lssys .logout 1, ;; Convert a word of a numeric FN2 (version number) in AC1 to a number. ;; Returns -1 if not a good numeric FN2 sixnum: saveac [2,3] move 3,1 setz 1, do. setz 2, lshc 2,6 cail 2,'0 caile 2,'9 ifskp. imuli 1,10. addi 1,-'0(2) jumpn 3,top. else. seto 1, endif. enddo. ret intacs==setz dismis: setz ? 'dismis ? movsi intacs ? setz p tsint: loc 42 -ltsint,,tsint loc tsint intacs,,p 0 ? 377,,0 ? 0 ? 377,,0 ? intusr ltsint==.-tsint ...lit: consta ...var::variab aos4n: -1 end begin