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