> MakeLPf ! Squash with TOOLKIT+ CRUNCH &87:reloc(&D00) (&84:ver$="1.13": Type II 2 Creates lp and View driver < Started View PDrv F: Pinit: mcode% &300 Z err " at line ";: d*FX4 nmenu:*FX4 x init lp%=:view%=:osfg%= !esc%=:esc2%=:c$="Code for " plen%=66:tlen%=60:lf%= ff%=:fflf%=:endff%= high%=:grafP%=:grafM%= pound1%=:pound2%=:xtr%=0 OSWRCH=&FFEE:OSASCI=&FFE3 OSFIND=&FFCE:OSBGET=&FFD7 -let$(101):l%=32 101:let$(l%)=" ": Ll%=32 101: let$(l%):let$(l%)<>"" let$(l%)=(let$(l%)) let$(l%)=""  n CHR$27+"@",,CHR$27+"E",,CHR$27+"G",,,,,CHR$27+"4",,,,,,,,,,CHR$27+"S0",,,,CHR$27+"W1",,CHR$27+"S1",,,,,,  CHR$27+"R"+CHR$3+"#"+CHR$27+"R"+CHR$0,,CHR$27+"F",,CHR$27+"H",,,,,CHR$27+"5",,,,,,,,,,CHR$27+"T",,,,CHR$27+"W0",,CHR$27+"T",,,,,, + CHR$27+"-0",CHR$27+"-1",,,,,,,,,,,,,, : " ,ݤstr(A$): l%,B$ 6B$="":A$="++":="Set bit 7" @A$="--":="Clear bit 7" J A$="" ="" T-l%=1 A$:m$=A$,l%,1):l%<>1 B$=B$+"," ^^ m$<32 m$>126 B$=B$+×m$ (m$>="0" m$<="9") m$="," B$=B$+34+m$+34 B$=B$+m$ h :=B$ r<ݤmenu::4"Printer Driver Generator ";ver$'4;29,"=") |'(9)"(C)1992 J.G.Harston" ''5"1 : General settings" '5"2 : Letter extensions" '5"3 : Save settings" '5"4 : Load settings" "'5"5 : (Create View Driver)" '5"6 : Create lp Program" ''5"0 : Exit"'' 5"Press a key: ";: .A$=:"0123456*"+13+0,A$):A$<>"*" A$ #A$="*" "*"A$:A$:A$="":":"; ` A$=0 "Saving...";:"SAVE "+$(+4),$(+4),">")+1)+" "+~+" "+~P+" FFFF0000 FFFFFB00" A$="1" setup1 A$="2" setup A$="3" save A$="4" load A$="5" assm1 &A$="6" assm2 0A$<>"":=A$="0" :ݤerr:=17 -1=0 =0 D A$ N:A$=:=-1 X setup1 b:10"General Parameters"' lR"Auto linefeed? "ny(lf%)''"Paper length: ";plen%''"Text page length: ";tlen% vD'"FF at end of page? "ny(ff%)''"LF at end of page? "ny(fflf%) ''"FF after last page? "ny(endff%) 1'"Convert CHR$96 (`) to pound? "ny(pound1%) 6"Convert CHR$163 ("163") to pound? "ny(pound2%) c$"pound: "str(let$(64)) '"Highlight 1:" 'c$"underline on: ";str(let$(97)) 'c$"underline off: ";str(let$(96)) -'"Use extended highlights? ";ny(high%)'  high% ' Whigh% "Highlight 2:"'c$"bold on: ";str(let$(98))'c$"bold off: ";str(let$(99)) '' X40,"=")"Printer reset with code '@' (see page 2)Pound also defined with code '`'";  13,2);:lf%=yn(lf%)  718,4);x%:x(18,4):x%>10 plen%=x%:14,4);x%;" " 722,6);x%:x(22,6):x%>10 tlen%=x%:18,6);x%;" "  517,8);:ff%=yn(ff%):ff% fflf%=:19,10);"No " *$ff% 17,10);:fflf%=yn(fflf%) 4A18,12);:ff%+fflf%=0 endff%=0:"? No " endff%=yn(endff%) >A27,14);:pound1%=yn(pound1%):28,15);:pound2%=yn(pound2%) Hw0,17)"Code: ";:""x$:x(0,17):x$<>"" let$(64)=txtTOstr(x$):16,16)str(let$(64));:x(,):x$=" " let$(64)="" Rw0,21)c$"on: ";:""x$:x(0,21):x$<>"" let$(97)=txtTOstr(x$):24,19)str(let$(97));:x(,):x$=" " let$(97)="" \x0,21)c$"off: ";:""x$:x(0,21):x$<>"" let$(96)=txtTOstr(x$):24,20)str(let$(96));:x(,):x$=" " let$(96)="" f23,22);:high%=yn(high%) pv:high% x(,):x(0,+1):x(0,+1) "Highlight 2:"'c$"bold on: ";str(let$(98))'c$"bold off: ";str(let$(99)) zhigh% 0,27)c$"on: ";:""x$:x(0,27):x$<>"" let$(98)=txtTOstr(x$):19,25)str(let$(98));:x(,):x$=" " let$(98)="" high% 0,27)c$"off: ";:""x$:x(0,27):x$<>"" let$(99)=txtTOstr(x$):19,26)str(let$(99));:x(,):x$=" " let$(99)="" )0,28)"Ok";:ok%=yn():x(0,28):ok%  "x(X%,Y%):X%,Y%);(39-);:  ݤny(F%):F%:="Yes" ="No " $ݤpm(l%):l%=grafP%:="Set bit 7" 0l%<>grafM%:=str(let$(l%)) ="Clear bit 7" ishow(A%)::l%=0 31:0,l%);(l%+A%+32);" ";pm(l%+A%);20,l%);(l%+A%+64);" ";pm(l%+A%+32);:: "setup:t%=32:show(t%):*FX4,1 ul%=0:::1+20*((l%32)1),l%32);":";20,31);(l%+t%+32);" ";str(let$(l%+t%)),16);(38-);20,31);:K%=:m%=l% K%=136 m%=l%-32 K%=137 m%=l%+32 K%=138 m%=l%+1 K%=139 m%=l%-1  K%=135 t%=t% 32:show(t%) m%<0 m%>62 m%=l% $0m%<>l% 1+20*((l%32)1),l%32);" ";:l%=m% .K%<127 K%>31:do:0: 8do B22,31);(16);22,31); L#txt$=txtTOstr(getstr(K%,17)) Vtxt$,1)=" " txt$="" ` txt$="" grafP%=l% grafP%= j txt$="" grafM%=l% grafM%= tZtxt$="++" grafP%> ((grafP%-t%)&FFC0)=0 2+20*((grafP%-t%)32),grafP%31);(18); ~Ztxt$="--" grafM%> ((grafM%-t%)&FFC0)=0 2+20*((grafM%-t%)32),grafM%31);(18); 0txt$="++" txt$="":grafP%=(l%+t%)(l%+t%<32) 0txt$="--" txt$="":grafM%=(l%+t%)(l%+t%<32) let$(l%+t%)=txt$ 72+20*((l%32)1),l%32);pm(l%+t%);(20-( 20)); 0 ݤtxtTOstr(A$): l%,B$ l%=1::m$=A$,l%,1) 2 (m$<"0" m$>"9") m$<>34 B$=B$+m$:l%=l%+1 8 m$=34 A$,l%+2,1)=34 B$=B$+A$,l%+1,1):l%=l%+3 E (m$>="0" m$<="9") B$=B$+(A$,l%)):l%=l%+A$,l%)+",",",")-1  A$,l%,1)="," l%=l%+1 l%>A$:=B$ ݤgetstr(A$,len%): B%,l%  ?$mcode%=A$:l%=A$:A$;::B%=: B%=127 l%<>0 127:l%=l%-1 7 B%>31 B%<127 l%"" m%=1 let$(l%):esc2%=esc2%(let$(l%),m%,1)>127): (l%=l%+1:l%=102 esc2%:esc2%:=chk2 &2l%=0::let$(l%)<>"" let$(l%),1)<>27 esc%=0 0l%=l%+1:l%=102 esc%=0:=0 :Vݤchk2:esc%=0:f%=0:l%=0::let$(l%)<>"" m%=1 let$(l%):chk(let$(l%),m%,1)): D^l%=l%+1:l%=102 (esc%f%):esc%f% "Can't build table with both 0 and 255";:f%=:= =0 Nchk(A%):A%=0 esc%=: XA%=&FF f%= b ltable(opt%) vyflg%=(esc%128)+(lf%64)+(ff%32)+(fflf%16)+(high%8)+(pound1%4)+(pound2%2)+(endff%1):xflg%=(esc2%128)+(xtr%64) [OPTopt%:EQUB flg%:EQUB (plen%31)+(((grafM%-32)*4)&E0):EQUB (tlen%31)+(((grafM%-32)*32)&E0):EQUB xflg%+((grafP%-32) (grafP%>0 grafM%>0)):.offsets:] !l%=0 101:let$(l%)<>"" tb :[OPTopt%:EQUB 255:]: tb:[OPTopt%:EQUB l%+1:] 3esc2% [OPTopt%:EQUS let$(l%):EQUB esc%&FF:]: Kesc% [OPTopt%:EQUS let$(l%),2,let$(l%)-2):EQUB 128+let$(l%),1):]: C[OPTopt%:EQUS let$(l%),let$(l%)-1):EQUB 128+let$(l%),1):]: : *assm2:"Create 'lp' program":chk ."Filename to save by: "F$: F$="" F$="lp" 9SF$=F$:SF$,".") SF$=SF$,SF$,".")+1):SF$,".")=0 "Assembling ";F$:code%=&FFFF0900:end_point=0::O%=mcode%:P%=code%:oldEnd=end_point:assm_lp(4):end_point>&B00 code%=&FFFF08C0 4end_point=oldEnd:O%=mcode%:P%=code%:assm_lp(6) ?"Saving ";F$'"Start: &";~code%&FFFF;" End: &";~end_point  L"SAVE "+F$+" "+~mcode%+" "+~O%+" "+~(start%&FFFF0000)+" "+~code%: assm_lp(opt%)  table(opt%) *first(opt%) 4second(opt%) >third(opt%) Hmiddle(opt%) Rlast(opt%) \ f: pfirst(opt%) z [OPT opt%  .num_to_1 LDA #1:STA number:RTS  .escape TYA:PHA:JSR num_to_1 LDA #124:JSR &FFF4 LDA #15:JSR &FFF4 PLA:TAY:.end:] endff% [OPT opt%:JSR cls:] #[OPT opt%:DEC number:BEQ EndAll "LDA #0:STA &A8:STA &A9:STA &AA STA &AB:LDX #&A8:LDA #1 JSR &FFDA:\ Rewind .StartPrint JSR lines_to_0:STA pages JMP start_loop  .EndAll $LDA #3:JSR OSWRCH:LDA #0:] .*end_point<&B00 [OPT opt%:JMP OSFIND:] 8nend_point>&AFF [OPT opt%:JSR OSFIND:LDA #0:LDX #1:JSR &FFF4:CPX #3:BCS exit:LDA #18:JMP &FFF4:.exit:RTS:] B L: Vsecond(opt%) ` [OPT opt% j .new_line tJSR do_CR:LDA lines ~CMP #tlen%:BCC start_loop &JSR cls:\ does INC pages & lines=0 .start_loop LDX #1 ]: : third(opt%) [OPT opt% .loop BIT &FF:BMI escape JSR OSBGET:BCS end ]: : middle(opt%) [OPT opt% CMP #32:BCC ctrl:] *(grafP%grafM%)>0 [OPT opt%:A bit7:] (-pound1% [OPT opt%:CMP #96:BEQ do_pound:] 2.pound2% [OPT opt%:CMP #163:BEQ do_pound:] < [OPT opt% F.try_again PINX:JSR do_char1:JMP loop Z .ctrl dCMP #13:BEQ new_line nCMP #10:BEQ new_line xCMP #9:BEQ tab CMP #12:BEQ do_cls CMP #28:BEQ underline ECMP #29:]:high% [OPT opt%:BEQ extension:] [OPT opt%:BEQ bold:] [OPT opt%:BNE loop:] \ pound1% pound2% [OPT opt%:.do_pound:\BIT flg2:\BMI try_again:LDA #64:BNE try_exten:] [OPT opt% $.do_cls:JSR cls:JMP start_loop:] ehigh% [OPT opt%:.end2:JMP end:.extension:JSR OSBGET:BCS end2:SBC #31:BMI loop:CMP #95:BCS loop:] Ҋ(grafM%grafP%)>0:[OPT opt%:CMP #grafP%:BEQ doPl:CMP #grafM%:BNE try_exten:LDA #0:.setPM:STA bit7:JMP loop:.doPl:LDA #128:BMI setPM:] [OPT opt% .try_exten JSR do_exten:JMP loop .underline LDA flg2: #1:STA flg2  #1:A #96:.under2 JSR do_exten:JMP loop:] "Qhigh% [OPT opt%:.bold:LDA flg2: #2:STA flg2:LSR A: #1:A #98:BNE under2:] , [OPT opt% 6.tab @TXA: #7:TAX:.tab_lp JLDA #32:JSR do_char1 TINX:TXA:CMP #8:BNE tab_lp ^ JMP loop h .DoEsc rLDA #27:BNE do_char | .do_char1 \BIT flg2:\BMI do_char2 .do_char PHA:LDA #1:JSR do_char2:PLA .do_char2 \BIT flg2:\BMI ignore JMP OSWRCH:] -ff% [OPT opt%:.cls:LDA #12:JSR do_char:] Mfflf% [OPT opt%:.cls_lp:JSR OneCR:.cls:LDA lines:CMP #plen%:BCC cls_lp:] [OPT opt% INC pages:.lines_to_0 LDA #0:STA lines:RTS 0.do_CR:BIT flg2:BVC OneCR:JSR OneCR:.OneCR:] )lf% [OPT opt%:LDA #10:JSR do_char1:]  [OPT opt% "INC lines:LDA #13:JMP do_char1  .do_exten &STX chars_out 0CLC:ADC #1:LDX #0:.ext2lp :CMP offsets,X:BEQ ext_doIt DBCC exten_end:PHA N .ext2skip X8INX:LDA offsets,X:]:esc2%=0 [OPTopt%:BPL ext2skip:] b#esc2%esc% [OPTopt%:CMP #&FF:] l"esc2% [OPTopt%:BNE ext2skip:] v[OPTopt%:PLA:INX:BNE ext2lp .ext_doIt:] 'esc2%=0 esc% [OPTopt%:JSR DoEsc:] )[OPTopt%:.ext2lp2:INX:LDA offsets,X:] #esc2%esc% [OPTopt%:CMP #&FF:] #esc2% [OPTopt%:BEQ exten_end:] esc2%=0 [OPTopt%: #127:] PTopt%:JSR do_char1:] Jesc2%=0 [OPTopt%:LDA offsets,X:BPL ext2lp2:] [OPTopt%:JMP ext2lp2:] &[OPT opt%:.exten_end:LDX chars_out RTS:]  : last(opt%) o%=O%:p%=P%:[OPT opt% .number:BRK .startpg:BRK .lines:BRK *.pages:BRK 4.flg2:BRK:\ -+....bu >.chars_out H.]:(grafM%grafP%)>0:[OPT opt%:.bit7:BRK:] RO%=o%:P%=p%:[OPT opt% \ .start% f LDX #&A8:LDY #0:JSR num_to_1 pSTY startpg:JSR &FFDA z!LDA (&A8),Y:CMP #13:BEQ error LDX #0:CMP #"+":BNE notPlus "LDX #&40:JSR SkpSpc1:BEQ error .notPlus STX flg2:TYA:PHA .Skip2 INY:LDA (&A8),Y:CMP #"!" #BCS Skip2:JSR SkpSpc:BEQ OpenIn JSR GetDec:STA number JSR SkpSpc:BEQ OpenIn JSR GetDec:STA startpg .OpenIn PLA:CLC:ADC &A8:TAX LDA #0:ADC &A9:TAY LDA #&40:JSR OSFIND TAY:BEQ NotFound LDA #2:JSR OSWRCH $ LDA #32:JSR do_exten:\ reset .JMP StartPrint 8 .error B .DecErr LCBRK:EQUB 220:EQUS "Syntax: "+SF$+" (+) ()":\ () V .NotFound `BRK:EQUB 214 jEQUS "Not found":BRK t: ~ .GetDec  LDA #0  .DecLp  STA &AA LDA (&A8),Y:CMP #"0" BCC GotDec  #15:PHA %LDA &AA:ASL A:ASL A:ADC &AA:ASL A STA &AA:PLA:ADC &AA INY:BNE DecLp  .GotDec LDA &AA:RTS :  .SkpSpc1  INY  .SkpSpc LDA (&A8),Y:CMP #" " (BEQ SkpSpc1:CMP #13:RTS 2EQUS "V"+ver$:BRK <.end_point F]: P4 Syntax: lp (+) ( ( ())) Z: dsave:chk nd'"Save settings":"Filename: "F$:P%=mcode%:table(0):"SAVE "+F$+" "+~mcode%+" "+~P%+" 0 0": x: Eload:'"Load settings":"Filename: "F$:"LOAD "+F$+" "+~mcode% @mc%=mcode%:?mc%=&4C mc%?3=&4C mc%?6=&4C mc%=mc%+13: View flg%=?mc%:plen%=mc%?1:tlen%=mc%?2:xflg%=mc%?3:typ%=mc%?4:grafM%=8*(plen%32)+tlen%32:plen%=48+(plen%31 16):tlen%=48+(tlen%31 16):grafP%=xflg%31:grafP%=0 grafP%=:grafM%= grafP%=grafP%+32:grafM%=grafM%+32 esc%=(flg%128)<>0:lf%=(flg%64)<>0:ff%=(flg%32)<>0:fflf%=(flg%16)<>0:high%=(flg%8)<>0:pound1%=(flg%4)<>0:pound2%=(flg%2)<>0:endff%=(flg%1)<>0 Desc2%=(xflg%128)<>0:xtr%=(xflg%64)<>0:esc% esc$=27 esc$="" typ%=0 rdI: (typ%>80 "Unknown format";:typ%=: x%=1:typ%=1 x%=-31 m%=mc%+4:esc2% rd3: ul%=0 101:let$(l%)="":?m%=l%+x%:m%=m%+1:let$(l%)=let$(l%)+(?m% 127):?m%>127:m%=m%+1:let$(l%)=esc$+let$(l%) : rd3:l%=0 101:let$(l%)="":?m%=l%+1:m%=m%+1:let$(l%)=let$(l%)+?m%:?m%=(esc%&FF):m%=m%+1:let$(l%)=let$(l%),let%(l%)-1) : rdI:m%=mc%+84:l%=4 73:len%=?(mc%+l%+1)-mc%?l%:len%>0 let$(l%+28)=esc$:n%=1 len%:let$(l%+28)=let$(l%+28)+ch(?m%):m%=m%+1: let$(l%+28)="" :grafM%=:grafP%=: 3ݤch(c%):esc2% c%>127:=27+(c%127) =(c%) " ݤyn(F%) , K%:"? (";(78-F%*11);")"; 6:K%=:K%>95 K%=K%&DF @K%=13 K%=89 K%=78 J K%=13 K%=F% K%=K%=89 T3,127); ^ K% "Yes" "No " h=K% rCreloc(S%):A%=133:X%=&84:A%=( &FFF4 &FFFF00)256:A%-P>S% |2B%=(+(A%-P-S%))&FF00:"Relocating to &";~B% *K.0 RUN|M  *FX225,1 *FX138,0,128 )A%=0 P-+4 4:B%!A%=A%!::=B%: