10REM Program SUBSGEN to assemble m/c
program to secure substitution of a cha
racter
20REM of different ASCii value and fr
om another character set
30REM on parallel printers using soft
ware selection of national character set
s
40REM from Basic or from other langua
ges
50MODE7:DIM E 12:U=E+7
60PROCparms
70REM (C) H. L. Clarke & S. B. Yeo
80USERV=&200:WRCHV=&20E:oscli=&FFF7
85REM insert VDU2 here for assembly p
rintout
90FOR pass%=0 TO 3 STEP 3
100P%=&900
110[OPT pass%
120LDA #(switch MOD 256):STA USERV
130LDA #(switch DIV 256):STA USERV+1
140LDA WRCHV:STA sub+1
150LDA WRCHV+1:STA sub+2
160LDA #(routine MOD 256):STA WRCHV
170LDA #(routine DIV 256):STA WRCHV+1
180LDX #(key0 MOD 256):LDY #(key0 DIV
256):JSR oscli
190LDX #(key1 MOD 256):LDY #(key1 DIV
256):JSR oscli
200RTS
210.sub:JSR 0:RTS
220.switch:STX flag1:RTS
230.esc:LDA #1:JSR sub
240LDA #27:JSR sub
250LDA #1:JSR sub
260LDA #(?E):JSR sub
270LDA #1:JSR sub:RTS
280.byte:EQUB 0
290.flag1:EQUB 1
300.flag2:EQUB 3
310.routine:STA byte
320LDA flag1:BEQ finish
330LDA #3:CMP flag2:BEQ chkpr
340LDA byte:CMP #3:BEQ setpflag
350CMP #(?(E+5)):BNE jp
370LDA #3:JSR sub:LDA #(?(E+5)):JSR su
b
380LDA #2:JSR sub
400JSR esc
410]
420N%=1:IF V%=1 THEN 490
430FOR N%=1 TO (V%-1)
440[OPT pass%
450LDA #(?(U+N%)):JSR sub
460LDA #1:JSR sub
470]
480NEXT
490[OPT pass%
500LDA #(?(U+N%)):JSR sub
510LDA #(?(U+5)):JSR sub
520.default:JSR esc
530]
540N%=1:IF V%=1 THEN 610
550FOR N%=1 TO (V%-1)
560[OPT pass%
570LDA #(?(E+N%)):JSR sub
580LDA #1:JSR sub
590]
600NEXT
610[OPT pass%
620LDA #(?(E+N%))
630JMP jp
640.chkpr:LDA byte:CMP #2:BNE jp
645STA flag2:JSR sub:JMP default
650.setpflag:STA flag2
660.finish:LDA byte
670.jp:JMP (sub+1)
680.key0:EQUS"K.0 *CODE 0 |M":EQUB &D
690.key1:EQUS"K.1 *CODE 1 |M":EQUB &D
700]
710NEXT
720VDU3
730INPUT"Save machine code Y/N ?
"YN$
740 IF LEFT$(YN$,1)="N" OR LEFT$(YN$,1
)="n" THEN END
750INPUT"Name to be assigned "F$
760OSCLI"SAVE "+F$+" 900 A00"
770END
10000DEFPROCparms
10010REM
10020PRINT'''"This program is intended f
or use with"'"parallel printers in which
national"'"character sets are selected
by a"
10030PRINT"sequence in the form of:"'"ES
C+<letter>+n(+n....) up to a"'"maximum o
f 3 numerals following"'"the letter"'
10040PRINT"In instruction books this is
often"'"preceded by the LPRINT command (
to"'"suit Microsoft Basic"''
10050INPUT"Letter to follow <ESC> "L$
10060?E=ASC(L$)
10070PRINT"Number of numerals to follow
letter ?"
10080INPUT V%:IF V%>3 THEN PRINTCHR$(131
);"MACHINE CODE PROGRAM WOULD BE TOO"'CH
R$(131)"LONG FOR AVAILABLE MEMORY":STOP
10090PRINT'"Please input the numerals fo
r the"'"character set to be used as"'"th
e default set"
10100FOR N%=1 TO V%
10110PRINT"Numeral ";N%;" ";:INPUT Z%
10120?(E+N%)=Z%
10130NEXT
10140PRINT'"Please input the numerals fo
r the"'"alternative character set, i.e.,
that"'"which contains substitute charac
ter"'"which is to be printed"
10150FOR N%=1 TO V%
10160PRINT"Numeral ";N%;" ";:INPUT Z%
10170?(U+N%)=Z%
10180NEXT
10190PRINT'"Please insert character for
which a"'"substitute is to be used"
10200INPUTTAB(10)E$:?(E+5)=ASC(E$)
10210PRINT'"Please insert ASCii value of
"'"substitute character (in alternative"
'"character set) which is to be printed"
10220INPUTTAB(10)u%:?(U+5)=u%
10230PRINT
10240ENDPROC