Personal Computer News
5th January 1985
Author: John Keneally
Published in Personal Computer News #093
Colourful pictures can be stored in the Amstrad's memory and re-drawn using this routine from John Keneally.
Picture This
Colourful pictures can be stored in the Amstrad's memory and re-drawn using this routine from John Keneally
The following utility for the Amstrad CPC464 allows pictures to be drawn in four colours (out of a possible 27) and be recreated in user programs. Pictures are stored from address 43902 downwards in a picture buffer. Space must be reserved in the user program by the MEMORY command.
Pictures are numbered from 0 upwards. The picture currently being drawn can call up any previous picture and put it anywhere on the screen. The whole picture can then be re-drawn by clearing the screen and using the draw command.
The Commands
p | select a picture (0, 1, etc) |
d | draw selected picture |
f | finish current picture and advance to next. Arrow keys... move the cursor |
l | mark start point for line or arc draw |
e | mark end point for line or arc and draw it |
r | mark one corner for a rectangle |
m | mark opposite corner and draw filled rectangle |
i | partial infill function |
t1 | mark first point of triangle |
t2 | mark second point of triangle |
t3 | mark third point and draw triangle |
z | clear screen |
k | re-draw a previous picture number at cursor position |
x | delete last command. (Clear screen and draw using (d) command to see effect) |
b | set border colour and the four ink colours |
c | select an ink for future drawing |
g | display coordinates of cursor |
u | display length of picture buffer space used so far |
k | save/load picture buffer to cassette |
Note: The routines from line 1000 onwards must be incorporated to use the pictures in other programs. To use, first use GOSUB 1600 to load the picture buffer (after reserving space for it using the MEMORY command. The (u) command will tell you how long the buffer is. Use a value of 43902 (minus this length). Pictures can then be drawn by setting pn% = picture number and doing GOSUB 1700:GOSUB 1000
Program Notes
50-110 | Program initialisation |
130-170 | Wait for command and flash cursor |
180-270 | Dispatch command |
280-960 | Activate the commands |
1000-1520 | Main draw functions routine |
1120-1130 | Draw line |
1150-1190 | Draw rectangle |
1200-1310 | Draw arc |
1320-1480 | Routine to allow shapes to be filled in |
1490-1500 | Draw triangle |
1510-1520 | Draw another picture |
1600-1620 | Routine for loading picture buffer |
1700-1800 | Routine for the selection of pictures |