Bob’s Notebook: FONTMAKER (user-defined graphics editor)

See all articles from Sinc-Link v4 n2
Author(s): Bob Mitchell
Publication: Sinc-Link
Pub Details: Sinc-Link v4 n2 (Volume 4, Issue 2)
Date: March/April 1986
Pages: 6-7
  25 BORDER 1: CLS
30 LET g=40: GO SUB 300
35 RANDOMIZE USR 65400
40 DIM a(8,8)
50 POKE 23658,8: CLS
70 GO SUB 200
80 GO SUB 400
90 GO SUB 600
100 STOP
200 REM DRAW GRID
202 PRINT PAPER 1; INK 7;" FONTMAKER © BOB MITCHELL 1985 "
210 INK 5
220 FOR a=95 TO 159 STEP 8
230 PLOT 95,a: DRAW 64,0
240 PLOT a,159: DRAW 0,-64
250 NEXT a
260 INK 9
270 RETURN
300 LET loc=64512
310 LET msb=INT (loc/256)
320 LET lsb=loc-msb*256
330 RESTORE 350
340 FOR i=0 TO 11: READ j: POKE i+65400,j: NEXT i
345 RETURN
350 DATA 33,0,61,17,lsb,msb,1,0,3,237,176,201
400 REM MAKE FONT
405 GO SUB 700
407 GO SUB 1200
410 INK 2
420 FOR b=1 TO 8
440 PRINT AT 1,b+11;b
450 PRINT AT b+1,10;CHR$ (b+64)
460 NEXT b
470 INK 9
480 PAPER 6
490 PRINT AT 18,0;" ENTER row+col+B/W eg:C2B "
500 PRINT " [ B=Mark W=Space ] "
510 PRINT " N=(Enter character) "
520 PRINT " S=(Stop/skip) "
540 PAPER 7
550 RETURN
600 REM INPUT [illegible]
610 INPUT LINE b$
620 IF b$="S" OR b$="s" THEN GO TO 1000
630 IF b$="N" OR b$="n" THEN GO TO 800
635 IF b$<>"S" AND b$<>"N" AND LEN b$=1 THEN GO TO 600
640 IF b$(3)="B" OR b$(3)="b" THEN LET colour=143
650 IF b$(3)="W" OR b$(3)="w" THEN LET colour=128
660 PRINT AT CODE b$(1)-63,CODE b$(2)-37;CHR$ colour
670 LET a(CODE b$(1)-64,VAL b$(2))=colour
680 GO TO 600
700 REM CHOOSE CHAR
705 POKE 23658,0
707 POKE 23607,251
708 PRINT AT 11,0;" ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz 1234567890 !@#$%&'()<>;""- +=:?/*,."
709 POKE 23607,60
710 PRINT AT 20,0; FLASH 1;"Character?"; FLASH 0' PAPER 5;" OUT = SAVE font;IN = LOAD font ": INPUT LINE c$: IF c$=" OUT " THEN CLS : GO TO 1040
712 IF c$="IN " THEN CLS : LOAD ""CODE loc: GO TO 40
720 LET char=CODE c$-32
730 LET char1=char*8+loc
740 POKE 23607,251
770 PRINT AT 5,23;char1;AT 5,29;c$
780 POKE 23607,60
785 POKE 23658,8
799 RETURN
800 REM POKE DATA
805 LET char1=char1-1
810 FOR a=1 TO 8
820 LET char1=char1+1
830 LET dec=0
840 LET bin=128
850 FOR b=1 TO 8
860 IF a(a,b)=143 THEN LET dec=dec+bin
870 LET bin=bin/2
880 LET a(a,b)=0
890 NEXT b
900 POKE char1,dec
910 NEXT a
915 GO SUB 740
920 GO TO 50
1000 REM SAVE STOP SKIP
1010 INPUT "Stop,Skip? (0/1)";ss
1015 IF ss<0 OR ss>1 THEN GO TO 1000
1020 IF ss=0 THEN STOP
1030 IF ss=1 THEN GO TO 50
1040 INPUT "Name of Font? max 10 ltrs"' LINE n$
1050 IF LEN n$>10 THEN GO TO 1040
1060 PRINT "Code being saved as ";n$
1070 SAVE n$CODE loc,768: PRINT "verify": VERIFY ""CODE
1080 STOP
1100 SAVE "FONTMAKER": VERIFY ""
1199 STOP
1200 REM PRINTCHAR
1250 FOR x=0 TO 7
1260 LET l=PEEK (char1+x)
1280 FOR z=18 TO 11 STEP -1
1290 PRINT AT x+2,z+1; OVER 1; INK 5;"█" AND l-2*INT (l/2)=1
1292 PRINT AT x+2,z+1; INK 5; OVER 1;" " AND l-2*INT (l/2)=0
1300 LET l=INT (l/2)
1310 NEXT z: NEXT x
1320 RETURN
FONTMAKER screen: editing grid with the letter A
FONTMAKER screen: editing grid with the letter A
FONTMAKER screen: example Cyrillic (Russian) character set
FONTMAKER screen: example Cyrillic (Russian) character set

This program lets you design your own character sets or fonts. Type it in and RUN it.

When the grid appears, select characters one by one and redefine them to your own specifications. Follow the prompts at the bottom of the screen.

N will poke the character into memory; if you want to skip over the character you have been working on, S will cancel it out and let you start again.

S also gives you the choice of quitting the program.

Variable loc is the address where your character set starts but you may change this using an address which is a multiple of 256. Line 35 calls the machine code routine which copies the ROM character set to loc. If you change the value of loc, you must also change the POKEs at lines 707 and 740 to a value (loc/256)-1.

Saving and loading fonts is by OUT and IN on keys O and I.

Two examples of the screen are shown: the first is what you get when you start with the letter A; the second is an example cyrillic (Russian) alphabet which shows the expansion possibilities for printing on your TS2068.


TO MAKE A PROGRAM LISTING “DISAPPEAR” (ZX81)

Programs can be made to “disappear” if the following POKE is put into the program.

POKE 16509,64

Such “invisible” programs can be SAVE’ed and LOAD’ed as usual, and will RUN if address 16509 is reset to it’s original value.

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.