rA/()G M`&T4(^ MS (d ( Y> I9(P5)-YC" $D=)_@a6 <`(X"4)G`aVt:0%)0DQ.*4)f0; CBIN - program to convert PALX bin files to 11 bin files -*-MIDAS-*- versio==.fnam2 TITLE CBIN .insrt eak;$call macro .insrt eak;macros > .insrt eak;mstuff > ; channel no.s tyic==1 ; console input tyoc==2 ; console output bini==3 ; binary input bino==4 ; binary output errc==6 ; error channel ; symbol table bit definitions lblsym==001000 ; label symbol regsym==004000 ; register symbol undsym==010000 ; undefined symbol hklsym==020000 ; half killed subttl setup & command reader flag nosym ; don't load symbols flag ptr ; paper tape input cbin: move p,[-lpdl,,pdl-1] ; setup pdl ptr move t,[-2,,[ .roption,,f .rsname,,commnd"dir ]] .suset t ; get info from ITS tlo f,optint+optopc ; use new style interrupts .suset [.soption,,f] ; ... pushj p,init rloop: pushj p,rcmdl ; read a line ldb a,[350700,,cmdbuf] caie a,^M pushj p,commnd ; parse it trne f,%fdone ; was that last command? jrst quit ; yes, quit jrst rloop ; no, keep on reading subttl command line parser commnd: begin flag fn1 ; have got fn1 var dev ; device name var dir ; directory name var fn1 ; file name 1 var fn2 ; file name 2 var odev ; output device var odir ; output directory name var ofn1 ; output file name 1 var ofn2 ; output file name 2 move b,[440700,,cmdbuf] ; byte ptr to command string setzm odev ; setup so can default if unspecified cmdf: setzm dev ; ... setzm fn1 ; ... setzm fn2 ; ... trz f,%ffn1 ; init flags cmd1: move c,[440600,,d] ; for converting to sixbit movei d,0 ; ... cmd2: pushj p,cmdchr ; get next char of command cain a,^M ; end of command string? jrst cmdcr cain a,"_ ; output file specification? jrst cmdto cain a,": ; device spec? jrst cmddev cain a,"; ; directory spec? jrst cmddir cain a,"/ ; switch? jrst cmdsw cain a,40 ; space? jrst cmdsp cain a,^Q ; quote char? pushj p,cmdchr ; yes, read another without checks subi a,40 ; convert to sixbit jumpl a,cmdilc ; illegal sixbit char if negative cail a,100 ; or greater than 77 jrst cmdilc tlne c,770000 ; already have six chars? idpb a,c ; no add this one jrst cmd2 cmdsw: pushj p,cmdchr ; get switch name cain a,"N tro f,%fnosym cain a,"S trz f,%fnosym jrst cmd2 cmdto: pushj p,delim ; check if this delimits something .i odev=dev ; copy filename to output filename .i odir=dir ; ... .i ofn1=fn1 ; ... .i ofn2=fn2 ; ... jrst cmdf cmddev: movem d,dev ; set device name jrst cmd1 cmddir: movem d,dir ; set directory name jrst cmd1 cmdsp: pushj p,delim ; delimiting anything? jrst cmd1 cmdcr: pushj p,delim ; delimiting anything? jrst execut delim: skipn d ; any sixbit assembled? popj p, ; no, do nothing troe f,%ffn1 ; already got a fn1? jrst del1 movem d,fn1 ; no, set the fn1 popj p, del1: movem d,fn2 ; have a fn1, now we've got a fn2 popj p, cmdchr: ildb a,b ; get char cail a,"a ; lower case? caile a,"z caia subi a,40 ; yes, convert to upper case popj p, cmdilc: sout #tyoc,,"Illegal character in filename " popj p, subttl command execution var code ; error code execut: movsi t,'dsk ; SIXBIT /DSK/ for defaulting skipn odev ; default output device if unspecified movem t,odev ; ... skipn dev ; default input device if unspecified movem t,dev ; ... move t,fn1 ; input fn1 for defaulting skipn ofn1 ; default output fn1 if unspecified movem t,ofn1 move t,[sixbit /cbin/] ; SIXBIT /CBIN/ for defaulting skipn ofn2 ; default output fn2 if unspecified movem t,ofn2 ; ... movsi t,'bin ; SIXBIT /BIN/ for defaulting skipn fn2 ; default input fn2 if unspecified movem t,fn2 ; ... move a,[.uii,,bini] movs t,dev caie t,'ptr jrst ex1 tro f,%fnosym+%fptr tlo a,10 ; turn on all 8 holes mode ex1: $call open,[a,dev,fn1,fn2,dir,?code] jrst ex2 $call open,[[.bio,,bino],odev,ofn1,ofn2,odir,?code] jrst ex2 pushj p,convert .close bini, .close bino, popj p, ex2: move a,code pushj p,err popj p, .end commnd subttl Conversion ; CONVERT transforms a PALX format binary data (from BINI) to FTP11/LOADER ; format binary data (to BINO). convert: begin var starta ; start address var cksm ; checksum of input data pushj p,getbuf ; fill input buffer move t,[441000,,obuf] ; init ptr to output buffer movem t,obp ; ... setzm occ ; and char count move a,[-,,core/2000] $call corblk,[#%cbndr+%cbndw,#%jself,a,#%jsnew] .lose %lssys move t,[core,,core+1] ; zero all of core setzm core ; ... blt t,corend-1 ; ... ; load CORE from binary input file load1: pushj p,get ; read word from binary input load2: caie a,1 ; looking for 1,0 jrst load1 pushj p,get ; have a 1, look for 0 jumpn a,load2 .i cksm=1 ; set checksum to 1 (i.e. include header) pushj p,algetw ; get byte count of block hrlzi b,-6(a) ; put negative of byte count minus header movns b ; length into left half of aobjn ptr jumpe b,jblk ; no data bytes means this is jump block pushj p,algetw ; get address hrri b,core(a) ; copy address into right half of aobjn ptr load3: pushj p,get ; get data byte addm a,cksm ; keep checksum movem a,(b) ; store in core array aobjn b,load3 ; continue till finished block pushj p,get ; read checksum addb a,cksm trne a,377 ; low byte of checksum zero? pushj p,chkerr jrst load1 ; yes, keep on going jblk: pushj p,algetw ; get start adddress movem a,starta ; save pushj p,get ; read and ignore checksum addb a,cksm trne a,377 pushj p,chkerr jrst dump ; ALGETW reads two bytes from input and returns 1 16 bit word var algb ; temporary for low byte algetw: pushj p,get ; get low byte addm a,cksm movem a,algb ; save it pushj p,get ; get high byte addm a,cksm lsh a,8. ; make 16 bit word add a,algb ; ... popj p, ; CHKERR reports checksum errors. chkerr: sout #tyoc,,"Checksum error in input " popj p, ; dump CORE to binary output file dump: movei a,core ; ptr to memory to dump dump1: setom corend ; terminates search for nonzero byte dump2: skipn (a) ; find next nonzero byte aoja a,dump2 ; this byte zero, move and test next cail a,corend ; nonzero byteat corend? jrst dump5 ; yes, done dumping setzm corend ; terminates search for 6 zero bytes move b,a ; save block starting address dump3: skipe (a) ; this byte zero hrli a,-7 ; nonzero, reset count aobjn a,dump3 ; test next byte if haven't found 6 zeros subi a,6(b) ; get no. of bytes in block pushj p,putw ; output byte count movn c,a hrlzs c hrr c,b movei a,-core(c) ; get address without core array offset pushj p,putw ; output address dump4: move a,(c) ; get data byte pushj p,putb ; output data byte aobjn c,dump4 ; do rest of block hrrz a,c jrst dump1 ; find next block dump5: movei a,0 ; zero word pushj p,putw ; output zero byte count for jump block move a,starta ; get start address pushj p,putw ; output start address jrst symbol ; yes, now output symbols subttl symbol hacking symbol: trne f,%fnosym ; expect symbols? jrst sym3 sym1: pushj p,get ; look for start of symbol table caie a,2 ; ... jrst sym1 ; ... sym2: pushj p,get ; get sixbit of symbol name jumpe a,sym3 ; end of symbol table move c,a ; save symbol name pushj p,get ; get flags,,value tlne a,undsym ; ignore if undefined jrst sym2 exch a,c ; save value, restore name pushj p,rad50 ; convert name to two words of rad50 pushj p,putw ; output 1st move a,b pushj p,putw ; output 2nd move a,c ; output value pushj p,putw movei a,0 ; create flag word tlne c,regsym tro a,1 ; turn on register symbol bit tlne c,hklsym tro a,2 ; turn on half killed bit pushj p,putw ; output flags jrst sym2 sym3: movei a,0 ; zero word indicates end of symbols pushj p,putw jrst cend ; convert sixbit word in A to two 16 bit rad50 words in A and B rad50: move t1,a move t2,[440600,,t1] setzb a,b pushj p,cvstr5 pushj p,cvstr5 pushj p,cvstr5 exch a,b pushj p,cvstr5 pushj p,cvstr5 pushj p,cvstr5 exch a,b popj p, ; convert sixbit char to rad50 char cvstr5: imuli a,50 ; shift what we have so far ildb t,t2 ; get sixbit char jumpe t,apopj ; space is 0 in sixbit and rad50 cain t,'$ addi a,33 ; $ is 33 cain t,'. addi a,34 ; . is 34 cain t,'% addi a,35 ; % is 35 cail t,'A ; letter? caile t,'Z caia addi a,1-'A(t) ; yes, letters are 1-32 cail t,'0 ; digit? caile t,'9 caia addi a,36-'0(t) ; yes, digits are 36-47 apopj: popj p, subttl Cleanup cend: move t1,occ ; pad out last word with nulls jumpe t1,cen3 movei t,0 cen1: trnn t1,3 jrst cen2 idpb t,obp aoja t1,cen1 cen2: idivi t1,4 ; convert to word count movns t1 ; make -count,,adress hrlzs t1 hrri t1,obuf .iot bino,t1 ; output last buffer full cen3: move a,[-,,core/2000] ; release memory $call corblk,[#0,#%jself,a] .lose %lssys popj p, subttl input subroutines var ibpx ; input byte ptr var icc ; input char count libuf==128. ; length of input buffer var ibuf(libuf) ; input buffer get: skipn icc pushj p,getbuf sos icc ildb a,ibpx popj p, getbuf: move t1,[444400,,ibuf] movei t2,libuf trnn f,%fptr jrst gb1 move t1,[441000,,ibuf] movei t2,libuf*4 gb1: movem t1,ibpx movem t2,icc $call siot,[#bini,t1,icc] .lose %lssys subm t2,icc skipn icc .value popj p, subttl output subroutines var obp ; output buffer ptr var occ ; output buffer char count lobuf==100 var obuf(lobuf) ; output buffer ; PUTW buffers word in A for output putw: andi a,177777 ; make only 16 bits push p,a ; save word andi a,377 ; get low byte of word pushj p,putb ; send it move a,(p) ; get char again lsh a,-8. ; send high byte pushj p,putb ; ... pop p,a popj p, ; PUTB buffers byte in A for output putb: idpb a,obp ; buffer character aos t,occ ; update buffer count caige t,lobuf*4 ; filled buffer yet? popj p, ; no, return move t,[-lobuf,,obuf] .iot bino,t move t,[441000,,obuf] ; reset buffer byte ptr movem t,obp ; ... setzm occ ; and buffer char count popj p, .end convert subttl miscellaneous quit: skipe debug ; debugging? .value ; yes, don't die, just stop .logout ; logout if top-level .break 16,160000 ; ask superior to kill us litrl: constants ; impure stuff debug: 0 ; nonzero if debugging pat: block 100 ; DDT patch area variables lpdl==<.+20+1777>&776000-. ; use rest of page as pdl pdl: block lpdl-1 -1 corpag==56. ; size is 56 pages core=. corend=.+corpag*2000 end cbin U; FTP11 - program to send files to 11 versio==.fnam2 TITLE FTP11 .insrt syseng;$call macro .insrt eak;macros > subttl Setup channel tyoc ; console output channel flag tty lcmdbuf==<80.+4>/5 ; room for 80. characters var cmdbuf(lcmdbuf) ; command buffer ftp11: move p,[-lpdl,,pdl-1] ; setup pdl ptr move t,[-2,,[ .roption,,f .rsname,,dir ]] .suset t ; get info from ITS tlo f,%opint+%opopc ; use new style interrupts .suset [.soption,,f] ; ... $call open,[#tyoc,[sixbit /tty/]][][#.uao] .lose %lsfil move t,[cmdbuf,,cmdbuf+1] ; zero command buffer setzm cmdbuf ; ... blt t,cmdbuf+lcmdbuf-1 ; ... .break 12,[5,,cmdbuf] ; read command line ; fall through to command line parser subttl Command line parser flag fn1 ; have got fn1 flag bin ; zero: text mode, nonzero: binary mode var dev ; device name var dir ; directory name var fn1 ; file name 1 var fn2 ; file name 2 var odev ; output device var odir ; output directory name var ofn1 ; output file name 1 var ofn2 ; output file name 2 commnd: move b,[440700,,cmdbuf] ; byte ptr to command string setzm odev ; setup so can default if unspecified cmdf: setzm dev ; ... setzm fn1 ; ... setzm fn2 ; ... trz f,%ffn1 ; init flags cmd1: move c,[440600,,d] ; for converting to sixbit movei d,0 ; ... cmd2: pushj p,cmdchr ; get next char of command cain a,^M ; end of command string? jrst cmdcr cain a,"_ ; output file specification? jrst cmdto cain a,": ; device spec? jrst cmddev cain a,"; ; directory spec? jrst cmddir cain a,"/ ; switch? jrst cmdsw cain a,40 ; space? jrst cmdsp cain a,^Q ; quote char? pushj p,cmdchr ; yes, read another without checks subi a,40 ; convert to sixbit jumpl a,cmdilc ; illegal sixbit char if negative cail a,100 ; or greater than 77 jrst cmdilc tlne c,770000 ; already have six chars? idpb a,c ; no add this one jrst cmd2 cmdsw: pushj p,cmdchr ; get switch name cain a,"T trz f,%fbin cain a,"B tro f,%fbin jrst cmd2 cmdto: pushj p,delim ; check if this delimits something .i odev=dev ; copy filename to output filename .i odir=dir ; ... .i ofn1=fn1 ; ... .i ofn2=fn2 ; ... jrst cmdf cmddev: movem d,dev ; set device name jrst cmd1 cmddir: movem d,dir ; set directory name jrst cmd1 cmdsp: pushj p,delim ; delimiting anything? jrst cmd1 cmdcr: pushj p,delim ; delimiting anything? jrst execut delim: skipn d ; any sixbit assembled? popj p, ; no, do nothing troe f,%ffn1 ; already got a fn1? jrst del1 movem d,fn1 ; no, set the fn1 popj p, del1: movem d,fn2 ; have a fn1, now we've got a fn2 popj p, cmdchr: ildb a,b ; get char cail a,"a ; lower case? caile a,"z caia subi a,40 ; yes, convert to upper case popj p, cmdilc: sout #tyoc,,"Illegal character in filename " jrst quit subttl command execution channel lodi ; load input channel channel lodo ; load output channel channel dski ; binary input channel var pob ; byte ptr to output buffer var code ; error code execut: trz f,%ftty ; init flags movsi t,'tty ; default output device if unspecified skipn odev ; ... movem t,odev ; ... movsi t,'dsk ; default input device if unspecified skipn dev ; ... movem t,dev ; ... movsi t,'> ; SIXBIT />/ for defaulting trne f,%fbin ; binary file? move t,[sixbit /cbin/] ; SIXBIT /CBIN/ for defaulting skipn fn2 ; default FN2 movem t,fn2 ; ... movei a,.uai ; open mode for text file trne f,%fbin ; binary file? movei a,.bii ; open mode for binary file $call open,[#dski,dev,fn1,fn2,dir][][a] .lose %lsfil movs t,odev cain t,'tty ; output device = TTY? tro f,%ftty $call open,[#lodo,odev][][#%tjsio+.uio] .lose %lsfil $call open,[#lodi,odev][][#.uii] .lose %lsfil pushj p,put .close lodi, .close lodo, .close dski, popj p, subttl Transfer to 11 var putp ; pdl ptr to restore on error var ttycom ; saved TTYCOM variable var ttysts ; saved TTYSTS variable var cksm ; checksum var msgno ; mesage no. var timerr var mnoerr put: movem p,putp ; save pdl ptr to restore later .access dski,start move t,[441000,,obuf] ; init ptr to output buffer movem t,obp ; ... setzm occ ; and char count setzm timerr setzm mnoerr setzm eof ; no EOF on input yet setzm ibufc setzm msgno $call cnsget,#lodi,[t,t,t,a] ; get TTYCOM variable .lose %lssys movem a,ttycom ; save so can restore later tlo a,%tcrfs ; put tty into refuse mode $call cnsset,[#lodi,[-1],[-1],[-1],a] .lose %lssys $call ttyset,[#lodi,[020202,,020202],[020202,,020202]] .lose %lssys ; make all chars activation chars trne f,%ftty ; output device is TTY and tlnn f,%opddt ; superior DDT? caia .break 12,[..srnd,,[60]] ; prevent misuse of TTY! .suset [.smask,,[%pirlt]] .iot lodo,[1] ; put PDP11 into copy mode .iot lodo,[3] pushj p,aload putend: move p,putp ; restore pdl ptr so can jump here .iot lodo,[%tdqot] .iot lodo,[200] .iot lodo,[3] $call cnsset,[#lodi,[-1],[-1],[-1],ttycom] .lose %lssys trne f,%ftty ; is output device was TTY and tlnn f,%opddt ; superior DDT? caia .break 12,[..srnd,,[0]] ; allow misuse of TTY sout #tyoc,," Message no. errors = " move a,mnoerr pushj p,typeo sout #tyoc,," Timeout errors = " move a,timerr pushj p,typeo sout #tyoc,," " popj p, aload: movei a,200 ; output 200,2 to 11 pushj p,putb movei a,2 pushj p,putb setzm cksm move a,msgno pushj p,putw movei b,512. al1: pushj p,getb pushj p,putb move t,a movei a,1 cain t,200 pushj p,putb sojn b,al1 movn a,cksm andi a,377 pushj p,putb move t,a movei a,0 cain t,200 pushj p,putb pushj p,send aos t,msgno cain t,100. setzm msgno sosg max setom eof skipn eof jrst aload popj p, typeo: push p,a push p,b idivi a,10. jumpe a,tpo pushj p,typeo tpo: addi b,"0 .iot tyoc,b pop p,b pop p,a popj p, subttl input subroutines libuf==2000 ; length of input buffer var ibuf(libuf) ; input buffer var ibufc ; character left in input buffer var ibufp ; byte ptr to last char readn var eof ; nonzero if end of file reached getb: sosl ibufc ; stuff left in input buffer? jrst gt1 move t,[-libuf,,ibuf] ; need to read more cruft .iot dski,t ; ... hlres t addi t,libuf imuli t,4 movem t,ibufc move a,[441000,,ibuf] movem a,ibufp jumpn t,getb movei a,0 setom eof popj p, gt1: ildb a,ibufp popj p, subttl output subroutines var obp ; output buffer ptr var occ ; output buffer char count ; PUTW buffers word in A for output putw: andi a,177777 ; make only 16 bits push p,a ; save word andi a,377 ; get low byte of word pushj p,putb ; send it pop p,a ; get char again lsh a,-8. ; send high byte pushj p,putb ; ... popj p, ; PUTB buffers byte in A for output putb: addm a,cksm caige a,200 ; 200-377 are ITS software codes jrst pb1 ; not soft code movei t,%tdqot ; yes, quote it idpb t,obp ; ... aos occ ; ... pb1: idpb a,obp ; buffer character aos occ ; update buffer count popj p, ; SEND actually outputs the buffered chars send: move t1,[441000,,obuf] ; get ptr to output buffer movem t1,obp move t2,occ ; and char count $call reset,#lodi .lose %lssys $call siot,[#lodo,t1,t2] ; output chars .lose %lssys $call finish,#lodo .lose %lssys move t,[600000,,[2*60.]] .realt t, jfcl .iot lodi,t1 movsi t,400000 .realt t, subi t1,40 cain t1,177-40 jrst putend came t1,msgno jrst snd2 snd1: setzm occ ; init buffer char count popj p, snd2: aos mnoerr jrst send timout: movsi t,400000 .realt t, aos timerr $call reset,#lodi .lose %lssys $call dismis,[p,#send] .lose %lssys subttl miscellaneous quit: skipe debug ; debugging? .value ; yes, don't die, just stop .logout ; logout if top-level .break 16,160000 ; ask superior to kill us tsint: loc 42 -ltsint,,tsint loc tsint p %pirlt ? 0 ? -1 ? -1 ? timout ltsint==.-tsint litrl: constants ; impure stuff start: 0 max: 4000 debug: 0 ; nonzero if debugging pat: block 100 ; DDT patch area variables lpdl==<.+20+1777>&776000-. ; use rest of page as pdl pdl: block lpdl obuf: block <512.+10.+3>/4 -1 end ftp11  ; LOADER - program to send PALX bin files to 11 versio==.fnam2 TITLE PDP11 LOADER .insrt eak;$call macro .insrt eak;macros > .insrt eak;mstuff > ; channel no.s tyic==1 ; console input tyoc==2 ; console output lodi==3 ; load input lodo==4 ; load output bini==5 ; binary input errc==6 ; error channel ; symbol table bit definitions lblsym==001000 ; label symbol regsym==004000 ; register symbol undsym==010000 ; undefined symbol hklsym==020000 ; half killed subttl setup & command reader flag reps ; expect replies when loading flag nosym ; don't load symbols flag tty ; outputting to TTY flag tmn ; outputting to Tmn flag 7bit ; output in 7 bit mode flag ptr ; paper tape input var pob ; byte ptr to output buffer loader: move p,[-lpdl,,pdl-1] ; setup pdl ptr move t,[-2,,[ .roption,,f .rsname,,commnd"dir ]] .suset t ; get info from ITS tlo f,%opint+%opopc ; use new style interrupts .suset [.soption,,f] ; ... pushj p,init ; setup TTY input/output rloop: pushj p,rcmdl ; read a line ldb a,[350700,,cmdbuf] ; get first character of command caie a,^M ; if no command then ignore pushj p,commnd ; execute command trne f,%fdone ; was that last command? jrst quit ; yes, quit jrst rloop ; no, keep on reading subttl command line parser commnd: begin flag fn1 ; have got fn1 var dev ; device name var dir ; directory name var fn1 ; file name 1 var fn2 ; file name 2 var odev ; output device var odir ; output directory name var ofn1 ; output file name 1 var ofn2 ; output file name 2 move b,[440700,,cmdbuf] ; byte ptr to command string setzm odev ; setup so can default if unspecified cmdf: setzm dev ; ... setzm fn1 ; ... setzm fn2 ; ... trz f,%ffn1 ; init flags cmd1: move c,[440600,,d] ; for converting to sixbit movei d,0 ; ... cmd2: pushj p,cmdchr ; get next char of command cain a,^M ; end of command string? jrst cmdcr cain a,"_ ; output file specification? jrst cmdto cain a,": ; device spec? jrst cmddev cain a,"; ; directory spec? jrst cmddir cain a,"/ ; switch? jrst cmdsw cain a,40 ; space? jrst cmdsp cain a,^Q ; quote char? pushj p,cmdchr ; yes, read another without checks subi a,40 ; convert to sixbit jumpl a,cmdilc ; illegal sixbit char if negative cail a,100 ; or greater than 77 jrst cmdilc tlne c,770000 ; already have six chars? idpb a,c ; no add this one jrst cmd2 cmdsw: pushj p,cmdchr ; get switch name cain a,"7 ; 7 bit load? tro f,%f7bit cain a,"8 trz f,%f7bit jrst cmd2 cmdto: pushj p,delim ; check if this delimits something .i odev=dev ; copy filename to output filename .i odir=dir ; ... .i ofn1=fn1 ; ... .i ofn2=fn2 ; ... jrst cmdf cmddev: movem d,dev ; set device name jrst cmd1 cmddir: movem d,dir ; set directory name jrst cmd1 cmdsp: pushj p,delim ; delimiting anything? jrst cmd1 cmdcr: pushj p,delim ; delimiting anything? jrst execut delim: skipn d ; any sixbit assembled? popj p, ; no, do nothing troe f,%ffn1 ; already got a fn1? jrst del1 movem d,fn1 ; no, set the fn1 popj p, del1: movem d,fn2 ; have a fn1, now we've got a fn2 popj p, cmdchr: ildb a,b ; get char cail a,"a ; lower case? caile a,"z caia subi a,40 ; yes, convert to upper case popj p, cmdilc: sout #tyoc,,"Illegal character in filename " aos (p) ; return2 popj p, subttl command execution var code ; error code execut: trz f,%ftty+%ftmn+%freps ; init flags movsi t,'tty ; default output device if unspecified skipn odev ; ... movem t,odev ; ... movsi t,'dsk ; default input device if unspecified skipn dev ; ... movem t,dev ; ... movsi t,'bin ; default fn2 if unspecified skipn fn2 ; ... movem t,fn2 ; ... move a,[.uii,,bini] movs t,dev caie t,'ptr jrst ex1 trz f,%fnosym tro f,%fptr tlo a,10 ; turn on all 8 holes mode ex1: $call open,[a,dev,fn1,fn2,dir,?code] jrst ex3 movs t,odev cain t,'tty ; output device = TTY? trc f,%ftty lsh t,-12. ; output device = Tmn? cain t,'t trc f,%ftty+%ftmn+%freps move a,[.uio,,lodo] trne f,%ftty+%ftmn ; tty-like device? tlo a,%tjsio $call open,[a,odev,ofn1,ofn2,odir,?code] jrst ex3 trnn f,%freps ; no LODI if no replies needed jrst ex2 $call open,[[.uii,,lodi],odev,ofn1,ofn2,odir,?code] jrst ex3 ex2: move t,[441000,,obuf] movem t,pob pushj p,load .close lodi, .close lodo, .close bini, popj p, ex3: move a,code pushj p,err popj p, .end commnd subttl loading load: begin flag jblk ; jump block encountered var loadp ; pdl ptr to restore on error var ttycom ; saved TTYCOM variable var cksm ; checksum setzm icc ; init input buffer character count move t,pob ; init ptr to output buffer movem t,obp ; ... setzm occ ; and char count movem p,loadp ; save pdl ptr to restore later trz f,%fjblk ; init flags trnn f,%ftty+%ftmn ; tty-like output device? jrst lod1 $call cnsget,#lodo,[t,t,t,a] ; get TTYCOM variable .lose %lssys movem a,ttycom ; save so can restore later tlo a,%tcrfs ; put tty into refuse mode $call cnsset,[#lodo,[-1],[-1],[-1],a] .lose %lssys $call ttyset,[#lodo,[020202,,020202],[020202,,020202]] .lose %lssys ; make all chars activation chars trne f,%ftty ; if output device is TTY and tlnn f,optddt ; superior is DDT then no typeout caia .value [ascii ":NOMSG 0 P"] .iot lodo,[1] ; put PDP11 into load mode .iot lodo,[2] lod1: pushj p,aload lodend: move p,loadp ; restore pdl ptr so can jump here trnn f,%ftty+%ftmn popj p, $call cnsset,[#lodo,[-1],[-1],[-1],ttycom] .lose %lssys trne f,%ftty ; if output device was TTY and tlnn f,optddt ; superior is DDT then no typeout caia .value [ascii ":NOMSG 1 P"] popj p, aload: pushj p,get ; read word from binary input al1: caie a,1 ; looking for 1,0 jrst aload pushj p,get ; have a 1, look for 0 jumpn a,al1 movei a,1 ; output 1,0 to 11 pushj p,putb movei a,0 pushj p,putb pushj p,algetw ; get byte count of block cain a,6 ; jump block is only one of length 6 tro f,%fjblk movei b,-2+1(a) ; correct for 1,0 already read/sent al2: pushj p,putw ; output word subi b,2 ; adjust byte count cain b,1 ; byte count = 1? jrst al3 ; yes, handle single byte specially jumpe b,al4 ; byte count = 0, end of block pushj p,algetw ; read another word jrst al2 ; and send it al3: pushj p,get ; get last byte of data pushj p,putw ; send it as word al4: pushj p,send ; send the whole block trnn f,%fjblk ; was that block the jump block? jrst aload ; no, keep on going jrst symbol ; yes, now send symbols ; ALGETW reads two bytes from input and returns 1 16 bit word var algb ; temporary for low byte algetw: pushj p,get ; get low byte movem a,algb ; save it pushj p,get ; get high byte lsh a,8. ; make 16 bit word add a,algb ; ... popj p, subttl symbol hacking var addr ; load address for symbol block var symbuf(16.*3+2) ; symbol buffer hklb=:symbuf+16.*3 ; flag words are last two words regb=:symbuf+16.*3+1 ; of buffer symbol: trne f,%fnosym ; load symbols? popj p, ; no pushj p,get ; look for start of symbol table caie a,2 ; ... jrst symbol ; ... setzm addr ; so first use decrements to -100. trne f,%freps ; replies from 11? jrst sym1 ; no, just send 'em .iot lodi,t caie t,5 ; does 11 want symbols? popj p, sym1: move t,[symbuf,,symbuf+1] ; zero symbol buffer setzm symbuf ; ... blt t,regb ; ... movei t,177777 ; set all half killed bits movem t,hklb ; ... movni d,16. ; no. of symbols to buffer movei c,symbuf+15.*3 ; ptr to end of symbol buffer sym2: pushj p,get ; get sixbit of symbol jumpe a,sym3 ; end of symbol table pushj p,rad50 ; convert to two words of rad50 movem b,0(c) ; store in buffer movem a,1(c) ; ... pushj p,get ; read flags,,value tlne a,undsym ; undefined symbol? jrst sym2 ; yes, ignore hrrzm a,2(c) ; buffer value movei t,1 ; calculate bit in flag word for lsh t,16.(d) ; this symbol tlne a,regsym ; register symbol? iorm t,regb ; yes, turn on bit in flag word tlnn a,hklsym ; half killed? andcam t,hklb ; no, turn off bit in flag word subi c,3 ; update buffer ptr aojl d,sym2 ; do only 16 symbols pushj p,ssym ; send the symbols jrst sym1 sym3: pushj p,ssym ; send the symbols movei a,1 ; send a jump block to end symbols movem a,cksm pushj p,putb movei a,0 pushj p,putb movei a,6 ; length 6 indicates a jump block pushj p,putw movei a,0 pushj p,putw movn a,cksm andi a,377 pushj p,putw pushj p,send popj p, ; we're done! ssym: move c,[-<16.*3+2>,,symbuf] ; aobjn ptr to symbol buffer movei a,1 ; send 0,1 to signal start of block movem a,cksm ; init checksum pushj p,putb movei a,0 pushj p,putb movei a,106. ; get no. of bytes in msg pushj p,putw ; send block length movni a,100. ; subtract 100. from last symbol addr addb a,addr ; ... pushj p,putw ; and send as block addr ssy1: move a,(c) ; get word from symbol buffer pushj p,putw ; send word aobjn c,ssy1 movn a,cksm ; send checksum andi a,377 ; only 8 bits pushj p,putw pushj p,send ; actually output the stuff popj p, ; convert sixbit word in A to two 16 bit rad50 words in A and B rad50: move t1,a move t2,[440600,,t1] movei a,0 pushj p,cvstr5 pushj p,cvstr5 pushj p,cvstr5 move b,a movei a,0 pushj p,cvstr5 pushj p,cvstr5 pushj p,cvstr5 popj p, ; convert sixbit char to rad50 char cvstr5: imuli a,50 ; shift what we have so far ildb t,t2 ; get sixbit char jumpe t,apopj ; space is 0 in sixbit and rad50 cain t,'$ addi a,33 ; $ is 33 cain t,'. addi a,34 ; . is 34 cain t,'% addi a,35 ; % is 35 cail t,'A ; letter? caile t,'Z caia addi a,1-'A(t) ; yes, letters are 1-32 cail t,'0 ; digit? caile t,'9 caia addi a,36-'0(t) ; yes, digits are 36-47 apopj: popj p, subttl input subroutines var ibpx ; input byte ptr var icc ; input char count libuf==128. ; length of input buffer var ibuf(libuf) ; input buffer get: skipn icc pushj p,getbuf sos icc ildb a,ibpx popj p, getbuf: move t1,[444400,,ibuf] movei t2,libuf trnn f,%fptr jrst gb1 move t1,[441000,,ibuf] movei t2,libuf*4 gb1: movem t1,ibpx movem t2,icc $call siot,[#bini,t1,icc] .lose %lssys subm t2,icc skipn icc .value popj p, subttl output subroutines var obp ; output buffer ptr var occ ; output buffer char count ; PUTW buffers word in A for output putw: andi a,177777 ; make only 16 bits push p,a ; save word addm a,cksm ; add low byte to checksum lsh a,-8. ; add high byte to checksum addm a,cksm ; ... move a,(p) ; restore word trne f,%f7bit ; 8 bit output? jrst pw1 ; no, send as 6-4-6 andi a,377 ; get low byte of word pushj p,putb ; send it pop p,a ; get char again lsh a,-8. ; send high byte pushj p,putb ; ... popj p, pw1: andi a,77 ; get low 6 bits pushj p,putb move a,(p) ; get char again lsh a,-6 ; now send next 4 bits andi a,17 ; ... pushj p,putb pop p,a ; get char lsh a,-10. ; send high 6 bits pushj p,putb popj p, ; PUTB buffers byte in A for output putb: caige a,200 ; 200-377 are ITS software codes jrst pb1 ; not soft code movei t,%tdqot ; yes, quote it idpb t,obp ; ... aos occ ; ... pb1: trne f,%f7bit ; don't add 40 to char in 8 bit mode addi a,40 ; add 40 to avoid control chars idpb a,obp ; buffer character aos occ ; update buffer count popj p, ; SEND actually outputs the buffered chars send: move t1,pob ; get ptr to output buffer move t2,occ ; and char count $call siot,[#lodo,t1,t2] ; output chars .lose %lssys trne f,%freps ; need reply? jrst snd1 ; no .iot lodi,t ; yes, read 1 char cain t,^G ; ^G, abort loading jrst lodend caie t,4 ; 4 if ok, anything else to resend jrst send ; resend snd1: move t,pob ; reset buffer byte ptr movem t,obp ; ... setzm occ ; and buffer char count popj p, .end load subttl miscellaneous quit: skipe debug ; debugging? .value ; yes, don't die, just stop .logout ; logout if top-level .break 16,160000 ; ask superior to kill us litrl: constants ; impure stuff debug: 0 ; nonzero if debugging pat: block 100 ; DDT patch area variables lpdl==<.+20+1777>&776000-. ; use rest of page as pdl pdl: block lpdl-1 -1 obuf: block 10000-1 -1 end loader ; LPT11 - program to print output on PDP11 line printer -*-MIDAS-*- versio==.fnam2 TITLE LPT11 .insrt dsk:syseng;$call macro .insrt dsk:eak;macros > .insrt dsk:eak;mstuff > ; channel no.s tyic==1 ; console input tyoc==2 ; console output lpto==3 ; lpt output fili==5 ; disk input errc==6 ; error channel subttl setup & command reader flag tty lpt11: move p,[-lpdl,,pdl-1] ; setup pdl ptr move t,[-2,,[ .roption,,f .rsname,,commnd"dir ]] .suset t ; get info from ITS tlo f,%opint+%opopc .suset [.soption,,f] pushj p,init rloop: pushj p,rcmdl ; read a line ldb a,[350700,,cmdbuf] caie a,^M pushj p,commnd ; parse it trne f,%fdone ; was that last command? jrst quit ; yes, quit jrst rloop ; no, keep on reading subttl command line parser commnd: begin flag fn1 ; have got fn1 var dev ; device name var dir ; directory name var fn1 ; file name 1 var fn2 ; file name 2 var odev ; output device var odir ; output directory name var ofn1 ; output file name 1 var ofn2 ; output file name 2 move b,[440700,,cmdbuf] ; byte ptr to command string setzm odev ; setup so can default if unspecified cmdf: setzm dev ; ... setzm fn1 ; ... setzm fn2 ; ... trz f,%ffn1 ; init flags cmd1: move c,[440600,,d] ; for converting to sixbit movei d,0 ; ... cmd2: pushj p,cmdchr ; get next char of command cain a,^M ; end of command string? jrst cmdcr cain a,"_ ; output file specification? jrst cmdto cain a,": ; device spec? jrst cmddev cain a,"; ; directory spec? jrst cmddir cain a,"/ ; switch? jrst cmdsw cain a,40 ; space? jrst cmdsp cain a,^Q ; quote char? pushj p,cmdchr ; yes, read another without checks subi a,40 ; convert to sixbit jumpl a,cmdilc ; illegal sixbit char if negative cail a,100 ; or greater than 77 jrst cmdilc tlne c,770000 ; already have six chars? idpb a,c ; no add this one jrst cmd2 cmdsw: pushj p,cmdchr ; get switch name jrst cmd2 cmdto: pushj p,delim ; check if this delimits something .i odev=dev ; copy filename to output filename .i odir=dir ; ... .i ofn1=fn1 ; ... .i ofn2=fn2 ; ... jrst cmdf cmddev: movem d,dev ; set device name jrst cmd1 cmddir: movem d,dir ; set directory name jrst cmd1 cmdsp: pushj p,delim ; delimiting anything? jrst cmd1 cmdcr: pushj p,delim ; delimiting anything? jrst execut delim: skipn d ; any sixbit assembled? popj p, ; no, do nothing troe f,%ffn1 ; already got a fn1? jrst del1 movem d,fn1 ; no, set the fn1 popj p, del1: movem d,fn2 ; have a fn1, now we've got a fn2 popj p, cmdchr: ildb a,b ; get char cail a,"a ; lower case? caile a,"z caia subi a,40 ; yes, convert to upper case popj p, cmdilc: sout #tyoc,,"Illegal character in filename " popj p, subttl command execution var code ; error code execut: trz f,%ftty ; init flags movsi t,'tty ; default output device if unspecified skipn odev ; ... movem t,odev ; ... movsi t,'dsk ; default input device if unspecified skipn dev ; ... movem t,dev ; ... movsi t,(sixbit />/) ; default fn2 if unspecified skipn fn2 ; ... movem t,fn2 ; ... $call open,[[.uai,,fili],dev,fn1,fn2,dir,?code] jrst ex2 movs t,odev cain t,'tty ; output device = TTY? tro f,%ftty $call open,[[%tjsio+.uio,,lpto],odev,?code] jrst ex2 pushj p,send .close lpto, .close fili, popj p, ex2: move a,code pushj p,err popj p, .end commnd subttl send output send: begin var hpos var ttycom ; saved TTYCOM variable var ttysts ; saved TTYSTS variable $call cnsget,#lpto,[t,t,t,a] ; get TTYCOM variable .lose %lssys movem a,ttycom ; save so can restore later tlo a,%tcrfs ; put tty into refuse mode $call cnsset,[#lpto,[-1],[-1],[-1],a] .lose %lssys trne f,%ftty ; if output device is TTY and tlnn f,optddt ; superior is DDT then no typeout caia .value [ascii ":NOMSG 0 P"] .iot lpto,[1] ; put PDP11 into copy mode .iot lpto,[^X] setzm icc move t,[440700,,obuf] movem t,obp movei t,lobuf*5 movem t,occ pushj p,output .iot lpto,[1] .iot lpto,[^Y] $call cnsset,[#lpto,[-1],[-1],[-1],ttycom] .lose %lssys trne f,%ftty ; if output device was TTY and tlnn f,optddt ; superior is DDT then no typeout caia .value [ascii ":NOMSG 1 P"] .close fili, .close lpto, popj p, output: .iot lpto,[14] ; form feed before output movei a,30*5 ; 5 second pause .sleep a, setzm hpos o1: pushj p,getb jumpl a,odone caie a,177 caige a,40 jrst o3 aos hpos o2: pushj p,putb jrst o1 o3: cain a,^H jrst obs cain a,^I jrst otab cain a,^J jrst o2 cain a,^L jrst ocr cain a,^M jrst ocr push p,a movei a,"^ aos hpos pushj p,putb pop p,a xori a,100 aos hpos pushj p,putb jrst o1 obs: sosge hpos setzm hpos jrst o2 otab: movei a,40 pushj p,putb aos t,hpos trne t,7 jrst otab jrst o1 ocr: setzm hpos jrst o2 odone: movei a,^L pushj p,putb move t1,[440700,,obuf] movei t2,5*lobuf sub t2,occ $call siot,[#lpto,t1,t2] .lose %lssys popj p, .end send var icc var ibpx var occ var obp libuf==100 lobuf==100 var ibuf(libuf) var obuf(lobuf) getb: skipe icc jrst gt1 move a,[440700,,ibuf] movem a,ibpx movei t,libuf*5 movem t,icc $call siot,[#fili,a,icc] .lose %lssys subm t,icc gt1: ildb a,ibpx sosge icc setom a popj p, putb: idpb a,obp sose occ popj p, move t1,[440700,,obuf] movem t1,obp movei t2,lobuf*5 movem t2,occ $call siot,[#lpto,t1,t2] .lose %lssys popj p, subttl miscellaneous quit: skipe debug ; debugging? .value ; yes, don't die, just stop .logout ; logout if top-level .break 16,160000 ; ask superior to kill us litrl: constants ; impure stuff debug: 0 ; nonzero if debugging pat: block 100 ; DDT patch area variables lpdl==<.+20+1777>&776000-. ; use rest of page as pdl pdl: block lpdl -1 end lpt11 !~FILENAME~:! !-*-TECO-*- macros for PALX PDP11 programs.! PDP11MACS !Trantor:! !C Assemble Trantor. Have PALX assemble PDP11;TRANTR > producing BIN, ERR, CRASH and SYMTAB files.! m(m.m& Assemble)TRANTRT/H  !Roundhouse:! !C Assemble Roundhouse. Have PALX assemble PDP11;ROUNDH > producing BIN, ERR, CRASH and SYMTAB files.! m(m.m& Assemble)ROUNDHRH !Dover Trantor:! !S Dover Trantor.! :xxfile pdp11;dover trantr $p !& Assemble:! !S Assemble a PDP11 program! m(m.mSave All Files) !* make sure everything is written out! [1[2[3[4[5[6 f[bbindw f[dfilew f[sstringw 0f[fnamsyntaxw :i1 :i2 :i6 ezDSK:PDP11; j <:s  1 ; \f"n u3'w> !* get program version number! hk g2 q3\w hfx3 !* version in Q3, make it fn1! i .nlist .macro .date. .ascii " mmInsert Datel i" .endm .date  ei hp ef.asm 1 !* Define .DATE. macro to tell program the when it was assembled! hk f+ :PALX PDP11;3 BIN,3 SYMTAB,3 ERR_PDP11;.ASM,1/N6 $P 1:w 8f[ibasew 1:< er3 err^y !* get PALX's ERROR file! :i4 <:s FILE ; fb; 4,40.i 4r ^:x4 4d> j !* collect file names! :i5 <:s.msg _C_ ; fkd 0l ^fx5>j !* collect crash msgs! :sFILE "l fkc b,.k' !* delete cruft at beginning! ei hp ef !* write out the ERR file! hk i CRASH Messages  g4 i PC PC Message  g5 ei hp efcrash !* write out the CRASH file! > 1:< ersymtab^y !* read in the listing file! :s***SYMBOL TABLE***"l !* delete all but the symbol table! -s  c b,.k ei hp ef' !* and write out as SYMTAB! hk > 1:w 1:w 1:w !* make links to files just! 1:w !* produced!  !^R Squish Region:! !C Squish tabs in instructions to spaces. Change tabs between op code and operands to spaces.! [1[2[3 f[vb f[vz .,(w)f fs boundw !* set bounds to region! j < .-z; 1:fu2u1 0u3 !* find bounds of instruction! q1,q2:fb;"l r .u2 fshposu3' !* ignore comment on line! 1< q1,q2:fb ; .,q2:fb; !* find second tab in instruction! -di  !* change to space! q3"g q2j fshpos-q3"n i '' !* keep comment in same place! > l > h  !^R Indent PALX code:! !^R Change indentation of code, comments remain stationary.! [1[2 f[vb f[vz f[sstring .,(w.)f fsboundw m.m& Indentu1 !* get ptrs to subrs for fast calling! 0s ;w !* set search string! j < .-z; .(:s+1"l r fshposu2'"# 2r -1u2' fsz-.f[vz)j 1< ^:f l .-z; !* move past labels etc.! ^ f l .-z; !* move past indentation! fshpos+m1 !* reindent! q2:; zj q2m1 !* put comment back! > f]vz l > h  !Args:! !C Print arguments and return values for Trantor subroutine. String arg is name of subroutine. Subroutine is found via the current tag table.! [1[2[3 qBuffer Nameu2 .u3 !* Save current buffer name and point! m(m.mFind Tag) !* Find the subroutine! 0l .u1 !* Move to end of description! < b-.; -l !* Move back line by line until one! 1a-;"n 1a-15."n 1;'' !* starts with other than ; or CR! > l < 2f= "n 1;' l > !* remove leading blank lines! q1-."n .,q1t' !* Type description if there is one! q2m(m.mSelect Buffer) q3j !* Go back to old buffer and point!  !PALX Mode:! !C Set things up for editing PALX code.! m(m.m& Init Buffer Locals) !* ! 1,32M.LComment Column !* try to put comments in column 32! 1,(:I*;) m.lComment Start !* semicolon starts comments! 1,(:I*; )m.lComment Begin !* semicolon space looks nicer though! 1,(:I*)m.lParagraph Delimiter !* ! 1,(m.m^R Indent Relative)m.qI !* set TAB to indent under last line! ! 1,(m.m^R Indent PALX Code)m.q:.x(11.) |* put indenter on ^X Tab! 1,Q1,Q..Q)M.Q. !* Exchange rubout flavors! 0fo..qMIDAS Vector[1 !* ! q1"e 5*5fsqvectoru1 q1m.vMIDAS Vector !* ! m.m^R Go to AC Fieldu:1(0) !* ! m.m^R Kill Terminated Wordu:1(1) !* ! m.m^R Go to Address Fieldu:1(2) !* ! m.m^R Go to Next Labelu:1(3) !* ! m.m^R Go to Previous Labelu:1(4)' !* ! 1,Q:1(0)M.Q...A !* use MIDAS Mode stuff! 1,Q:1(1)M.Q...D !* ...! 1,Q:1(2)M.Q...E !* ...! 1,Q:1(3)M.Q...N !* ...! 1,Q:1(4)M.Q...P !* ...! Q.0,1M(M.M& Set Mode Line)PALX !* !  %; PUNCH - program to punch PALX bin files versio==.fnam2 TITLE PUNCH .insrt eak;$call macro .insrt eak;macros > .insrt eak;mstuff > ; channel no.s tyic==1 ; console input tyoc==2 ; console output bini==3 ; binary input bino==4 ; binary output errc==6 ; error channel subttl setup & command reader flag ptr ; paper tape input punch: move p,[-lpdl,,pdl-1] ; setup pdl ptr move t,[-2,,[ .roption,,f .rsname,,commnd"dir ]] .suset t ; get info from ITS tlo f,optint+optopc ; use new style interrupts .suset [.soption,,f] ; ... pushj p,init rloop: pushj p,rcmdl ; read a line ldb a,[350700,,cmdbuf] caie a,^M pushj p,commnd ; parse it trne f,%fdone ; was that last command? jrst quit ; yes, quit jrst rloop ; no, keep on reading subttl command line parser commnd: begin flag fn1 ; have got fn1 var dev ; device name var dir ; directory name var fn1 ; file name 1 var fn2 ; file name 2 var odev ; output device var odir ; output directory name var ofn1 ; output file name 1 var ofn2 ; output file name 2 move b,[440700,,cmdbuf] ; byte ptr to command string setzm odev ; setup so can default if unspecified cmdf: setzm dev ; ... setzm fn1 ; ... setzm fn2 ; ... trz f,%ffn1 ; init flags cmd1: move c,[440600,,d] ; for converting to sixbit movei d,0 ; ... cmd2: pushj p,cmdchr ; get next char of command cain a,^M ; end of command string? jrst cmdcr cain a,"_ ; output file specification? jrst cmdto cain a,": ; device spec? jrst cmddev cain a,"; ; directory spec? jrst cmddir cain a,"/ ; switch? jrst cmdsw cain a,40 ; space? jrst cmdsp cain a,^Q ; quote char? pushj p,cmdchr ; yes, read another without checks subi a,40 ; convert to sixbit jumpl a,cmdilc ; illegal sixbit char if negative cail a,100 ; or greater than 77 jrst cmdilc tlne c,770000 ; already have six chars? idpb a,c ; no add this one jrst cmd2 cmdsw: pushj p,cmdchr ; get switch name jrst cmd2 cmdto: pushj p,delim ; check if this delimits something .i odev=dev ; copy filename to output filename .i odir=dir ; ... .i ofn1=fn1 ; ... .i ofn2=fn2 ; ... jrst cmdf cmddev: movem d,dev ; set device name jrst cmd1 cmddir: movem d,dir ; set directory name jrst cmd1 cmdsp: pushj p,delim ; delimiting anything? jrst cmd1 cmdcr: pushj p,delim ; delimiting anything? jrst execut delim: skipn d ; any sixbit assembled? popj p, ; no, do nothing troe f,%ffn1 ; already got a fn1? jrst del1 movem d,fn1 ; no, set the fn1 popj p, del1: movem d,fn2 ; have a fn1, now we've got a fn2 popj p, cmdchr: ildb a,b ; get char cail a,"a ; lower case? caile a,"z caia subi a,40 ; yes, convert to upper case popj p, cmdilc: sout #tyoc,,"Illegal character in filename " popj p, subttl command execution var code ; error code execut: movsi t,'ptp ; SIXBIT /PTP/ for defaulting skipn odev ; default output device if unspecified movem t,odev ; ... movsi t,'dsk ; SIXBIN /BIN/ for defaulting skipn dev ; default input device if unspecified movem t,dev ; ... movsi t,'bin ; SIXBIT /BIN/ for defaulting skipn fn2 ; default input fn2 if unspecified movem t,fn2 ; ... move a,[.uii,,bini] movs t,dev caie t,'ptr jrst ex1 tro f,%fptr tlo a,10 ; turn on all 8 holes mode ex1: $call open,[a,dev,fn1,fn2,dir,?code] jrst ex2 $call open,[[10+.uao,,bino],odev,?code] jrst ex2 pushj p,send .close bini, .close bino, popj p, ex2: move a,code pushj p,err popj p, .end commnd subttl Output ; SEND reads a PALX format binary output file and copies it to the ; output file (PTP:). send: begin flag jblk ; jump block flag var cksm ; checksum of input data pushj p,getbuf ; fill input buffer move t,[441000,,obuf] ; init ptr to output buffer movem t,obp ; ... setzm occ ; and char count trz f,%fjblk ; no jump block yet load1: pushj p,get ; read word from binary input load2: caie a,1 ; looking for 1,0 jrst load1 pushj p,get ; have a 1, look for 0 jumpn a,load2 movei a,1 movem a,cksm ; set checksum to 1 (i.e. include header) pushj p,putw ; put out 1,0 pushj p,getw ; get byte count of block pushj p,putw ; write out movei b,-3(a) ; get no. of data bytes + 3 cain b,3 ; no data bytes means this is jump block tro f,%fjblk load3: pushj p,get ; get data byte addm a,cksm ; keep checksum pushj p,putb ; output data byte sojn b,load3 move a,cksm trne a,377 ; low byte of checksum zero? pushj p,chkerr trnn f,%fjblk jrst load1 ; keep on going move t1,[441000,,obuf] $call siot,[#bino,t1,occ] .lose %lssys popj p, ; GETW reads two bytes from input and returns 1 16 bit word var algb ; temporary for low byte getw: pushj p,get ; get low byte addm a,cksm movem a,algb ; save it pushj p,get ; get high byte addm a,cksm lsh a,8. ; make 16 bit word add a,algb ; ... popj p, ; CHKERR reports checksum errors. chkerr: sout #tyoc,,"Checksum error in input " popj p, subttl input subroutines var ibpx ; input byte ptr var icc ; input char count libuf==128. ; length of input buffer var ibuf(libuf) ; input buffer get: skipn icc pushj p,getbuf sos icc ildb a,ibpx popj p, getbuf: move t1,[444400,,ibuf] movei t2,libuf trnn f,%fptr jrst gb1 move t1,[441000,,ibuf] movei t2,libuf*4 gb1: movem t1,ibpx movem t2,icc $call siot,[#bini,t1,icc] .lose %lssys subm t2,icc skipn icc .value popj p, subttl output subroutines var obp ; output buffer ptr var occ ; output buffer char count lobuf==100 var obuf(lobuf) ; output buffer ; PUTW buffers word in A for output putw: andi a,177777 ; make only 16 bits push p,a ; save word andi a,377 ; get low byte of word pushj p,putb ; send it move a,(p) ; get char again lsh a,-8. ; send high byte pushj p,putb ; ... pop p,a popj p, ; PUTB buffers byte in A for output putb: idpb a,obp ; buffer character aos t,occ ; update buffer count caige t,lobuf*4 ; filled buffer yet? popj p, ; no, return move t1,[441000,,obuf] movem t1,obp $call siot,[#bino,t1,occ] .lose %lssys popj p, .end send subttl miscellaneous quit: skipe debug ; debugging? .value ; yes, don't die, just stop .logout ; logout if top-level .break 16,160000 ; ask superior to kill us litrl: constants ; impure stuff debug: 0 ; nonzero if debugging pat: block 100 ; DDT patch area variables lpdl==<.+20+1777>&776000-. ; use rest of page as pdl pdl: block lpdl-1 -1 end punch ; SEND11 - program to print output on PDP11 line printer versio==.fnam2 TITLE SEND11 .insrt eak;$call macro .insrt eak;macros > .insrt eak;mstuff > ; channel no.s tyic==1 ; console input tyoc==2 ; console output ttyo==3 ; tty output fili==5 ; disk input errc==6 ; error channel subttl setup & command reader flag tty send11: move p,[-lpdl,,pdl-1] ; setup pdl ptr move t,[-2,,[ .roption,,f .rsname,,commnd"dir ]] .suset t ; get info from ITS tlo f,%opint+%opopc .suset [.soption,,f] pushj p,init rloop: pushj p,rcmdl ; read a line ldb a,[350700,,cmdbuf] caie a,^M pushj p,commnd ; parse it trne f,%fdone ; was that last command? jrst quit ; yes, quit jrst rloop ; no, keep on reading subttl command line parser commnd: begin flag fn1 ; have got fn1 var dev ; device name var dir ; directory name var fn1 ; file name 1 var fn2 ; file name 2 var odev ; output device var odir ; output directory name var ofn1 ; output file name 1 var ofn2 ; output file name 2 move b,[440700,,cmdbuf] ; byte ptr to command string setzm odev ; setup so can default if unspecified cmdf: setzm dev ; ... setzm fn1 ; ... setzm fn2 ; ... trz f,%ffn1 ; init flags cmd1: move c,[440600,,d] ; for converting to sixbit movei d,0 ; ... cmd2: pushj p,cmdchr ; get next char of command cain a,^M ; end of command string? jrst cmdcr cain a,"_ ; output file specification? jrst cmdto cain a,": ; device spec? jrst cmddev cain a,"; ; directory spec? jrst cmddir cain a,"/ ; switch? jrst cmdsw cain a,40 ; space? jrst cmdsp cain a,^Q ; quote char? pushj p,cmdchr ; yes, read another without checks subi a,40 ; convert to sixbit jumpl a,cmdilc ; illegal sixbit char if negative cail a,100 ; or greater than 77 jrst cmdilc tlne c,770000 ; already have six chars? idpb a,c ; no add this one jrst cmd2 cmdsw: pushj p,cmdchr ; get switch name jrst cmd2 cmdto: pushj p,delim ; check if this delimits something .i odev=dev ; copy filename to output filename .i odir=dir ; ... .i ofn1=fn1 ; ... .i ofn2=fn2 ; ... jrst cmdf cmddev: movem d,dev ; set device name jrst cmd1 cmddir: movem d,dir ; set directory name jrst cmd1 cmdsp: pushj p,delim ; delimiting anything? jrst cmd1 cmdcr: pushj p,delim ; delimiting anything? jrst execut delim: skipn d ; any sixbit assembled? popj p, ; no, do nothing troe f,%ffn1 ; already got a fn1? jrst del1 movem d,fn1 ; no, set the fn1 popj p, del1: movem d,fn2 ; have a fn1, now we've got a fn2 popj p, cmdchr: ildb a,b ; get char cail a,"a ; lower case? caile a,"z caia subi a,40 ; yes, convert to upper case popj p, cmdilc: sout #tyoc,,"Illegal character in filename " popj p, subttl command execution var code ; error code execut: trz f,%ftty ; init flags movsi t,'tty ; default output device if unspecified skipn odev ; ... movem t,odev ; ... movsi t,'dsk ; default input device if unspecified skipn dev ; ... movem t,dev ; ... movsi t,(sixbit />/) ; default fn2 if unspecified skipn fn2 ; ... movem t,fn2 ; ... $call open,[[.uai,,fili],dev,fn1,fn2,dir,?code] jrst ex2 movs t,odev cain t,'tty ; output device = TTY? tro f,%ftty $call open,[[%tjsio+.uio,,ttyo],odev,?code] jrst ex2 pushj p,send .close ttyo, .close fili, popj p, ex2: move a,code pushj p,err popj p, .end commnd subttl send output send: begin var ttycom ; saved TTYCOM variable var ttysts ; saved TTYSTS variable $call cnsget,#ttyo,[t,t,t,a] ; get TTYCOM variable .lose %lssys movem a,ttycom ; save so can restore later tlo a,%tcrfs ; put tty into refuse mode $call cnsset,[#ttyo,[-1],[-1],[-1],a] .lose %lssys trne f,%ftty ; if output device is TTY and tlnn f,optddt ; superior is DDT then no typeout caia .value [ascii ":NOMSG 0 P"] setzm icc move t,[440700,,obuf] movem t,obp movei t,lobuf*5 movem t,occ pushj p,output $call cnsset,[#ttyo,[-1],[-1],[-1],ttycom] .lose %lssys trne f,%ftty ; if output device was TTY and tlnn f,optddt ; superior is DDT then no typeout caia .value [ascii ":NOMSG 1 P"] .close fili, .close ttyo, popj p, output: pushj p,getb jumpl a,o1 pushj p,putb jrst output o1: move t1,[440700,,obuf] movei t2,5*lobuf sub t2,occ $call siot,[#ttyo,t1,t2] .lose %lssys popj p, .end send var icc var ibpx var occ var obp libuf==100 lobuf==100 var ibuf(libuf) var obuf(lobuf) getb: skipe icc jrst gt1 move a,[440700,,ibuf] movem a,ibpx movei t,libuf*5 movem t,icc $call siot,[#fili,a,icc] .lose %lssys subm t,icc gt1: ildb a,ibpx sosge icc setom a popj p, putb: idpb a,obp sose occ popj p, move t1,[440700,,obuf] movem t1,obp movei t2,lobuf*5 movem t2,occ $call siot,[#ttyo,t1,t2] .lose %lssys popj p, subttl miscellaneous quit: skipe debug ; debugging? .value ; yes, don't die, just stop .value [asciz ":KILL "] litrl: constants ; impure stuff debug: 0 ; nonzero if debugging pat: block 100 ; DDT patch area variables lpdl==<.+20+1777>&776000-. ; use rest of page as pdl pdl: block lpdl -1 end send11