HATCHED FILL
by A.J. Renton
from Your Computer, August 1985

A.J. Renton makes it easy to fill the Spectrum screen with patterns

THESE TWO machine-code routines provide your 48K Spectrum with a way
of filling in the screen without all the problems of attributes, i.e.
colours overlapping. This is achieved by filling in the required area
with a set pixel pattern, set up by the user in the first user-defined
graphic.

The main dollop of machine code is in fact a common garden fill
routine, this particular one by N. Dote - Your Computer October 1983.
The program first fills in the required area in the usual way, then
hatches it.

To type in the machine code, first type in listing 1. Type Run and the
computer will check the data for any errors. After correcting any of
these errors, save the program to tape or Microdrive with:
	SAVE "HATCH DATA"
or
	SAVE *"m";1;"HATCH DATA"
Now save the code with
	SAVE "HATCH" CODE 58000,70
or
	SAVE *"m";1;"HATCH" CODE 58000,70

It is probably best to save the code on a different tape from the data
programs. Next comes the fill routine. Type
	CLEAR 57999
then type in listing 2 and Run it, correcting any errors. Then save it with
	SAVE "FILL DATA"
or
	SAVE *"m";1;"FILL DATA"

The reason for saving the data programs as well as the code is that
checksums do not detect all errors. Now save the actual code using
	SAVE "FILL" CODE 64800,500
or
	SAVE *"m";1;"FILL" CODE 64800,500

Now the code is ready to run. Listing 3 demonstrates some of the
possibilities of this routine. How to use this routine is probably
best learned by studying this program but here is an example of step
by step hatching.

1. Create shape to be filled on screen, making sure there are no gaps
   along the edges.
2. Define the first UDG (see listing 4 or manual).
3. Choose any point inside the shape and type
	PLOT INVERSE 1;x,y
   where x,y is the chosen point.
4. Type
	RANDOMIZE USR 64800
   and the area will fill with ink.
5. Type
	RANDOMIZE USR 58000
   and the area filled will become hatched.
6. If you don't like the pattern, then type
	RANDOMIZE USR 58000
   redefine the UDG and retype
	RANDOMIZE USR 58000
7. If you wish to remove all of the filled area, using
	RANDOMIZE USR 58000
   revert the hatch pattern to its original all filled
   in position, define the UDG as totally blank and type
	RANDOMIZE USR 58000
   Hey presto! the filled area disappears.

A final warning: before loading the fill routine, always type
	CLEAR 57999
or the computer is likely to crash.
