Graphics

The program that I will explain here ZX Spectrum, because I will be based on its own features.

The programs I have explained so far, even if they are for the ZX Spectrum, we could open them on any machine without making major changes.

This time, you will forgive the reader, but the program that I am going to explain here must be expressed in the ZX Spectrum, because I will base myself on its own characteristics.

This program does not in itself have a great value, but some of the instructions used in it can be of great interest for the elaboration or elegance of any program.

The machine, specifically the Spectrum, holds a series of memory-like positions to control its internal system. It collects the key that has finally been pressed, what will be the next line of instruction, colors, screen treatment to know if the printer is using, etc. (a total of 71 system variables).

Among these 71 system variables there are two very interesting ones in our case: Positions 23677 and 23678.

In these positions the coordinates of the drawn end point are collected. That is: If you do PRINT PEEK 23677, the x coordinate of the dot will
appear on the screen and if you do PRINT PEEK 23678 will give you the coordinate and the dot.

This helps us a lot in designing programs.

The program below is based on the following system variables. The program makes random and unlimited drawings.

Before executing the DRAW x1,y1 statement you get the correct values of x1 and y1 on lines 205 and 230, using lines 210 and 240 for verification. REM instructions have no effect on the program, so if desired you can stop typing.

DRAFT

10 PRINT #0; "STOP KEY"
20 LET I=0:REM "Define the color of the ink"
30 LET x=0:REM x define
40 LET and=0:REM and define
50 GOSUB 200
60 INK I
70 DRAW
x1,y1 I+1 LET: IF I=7 THEN LET I=0:REM
90 IF INKEY $=" Random numbers THEN GO TO 50:REM,
100 INK


0 (There is no space here)
110 STOP
200 REM XThen 1 and YLet 1



Babesleak
Eusko Jaurlaritzako Industria, Merkataritza eta Turismo Saila