Speed up graphics and save memory by using POKE. For example, POKE 16511,63 uses less memory and gives the same result as PRINT AT 0,1;”Z”. Try it.
POKE graphics are simply a more efficient way of printing to the screen. You POKE a character code in one of the display file’s memory locations and the character with that code appears on screen. This method accesses 32 columns and 24 lines compared to 32 columns and 21 lines using PRINT.
To use POKE graphics, find PRINT’s starting address in the display file by PEEKing the system variable DF_CC at address 16398. To find this address enter the following line:
PRINT PEEK 16398+256*PEEK 16399
You should get 16510 with no program in your machine.
Unlike other computers, your ZX/TS’s display file is not fixed; its address changes with program length. As you add more program lines, the starting address gets higher. You can always find the starting address by including
LET A=PEEK 16398+256*PEEK 16399
in your program.
Try the following program to see POKE graphics capabilities. It also shows the greater speed of POKE graphics as opposed to PRINT graphics. It is an etch-a-sketch program controlled by 5, 6, 7 and 8 arrow keys.
Enter and RUN, BREAK to exit.
10 LET A=PEEK 16398+256*PEEK 16399
20 POKE A,128
30 IF INKEY$="5" THEN LET A=A-1
40 IF INKEY$="6" THEN LET A=A+33
50 IF INKEY$="7" THEN LET A=A-33
60 IF INKEY$="8" THEN LET A=A+1
70 GOTO 20
SYNTACTIC SUM: 9664, 8K ROM
Media
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.