Use this machine code routine to quickly specify a PLOT position on the normal 2068 screen. The machine code is entirely relocatable and may be loaded into any safe area of memory.
In the sample program, the routine begins at 65000. When line 15 executes, the machine code takes over and you position a flashing pixel with the joystick. When you press the joystick fire button, the machine code routine returns to BASIC. The value returned (and stored in P) equals Y*256+X, where X and Y represent PLOT coordinates. Lines 25 and 30 convert P back into X and Y. The machine code also sets the system variable COORDS, the last PLOT position.
Line 10 turns on OVER writing: in this mode, PLOTs will set a point if it is reset, or reset it if it is set (also called XOR writing). The machine code routine always PLOTs each point twice, so it will leave the display intact and still flash visibly. If you call the machine code with OVER set to 0, it will leave a line behind as you move the joystick.
This routine includes two 65535 iteration delay loops, so the dot won’t move around the screen too fast. You can see the loop constants as double 255’s in the DATA statement.
If you set BRIGHT, FLASH, INVERSE, PAPER color, or INK color prior to calling the machine code, each character position you pass through will have its attribute byte set accordingly.
This program runs only on TS2068s, because it uses joystick hardware and ROM calls for plotting points. We welcome modifications for Spectrums or mice.
1 CLEAR 65000
2 FOR a=65000 TO 65083
3 READ d
4 POKE a,d
5 NEXT a
10 OVER 1
15 LET p=USR 65000
20 OVER 0
25 LET Y=INT (P/256)
30 LET X=P-Y*256
40 PRINT AT 0,0;X,Y
50 GO TO 10
100 DATA 001,255,255,016,254,237,075,125,092,062,014,211,245,062,001,219,245,087,203,079,032,007,120,254,000,040,001,005,122,203,071,032,007,120,254,175,040,001,004,122,203,087,032,007,121,254,000,040,001,013,122,203,095,032,007,121,254,255,040,001,012,122,245,197,205,062,038,001,255,255,016,254,193,197,205,062,038,193,241,203,127,200,024,172
SYNTACTIC SUM: 37316, TS2068
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.