Introduction
This article derives from my using Pixel Print Professional to make keyboard overlays for the TS2068, a technique covered in Les Cottrell‘s article in the Nov-Dec 90 issue page 25. On page 26 there was a sample overlay: Pixel Print Plus!
This is truly an intriguing application of PPP, bank switching and the old workhorse TS2068 and in the process of making several overlays to suit my particular whims, I found a need for a variety of character sets (fonts) that were turned sideways (90 degrees to the right or a quarter turn clockwise). There was some urgency to create sets with narrow characters that would allow words to be crammed into the small spaces on the overlays.
Changing any one character set manually involved an inordinate amount of work and it seemed the computer ought to be able to do that for me. I set about the task of writing a suitable utility that would enable me to edit a set if need be and then to rotate it in its entirety by one press of a key.
No need the do this from scratch though! I put an old program to use: this one was called “Character Redefinition” written by D. Robinson and appeared in Personal Software Autumn 1985 p.18.
Since the original allowed for several sets to be stored and worked on, I stripped out much of the material in the BASIC to allow only one set to be processed or stored at any one time.
Rotating the character sets has been accomplished using a short 42-byte machine-code routine found in the Supercode 3.5 collection, by F. Vachha BSc & V.B. Rumsey. Although written for Spectrum, it is compatible with the TS2068 and allows a complete set to be rotated a quarter turn clockwise in about 3 seconds. A half turn will produce an upside-down set while a three-quarter turn will result in a set that is rotated 270 degrees to the right (ie, 90 degrees to the left).
The machine-code routine is contained in DATA statements at line 8500 and is loaded into memory beginning at the start address at 63163.
Instructions
FACILITY MENU
There are three options in this menu:
1 = DEFINE set.
2 = SAVE/LOAD set.
3 = ROTATE whole set.
First, it is necessary to load a character set for editing or rotation. This is done by selecting option 2. Any character set or graphics set may be loaded. The Facility Menu will then reappear.
Next, it is wise to use option 1 to view the loaded set which will appear at the bottom of the screen in three lines each of which lies directly beneath the standard TS2068 character set shown in INVERSE VIDEO. At this point it is possible to select a character for editing or to opt for rotating the entire set.
There are three options to rotate a whole 96 character set clockwise: 1) 1/4 turn, 2) 1/2 turn or 3) 3/4 turn. Note that each turn is a 1/4 revolution or 90 degrees clockwise. Thus, if the initial font has already been turned once, using option 2 will do two more turns and leave the set 3/4 of a turn from the straight up or vertical position. Using option 3 will take about 10 seconds to complete.
DEFINER MENU
As soon as a character has been selected, the menu appears. This menu is located at the right of the screen alongside two 8 x 8 grids, the left one being used for comparison purposes, the right for editing. The grid cursor flashes and makes a blipping sound.
The keys to be pressed are as follows:
Cursor keys are used to move the grid cursor about.
p = plot or fill in a square; ie, one pixel in the character being worked on.
e = erase a square.
c = store a character <chr>. (You can use a character set to hold any graphics of your choice, not just letters and numbers. eg, borders can be created.)
n = store a character and then go back to the facility menu.
o = display a character in the left grid.
q = overlay the current make up of a character in the editing grid.
m = facility menu.
When no character is being edited, a prompt line appears at the bottom of the screen for entering any character to be redefined. Before editing a character or when just viewing the whole set, you can return to the facility menu by selecting <space> and then using option <m> to get back.
All editing on a set should be completed before the set is rotated. As each character is edited its new appearance shows in the lower part of the screen under the pertinent character in inverse video.
Some uniformity in file names to identify the rotation was needed; I chose to identify fonts rotated to the right by suffixing their file names with a > character; those to the left with a < character; the normal straight-up sets with a _ (underline bar) character. The first character must be a ! to be Pixel Print compatible. For the Pixel Print Professional application designing keyboard overlays, only 1/4 turn right-rotated fonts will normally be used.
The disk containing this program and a host of fonts is available from the library. Len Cottrell has done several overlays; I have completed two (HOT Z and PRO/FILE) as well as a modified MSCRIPT overlay.
The Listing for User Entry
First, some notes:
The REM statements at the end of some lines are for the user’s information when entering the listing. These can be left out.
Line 4080 is used to POKE the address of a character into the rotate code. This could be done with a Larken double POKE but I left this in as it can be compiled while the Larken POKE cannot.
There is not much percentage in compiling this program though. In fact I tried it and it has the disadvantage of speeding up the grid cursor during edit which I found difficult to slow down (to my satisfaction). The rotate code would operate faster but is ten or twelve seconds for three rotations too much time?
100 REM CHARACTER SET EDITOR
110 REM By Bob Mitchell 1990
120 RESTORE 8500
130 FOR i=0 TO 41: READ n0: POKE 63163+i,n0: NEXT i
140 POKE 23658,0: POKE 23607,60: BORDER 0: PAPER 0: INK 7: OVER 0: CLS
150 LET j$=" !""#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{ }": REM there is only one space between the first quotation mark and the exclamation point.
160 LET b=1
170 LET po=60
180 DIM c(12): DIM h(8)
190 LET h(1)=128: FOR f=2 TO 8: LET h(f)=h(f-1)/2: NEXT f
200 BORDER 0: PAPER 0: INK 7: CLS : PRINT "Character Set Editor"''" MENU ": PRINT '''"1 > DEFINE set"'''"2 > SAVE/LOAD set"'''"3 > ROTATE whole set":REM MENU in INV VIDEO
210 LET i$=INKEY$: IF i$<"1" OR i$>"3" THEN GO TO 210
220 IF i$="1" THEN GO TO 1000
230 IF i$="2" THEN GO TO 2000
240 IF i$="3" THEN GO TO 4000
1000 PAPER 1: OVER 0: BORDER 1: INK 9: CLS : PRINT AT 0,0;"1 > Editor"
1010 FOR f=1 TO 6: POKE USR "a"+f,129: NEXT f: POKE USR "a",255: POKE USR "a"+7,255: REM graphic A is an open square
1020 POKE 23607,60: PRINT AT 15,0; INVERSE 1;j$(1 TO 32)''j$(33 TO 64)''j$(65 TO 96)
1030 LET ch=251
1040 POKE 23607,ch: PRINT AT 16,0;j$(1 TO 32)''j$(33 TO 64)''j$(65 TO 96)
1050 OVER 0: INK 7
1060 POKE 23607,po: INPUT AT 0,0;"Character to be edited ? "; LINE c$: IF CODE c$>127 OR CODE c$<32 OR LEN c$>1 THEN BEEP .5,-20: GO TO 1060
1070 PRINT AT 13,0; INVERSE 1;" EDITING: ";c$:REM EDITING: in INV VIDEO
1080 FOR f=1 TO 8: PRINT AT f,0;"AAAAAAAA AAAAAAAA": NEXT f: REM A's are GRAPHIC A's
1090 PRINT AT 0,0; INK 2; PAPER 7;"COMPARE 87654321"
1100 LET x=1: LET y=9: DIM a(8)
1110 DIM b$(8,8): LET k=(CODE c$-32)*8
1120 PRINT AT 0,18;"Cursor keys to";AT 1,19;"move.";AT 2,17;"p=plot.";AT 3,17;"e=erase.";AT 4,17;"c=store chr."
1130 PRINT AT 5,17;"n=store chr.";AT 6,18;"and return";AT 7,18;"to menu.";AT 8,17;"o=compare";AT 9,18;"chr.";AT 10,17;"q=overlay a";AT 11,18;"chr.";AT 12,17;"m=facility menu"
1140 PLOT 135,104: DRAW 0,-38: DRAW 120,0
1150 OVER 1: INK 5: PRINT AT x,y;"@_": BEEP .003,x+y: PRINT AT x,y;"@_": REM graphic is black square on key 8
1160 LET i$=INKEY$
1170 IF i$="8" AND y<16 THEN LET y=y+1
1180 IF i$="5" AND y>9 THEN LET y=y-1
1190 IF i$="7" AND x>1 THEN LET x=x-1
1200 IF i$="6" AND x<8 THEN LET x=x+1
1210 IF i$="p" AND b$(x,y-8)=" " THEN PRINT AT x,y; OVER 0;"@_": LET b$(x,y-8)="@_": LET a(x)=a(x)+2^(16-y): REM graphics are black squares.
1220 IF i$="e" AND b$(x,y-8)="@_" THEN PRINT AT x,y; OVER 0;"A": LET b$(x,y-8)=" ": LET a(x)=a(x)-2^(16-y): REM graphics are black square and graphic A
1230 IF i$="o" THEN GO SUB 1300
1240 IF i$="c" THEN GO SUB 1290: GO SUB 1440: GO TO 1050
1250 IF i$="n" THEN GO SUB 1290: GO SUB 1440: GO TO 1030
1260 IF i$="q" THEN GO SUB 1370
1270 IF i$="m" THEN CLS : BORDER 0: PAPER 0: OVER 0: INK 7: GO TO 200
1280 GO TO 1150
1290 OVER 0: FOR f=1 TO 8: POKE ch*256+256+k+f-1,a(f): NEXT f: RETURN
1300 INPUT "Chr to be compared ? "; LINE g$: IF CODE g$<32 OR CODE g$>127 OR LEN g$>1 THEN BEEP .5,-20: GO TO 1300
1310 FOR f=1 TO 8: PRINT AT f,0; OVER 0;"AAAAAAAA": NEXT f: REM graphics A
1320 FOR f=0 TO 7: LET gr=PEEK (ch*256+256+((CODE g$-32)*8)+f)
1330 FOR g=1 TO 8
1340 IF gr>=h(g) THEN PRINT AT 1+f,g-1; OVER 0;"@_: LET gr=gr-h(g): REM graphic is black square
1350 NEXT g: NEXT f
1360 RETURN
1370 INPUT "Chr to be overlaid ? "; LINE g$: IF CODE g$<32 OR CODE g$>127 OR LEN g$>1 THEN BEEP .5,-20: GO TO 1370
1380 FOR f=1 TO 8: PRINT AT f,9; OVER 0;"AAAAAAAA": NEXT f: REM graphic A
1390 DIM a(8)
1400 FOR f=0 TO 7: LET gr=PEEK (ch*256+256+((CODE g$-32)*8)+f)
1410 FOR g=1 TO 8
1420 IF gr>=h(g) THEN PRINT AT 1+f,g+8; OVER 0;"@_": LET gr=gr-h(g): LET a(f+1)=a(f+1)+h(g): LET b$(f+1,g)="@_: REM graphic is black square
1430 NEXT g: NEXT f: RETURN
1440 LET k=CODE c$-32: IF k<32 THEN LET xx=16: GO TO 1470
1450 IF k<64 THEN LET xx=18: LET k=k-32: GO TO 1470
1460 IF k<96 THEN LET xx=20: LET k=k-64
1470 POKE 23607,ch: PRINT AT xx,k;c$: POKE 23607,po: RETURN
2000 INPUT "1=SAVE 0=LOAD ";sl
2010 IF sl THEN INPUT (" SAVE file name <=6 "); LINE n$: REM SAVE in INV VIDEO
2020 IF NOT sl THEN INPUT (" LOAD file name <=6 "); LINE n$: REM LOAD in INV VIDEO
2030 INPUT "drive? ";drv: RANDOMIZE USR 100: GO TO drv
2040 IF sl THEN RANDOMIZE USR 100: SAVE n$+".Cf"CODE 64512,768
2050 IF NOT sl THEN RANDOMIZE USR 100: LOAD n$+".Cf"CODE 64512
2060 BEEP 1,10: GO TO 200
4000 REM rotate font
4010 INPUT (" ROTATE CLOCKWISE "'"1=1/4 Turn"'"2=1/2 Turn"'"3=3/4 Turn "); LINE r$: REM ROTATE CLOCKWISE in INV VIDEO
4020 IF r$<"1" OR r$>"3" THEN BEEP 1,1: GO TO 4010
4030 LET rot=CODE r$-48
4040 INPUT ;: PRINT #0;"Stand by..."
4050 FOR r=1 TO rot
4060 FOR q=0 TO 95
4070 LET l=64512+q*8
4080 RANDOMIZE l: POKE 63166,PEEK 23670: POKE 63167,PEEK 23671
4090 RANDOMIZE USR 63163
4100 NEXT q
4110 NEXT r
4120 BEEP 1,10: INPUT :: PRINT #0;"Rotation finished."'"Press a key.": PAUSE 0: GO TO 200
4130 STOP
8500 DATA 30,128,33,0,226,6,1,14
8510 DATA 0,229,123,166,254,0,40,3
8520 DATA 121,128,79,203,32,35,48,242
8530 DATA 225,197,203,59,48,231,17,7
8540 DATA 0,6,8,25,209,115,43,16
8550 DATA 251,201
9000 INPUT " SAVE PROGRAM drive? ";drv: RANDOMIZE USR 100: GO TO drv: RANDOMIZE USR 100: SAVE "redef.B1" LINE 100: REM SAVE PROGRAM in INV VIDEO
Media
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.