Recently I issued the fifth Z80 challenge for the Sinclair Spectrum:
This time the challenge is to write a solid flood fill routine to fill a region of unset pixels, bounded in 4 directions (up, down, left, right) by set pixels or the screen edge. The routine should be called with the X and Y coordinates in a register. There’s no need to set the screen attributes.
Scoring is multi-objective: a routine will be judged by the code size and stack space required to fill a test image. Your routine will be awarded one point for each competing routine it is smaller *and* uses less stack space than. The routine(s) with the most points will be declared winner(s).
The deadline is Wednesday 22nd July, midday (GMT).
- The X and Y coordinates are in pixels with 0,0 at the top left.
- No memory other than the screen, stack and your routine can be written.
- If you call a ROM routine it’s size will be added to your code size.
- Programs must return. The RET instruction is included in the size.
- So everyone has a fair chance comment with the code size not code.
- There are no prizes, just the chance to show off your coding skills.
The test image is designed to check correct behaviour at the screen boundary and to be pathological — triggering suboptimal behaviour in some common flood fill algorithms:
