10 '----------------------------------------------
20 'FONT EDITOR FOR GEMINI 10X/15X PRINTER
30 'BY JOHN WALKENBACH  1984  PC-MAGAZINE
40 'REVISED FOR OSBORNE-1 BY SIMON TAM
50 '
60 'THIS EDITOR WILL PRODUCE A MBASIC PROGRAM WHICH,
70 'AFTER EXECUTION, WILL GENERATE A CHARACTER FILE.
80 'SIMPLY PIP THE CHARACTER FILE TO PRINTER TO
90 'DOWNLOAD THE NEW CHARACTER FONT.
100 'THE GENERATED MBASIC FILE CAN THEN BE ERASED OR
110 'SAVED FOR FUTURE RE-EDITING OR MERGING WITH
120 'OTHER FONTS.
130 '----------------------------------------------
140 GOSUB 930    'INITIALIZATION
150 GOSUB 570    'CLEAR SCREEN & LABEL CHARACTER MATRIX
160 GOSUB 1220   'CHARACTER EDITOR
170 GOSUB 190     'WHEN <RETURN> IS HIT, GET MENU
180 GOTO 160      'RETURN TO EDITING
190 '--------------------------------------------
200 'SUBROUTINE TO GENERATE THE OPTION MENU
210 '--------------------------------------------
220 PRINT FNPO$(22,1);
230 PRINT"1: Save redefinition    2: Clear                   "
240 PRINT"3: Exit                 4: Test on printer         "
250 PRINT"5: Continue to edit                                ";
260 PRINT FNPO$(4,1);
270 INPUT "Select function, then <RETURN>: ",F$
280 IF F$="1" THEN GOSUB 340:GOTO 330
290 IF F$="2" THEN GOSUB 570:RETURN
300 IF F$="3" THEN CLOSE #1:PRINT CHR$(26):END
310 IF F$="4" THEN GOSUB 770:GOTO 330
320 IF F$="5" THEN GOSUB 690:RETURN
330 FOR R=4 TO 5:PRINT FNPO$(R,1);SPACE$(52);:NEXT R:GOTO 260
340 '--------------------------------------------
350 'SUBROUNTINE TO READ SCREEN AND WRITE TO FILE
360 '--------------------------------------------
370 PRINT FNPO$(4,1);SPACE$(52);FNPO$(4,1);
380 INPUT "Character to be redefined: ",C$
390 INPUT "Descender (Y/N)";DES$
400 PRINT#1,LINENUM;"REM - REDEFINES ";C$:LINENUM=LINENUM+10
410 PRINT#1,LINENUM;
420 PRINT#1,"PRINT#1, CHR$(27);CHR$(42);CHR$(1);CHR$(";ASC(C$);")CHR$(";
430 IF DES$="Y" OR DES$="y" THEN PRINT#1,"1);" ELSE PRINT#1,"0);"
440 LINENUM=LINENUM+10:PRINT#1,LINENUM;"PRINT#1, ";
450 'ALTERNATE ENTRY TO READ SCREEN FOR PRINTER TESTING
460 FOR I=17 TO 16+MATCOLS
470 CODE=0:N=-1
480 FOR J=11 TO 10+MATROWS
490 N=N+1
500 IF PEEK(FNMAP(J,I))=13 THEN CODE=CODE+2^N
510 NEXT J
520 IF TEST=TRUE THEN LPRINT CHR$(CODE);:GOTO 540
530 PRINT#1,"CHR$(";RIGHT$(STR$(CODE),LEN(STR$(CODE))-1);");";
540 NEXT I
550 IF TEST=FALSE THEN PRINT#1,:LINENUM=LINENUM+10
560 RETURN
570 '--------------------------------------------
580 'SUBROUNTINE TO CLEAR SCREEN AND LABEL MATRIX
590 '--------------------------------------------
600 PRINT CHR$(26):PRINT FNPO$(1,9);"GEMINI 10X/15X FONT EDITOR"
610 PRINT FNPO$(9,17);LEFT$("123456789012",MATCOLS)
620 POKE FN MAP(10,16),9
630 FOR I=1 TO MATCOLS:POKE FN MAP(10,16+I),27:NEXT I:POKE FN MAP(10,16+I),16
640 FOR I=11 TO 11+MATROWS-1
650 PRINT FNPO$(I,14);I-10
660 POKE FN MAP(I,16),11:POKE FN MAP(I,16+MATCOLS+1),11
670 NEXT I
680 POKE FN MAP(I,16),28:FOR J=1 TO MATCOLS:POKE FN MAP(I,16+J),27:NEXT J:POKE FN MAP(I,16+J),31
690 'ALTERNATE ENTRY POINT FOR "CONTINUE"
700 PRINT FNPO$(22,1);
710 PRINT"Use arrow keys to move to desired dot location.    "
720 PRINT"Press <.> to set a dot...Space bar to remove a dot."
730 PRINT"Press <RETURN> for Option Menu.                    ";
740 PRINT FNPO$(4,1);SPACE$(52);
750 PRINT FNPO$(11,17);
760 RETURN
770 '---------------------------------------------
780 'SUBROUTINE TO TEST CHARACTER ON PRINTER
790 '---------------------------------------------
800 PRINT FNPO$(4,1);SPACE$(52);FNPO$(4,1);:INPUT "Character to replace";C$
810 LPRINT CHR$(27);CHR$(64);        'INITIALIZE PRINTER
820 LPRINT CHR$(27);CHR$(42);CHR$(0);'SELECT NORMAL CHARACTER SET
830 LPRINT CHR$(27);CHR$(42);CHR$(1);C$;
840 INPUT "Descender (Y/N)";DES$
850 IF DES$="Y" OR DES$="y" THEN LPRINT CHR$(1); ELSE LPRINT CHR$(0);
860 TEST=TRUE
870 GOSUB 450
880 LPRINT CHR$(27);CHR$(36);CHR$(1) 'SELECT DOWNLOAD SET
890 LPRINT "Here is a test of the new character: ";
900 FOR I=1 TO 20:LPRINT C$;:NEXT I:LPRINT
910 TEST=FALSE
920 RETURN
930 '---------------------------------------------
940 'SUBROUNTINE TO INITIALIZE AND SET UP KEYS
950 '---------------------------------------------
960 TRUE=1:FALSE=0
970 WIDTH 255:PRINT CHR$(26)
980 DEF FNPO$(Y,X)=CHR$(27)+"="+CHR$(31+Y)+CHR$(31+X)
990 GRAPHICS.ON$=CHR$(27)+"g":GRAPHICS.OFF$=CHR$(27)+"G"
1000 DEF FN MAP(Y,X)=(Y-1)*128+(X-1)+&HF000
1010 Q$=CHR$(34)
1020 '
1030 '
1040 MATCOLS=9  'NUMBER OF DOT MATRIX COLUMNS
1050 MATROWS=7  'NUMBER OF DOT MATRIX ROWS
1060 PRINT FNPO$(1,9);"GEMINI 10X/15X FONT EDITOR"
1070 PRINT FNPO$(22,1);:INPUT"File for output";FILE$
1080 IF FILE$="" THEN PRINT CHR$(7):GOTO 1070
1090 FILE$=FILE$+".BAS"
1100 INPUT"New file or Append (N/A)";TYPE$
1110 IF TYPE$="A" OR TYPE$="a" THEN INPUT"Line number for 1st statement";LINENUM:GOTO 1130
1120 LINENUM=10
1130 OPEN "O",1,FILE$
1140 PRINT#1,LINENUM;"INPUT ";Q$;"FONT FILE: ";Q$",F$":LINENUM=LINENUM+10
1150 PRINT#1,LINENUM;"OPEN ";Q$;"O";Q$;",1,F$":LINENUM=LINENUM+10
1160 IF TYPE$="A" OR TYPE$="a" THEN GOTO 1210
1170 PRINT#1,LINENUM;"REM - DOWNLOAD NORMAL CHARACTER SET":LINENUM=LINENUM+10
1180 PRINT#1,LINENUM;"PRINT#1,CHR$(27);CHR$(42);CHR$(0);":LINENUM=LINENUM+10
1190 PRINT#1,LINENUM;"REM - SELECT DOWNLOAD CHARACTER SET":LINENUM=LINENUM+10
1200 PRINT#1,LINENUM;"PRINT#1,CHR$(27);CHR$(36);CHR$(1);":LINENUM=LINENUM+10
1210 RETURN
1220 '--------------------------------------------
1230 'SUBROUTINE TO EDIT A CHARACTER
1240 '--------------------------------------------
1250 Y=11:X=17
1260 ED$=INKEY$:IF ED$="" THEN 1260
1270 IF ED$=CHR$(13) THEN RETURN
1280 IF ED$="." OR ED$="5" THEN GOTO 1400
1290 IF ED$=" " OR ED$="0" THEN GOTO 1430
1300 IF ED$=CHR$(11) OR ED$="8" THEN Y=Y-1
1310 IF ED$=CHR$(10) OR ED$="2" THEN Y=Y+1
1320 IF ED$=CHR$(12) OR ED$="6" THEN X=X+1
1330 IF ED$=CHR$(8) OR ED$="4" THEN X=X-1
1340 IF Y>10+MATROWS THEN Y=11
1350 IF Y<11 THEN Y=10+MATROWS
1360 IF X>16+MATCOLS THEN X=17
1370 IF X<17 THEN X=16+MATCOLS
1380 PRINT FNPO$(Y,X);
1390 GOTO 1260
1400 IF PEEK(FN MAP(Y,X-1))<>13 AND PEEK(FN MAP(Y,X+1))<>13 THEN GOTO 1420
1410 PRINT CHR$(7);:GOTO 1260
1420 PRINT FNPO$(1,1);:POKE FN MAP(Y,X),13:PRINT FNPO$(Y,X);:GOTO 1260
1430 PRINT FNPO$(1,1);:POKE FN MAP(Y,X),32:PRINT FNPO$(Y,X);:GOTO 1260
1,1);:POKE FN MAP(Y,X),13:PRINT FNPO$(Y,X);:GOTO 1260
1430 PRINT FNPO$(1