                       Hatched Fill



             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 pro-

blems 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 or

garden fill routine, this particular one by N. Dore -

Your Computer October 1983. The program first fills in the

required area in the usual way, then hatches it.

  [The machine code is on "Hatched Fill.tzx" under the

names of "hatch", for the hatching code, and "fill", for

the filling code. The programs originally used to load

these code files are also there, as "hatch data" and

"fill data".]

  Listing 3 [on the TZX as "Demo"] 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).

[Listing 4 being your usual READ-and-POKE affair; see any

number of programs, the Demo, or, indeed, the 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

positino, 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. [Amusingly enough, the

article's own Demo program neglected to do this. The ver-

sion on the TZX does, of course.]