Authors
Publication
Pub Details
Date
Pages
Among the extended capabilities of the TS2068 are its high resolution graphics and user defined graphics characters (UDG). Since the definition of each character requires 64 binary inputs, these entries can be made much more easily if we set up a little more elaborate input routine than the one given in the manual.
We will consider first a routine to define and store 21 characters, the limit of the UDG file. Then we will look at one method of providing for the definition, storage, and recall of as many “pages” or sets of characters as we have the inclination and RAM capacity to define.
Character Definition Routine
Listing 1 provides one routine for entering the characters more easily. It starts with line 9000 to permit MERGEing it with other programs if desired.
Type in the program, RUN, and ENTER.
12345678 INPUT e FOR ERROR
will appear. You are ready to draw your own character by using the 1 and O keys as your pencil and paper. Pressing 1 gives a black block; 0, a yellow block. If you make an error, press e and start over. The computer assigns your character to the next open letter.
When the twenty-first character is completed, the whole “page” of characters is displayed. BREAK may be used at any time, followed by GO TO 9600 to revise the character set or GO TO 9700 to SAVE to tape.
To SAVE to tape, type GO TO 9700 and start the recorder at the first prompt. Continue recording and press any key at the second prompt. BREAK to get out of LOAD mode after both SAVEs have been completed. CAPS SHIFT 9 for GRAPHICS mode will then produce the new character set on keys a through u.
Additional Pages
To provide for storing more than one set of 21 defined characters or “pages” in memory above RAMTOP, we must first CLEAR the required area. Each set requires 168 bytes of storage plus 12 bytes for the LDIR block transfer routine which transfers sets of data back and forth between the storage area and the UDG area beginning at 65368 in RAM. Since CLEAR deletes all variables, we will preface the LOADing of the main program with the short routine in Listing 2 which stores in line 1 REM nn the number of pages to be CLEARed in memory, CLEARs this RAM area, then goes automatically into MERGE mode for the main program following it on tape. The second n byte in 1 REM may be used to store a starting page number safe from RUN or CLEAR if desired by inserting
9312 POKE (VAL r$+6),pno
It then goes into LOAD “bin” CODE mode for the character definition codes SAVEd to tape following the main program listing. Line numbers must be exactly as listed in order for the proper MERGEing and LOADing sequences to take place automatically when the three SAVEs are played back with LOAD “bin” or LOAD “”.
Type in Listing 2 and input the number of sets or pages of characters you wish to define. Start the recorder at the line 9040 SAVE prompt, then BREAK, and stop the tape when the LOAD mode commences. Enter LOAD “bin” and reLOAD from tape the character definition program in Listing 1. (You did SAVE it, didn’t you?)
Add to it the lines and changes indicated in Listing 3.
SAVE the listing to tape immediately following the short CLEAR memory routine by using GO TO 9200. Now rewind the tape, enter LOAD “bin” or LOAD “*”, and start the tape at the CLEAR memory routine. Let it run until both it and the main listing are reLOADed. BREAK and GO TO 9300. Begin defining your characters at PAGE 1. At any point before the completion of a page or set of 21 characters, entering “a” will return you to the printout and menu where entering “s” will start the SAVE of the definition codes to tape, immediately following the SAVE of the main listing. All three SAVEs will LOAD one after the other by starting with LOAD “bin” or LOAD “”,
It is not necessary to MERGE the entire character definition listing with a program in which you wish to use various sets of characters. First, make a SAVE to tape of the short CLEAR memory routine. Next, reLOAD the main character definition routine and insert line 9500 RETURN. Delete all lines except 1 REM nn up to 9200 and delete all lines after 9500 except 9999. Delete lines 9245, 9335, 9340, 9410, 9470, and all DATA in 9480 following the first 201. The second set of DATA is no longer needed since all block transfers will now be made only from the page files to the UDG file.
When editing has been completed, enter as a direct command
LOAD “bin” CODE 65356-168*nop,168*nop
and LOAD the definition codes (the third SAVE in the original series). Immediately following the CLEAR memory routine on the tape, SAVE the abbreviated listing and the codes by GO TO 9200, then BREAK, then GO TO 9999.
These three consecutive SAVEs will reLOAD in sequence by starting with a LOAD “bin” or LOAD *”. They may now be MERGEd with a program using UDG characters as long as it does not contain a line 1 or any other line numbers used in the UDG subroutine.
A typical program line to call up a new page of UDG characters would be like this
10 LET pno=1: GO SUB 9315: PRINT “a”
The letter “a” is entered in GRAPHIC mode (CAPS SHIFT 9) and “pno” is the page number. Depending on which page of UDG characters is in the UDG file at the time, the “a” will display and PRINT the first character of that page or a space if that character is undefined in the UDG file.
Line Notes:
Listing 1
9004-9005: Provide an uninterrupted scroll from the bottom line upward.
9015: “bin” is a token word (as on the ZX/TS2068 computers the underlined words in the PRINT statements may be obtained by first entering the token word THEN, followed by the desired token word. The deletion of the THEN is a bit tricky as are line numbers since the deletion of the token word DELETE must be done with the same keystroke.).
9030: INKEY$ input is in binary digits with a restart on a character if “e” (error) is input. Hold the key down for at least 1/60 of a second or INKEYS will be read as an invalid value.
9040: In a multiple statement line any prior condition set at the beginning of the line applies to the operation of the statements following in the same line.
9070: A temporary attribute may be assigned by making the line read:
IF a$=“0” THEN PRINT INK 6; “ ”;
The INK attribute reverts to original on the next statement.
9710: SAVEs the definition codes separately since the UDG file does not SAVE along with the listing.
9720: The autoLOAD instruction in line 9700 is not activated until after the program is reLOADed back from tape with either LOAD “bin” or LOAD “”.
Listing 2
1: REM nn must not be overwritten by any program in which the UDG routines are used.
Listing 3
9230: Allows restarting the program at any time by GO TO menu.
9245: Will appear in the main listing after MERGEing. It must be deleted before reSAVEing the main listing back to tape, otherwise the LOADing sequence will be interrupted.
9480: Data is code for the LDIR block transfer routine to and from UDG file.
Listing 1: Character definition routine
1 REM ??
9000 LET r=97
9004 POKE 23692,-1
9005 PRINT AT 21,0
9007 PRINT "12345678 INPUT e FOR ERROR"
9008 FOR g=r TO 117
9009 FOR i=1 TO 8
9010 LET byte=0
9015 LET b$="BIN "
9020 FOR n=7 TO 0 STEP -1
9030 PAUSE 0
9035 LET a$=INKEY$
9040 IF a$="e" THEN LET r=g: GO TO 9005
9050 IF a$<>"1" AND a$<>"0" THEN GO TO 9030
9055 LET b$=b$+a$
9060 LET byte=byte+2^n*VAL a$
9070 IF a$="0" THEN PRINT INK 6: PRINT " ";: INK 0
9080 IF a$="1" THEN PRINT " ";
9090 NEXT n
9100 PRINT i;TAB 10;b$;TAB 24;byte
9110 POKE USR CHR$ g+i-1,VAL b$
9130 NEXT i
9140 PRINT CH$ g;TAB 9;CHR$ (g+47)
9150 NEXT g
9600 PRINT "CHR$ PRINT OUT "
9610 FOR n=144 TO 164
9620 PRINT CHR$ n;
9630 NEXT n
9640 PRINT '"abcdefghijklmnopqrstu"
9650 PRINT '''" INPUT NEW CHR$ AT (a TO v)"'" INPUT s TO SAVE CODE "
9660 PAUSE 0
9680 LET r=CODE INKEY$
9685 if a$="s" THEN GO TO 9710
9690 GO TO 9004
9700 SAVE "bin" LINE 9720
9710 SAVE "bin"CODE 65368,168
9720 LOAD "bin"CODE 65368,168
Listing 2: Short clear memory routine
1 REM ?n
9002 LET r$="PEEK 23635+PEEK 23636*256"
9010 PRINT "NO. PAGES TO CLEAR ?"
9020 INPUT nop
9030 POKE (VAL r$+5),nop
9040 SAVE "bin" LINE 9050
9050 CLEAR 65356-168*nop
9060 LET r$="PEEK 23635+PEEK 23636*256"
9070 LET nop=PEEK (VAL r$+5)
9240 MERGE "bin"
9245 LOAD "bin"CODE 65356-168*nop,168*nop
Listing 3: Page Routine
1 REM ??
9002 LET r=97
9004 POKE 23692,-1
9005 PRINT AT 21,0
9006 PRINT "PAGE NO. ";pno;" INPUT e FOR ERROR"
9007 PRINT "12345678 INPUT a TO POKE TO PAGE"
9008 FOR g=r TO 117
9009 FOR i=1 TO 8
9010 LET byte=0
9015 LET b$="BIN "
9020 FOR n=7 TO 0 STEP -1
9030 PAUSE 0
9035 LET a$=INKEY$
9040 IF a$="e" THEN LET r=g: GO TO 9005
9045 IF a$="a" THEN GO TO 9340
9050 IF a$<>"1" and a$<>"0" THEN GO TO 9030
9055 LET b$=b$+INKEY$
9060 LET byte=byte+2^n*VAL a$
9070 IF a$="0" THEN INK 6: PRINT " ";: INK 0
9080 IF a$="1" THEN PRINT " ";
9090 NEXT n
9100 PRINT i;TAB 10;b$;TAB 24; byte
9110 POKE USR CHR$ g+i-1,VAL b$
9130 NEXT i
9140 PRINT TAB 5;CHR$ g;" ";CHR$ (g+47)
9150 NEXT g
9155 PRINT "PAGE NO. ";pno;" COMPLETED TO "
9160 LET pno=pno+1
9170 GO TO 9340
9200 SAVE "bin" LINE 9120
9210 LET r$="PEEK 23635+PEEK 23636*256"
9220 LET nop=PEEK (VAL r$+5)
9230 LET menu=9300
9240 LOAD "bin"CODE 65356-168*nop,168*nop
9300 PRINT "(MAX. pp = ";nop;") READ PAGE NO. ";
9310 INPUT pno: PRINT pno
9315 LET v=65356-pno*168
9320 LET phi=INT (v/256)
9330 LET plo=v-phi*256
9335 GO TO 9400
9340 RANDOMIZE USR 65356
9400 RESTORE
9410 FOR k=1 TO 2
9420 FOR n=65356 TO 65357
9430 READ A
9440 POKE n,a
9450 NEXT n
9460 RANDOMIZE USR 65356
9470 NEXT k
9480 DATA 1,168,0,17,88,255,33,plo,phi,237,176,201,1,168,0,17,plo,phi,33,88,255,237,176,201
9600 PRINT "PAGE ";pno
9610 FOR n=144 TO 164
9620 PRINT CHR$ n;
9630 NEXT n
9640 PRINT '"abcdefghijklmnopqrstu"
9650 PRINT '''" INPUT NEW CHR$ AT (a TO u)"'" INPUT x IF NEW PAGE"'" INPUT s TO SAVE CODE "
9660 PAUSE 0
9665 LET a$=INKEY$
9670 LET r=CODE a$
9675 IF a$="x" THEN GO TO 9300
9680 IF a$="s" THEN GO TO 9999
9690 GO TO 9004
9999 SAVE "bin"CODE 65356-168*nop,168*nop
Products
Downloadable Media
Image Gallery
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.