★ APPLICATIONS ★ PROGRAMMATION ★ FAST FILL (COMPUTING WITH THE AMSTRAD) ★ |
Fast Fill (Computing With the Amstrad) | Applications Programmation |
IN the September 1986 issue of Computing with the Amstrad Chris Ratcliffe showed us a routine to fill any shape, no matter how intricate, with any colour. This is for CPC464 owners of course - 6128 owners have their own built-in fill command. Unfortunately the CPC464 fill routine is rather slow. The problem is that it's a legal fill using the Amstrad approved and documented firmware calls. This Fast Fill routine doesn't use the firmware, but simply peeks and pokes the screen memory. The result is that the code is only half as long yet it runs up to 12 times faster. To fill a shape first move to the start position and: CALL &9E00,penThe fill stops when it hits its own colour, so if you wanted a red flower draw the outline in red and fill it with red. You can't draw a shape in one colour and fill with another - they both have to be the same. That's not a bug in the routine, it's the way the CPC6128 fill works so I've merely kept it the same. There is one restriction though. Make sure that there aren't any gaps in the outline or the fill will leak out. It will colour the rest of the Amstrad's memory given half a chance. When Fast Fill is run HIMEM is moved down to &9E00 to make room for the code and workspace. The routine is less than a page long and is followed by 1 k of workspace. You can use the workspace from &9D00 onwards as a scratchpad, but remember that Fast Fill will use it when called, so don't store anything there that you want to keep.
|