Graphics
1986/06/01 Iturriotz, J.M. Iturria: Elhuyar aldizkaria
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.
DRAFT10 PRINT #0; "STOP KEY" |
Gai honi buruzko eduki gehiago
Elhuyarrek garatutako teknologia