I'd much rather have used recursion, but here is my non-recursive entry:

NOTE: This was written for screen 13. It can easily be adapted to other screen modes by changing the edge-limits (The ABS statements in the long line).

SUB FloodFill (x%, y%, c%)

'********************** ARGUMENT LIST *************************

'(x%, y%) the point at which to begin flood filling

'c% the color to fill with

'**************************************************************

IF POINT(x%, y%) = c% THEN EXIT SUB ELSE PSET (x%, y%), c%

n% = 1

l& = 1

OPEN "fill.bin" FOR BINARY AS #1

DO

IF POINT(x% + INT(n% MOD 2 + 2 * (n% = 1)), y% + INT(n% MOD 2 XOR 1 + 2 * (n% = 2))) <> c% AND (ABS(159.5 - (x% + INT(n% MOD 2 + 2 * (n% = 1)))) < 160) AND (ABS(99.5 - (y% + INT(n% MOD 2 XOR 1 + 2 * (n% = 2)))) < 100) THEN

x% = x% + INT(n% MOD 2 + 2 * (n% = 1))

y% = y% + INT(n% MOD 2 XOR 1 + 2 * (n% = 2))

PSET (x%, y%), c%

PUT #1, l&, n%

l& = l& + 2

n% = 1

ELSE

IF n% < 4 THEN

n% = n% + 1

ELSE

IF l& > 1 THEN

l& = l& - 2

GET #1, l&, n%

x% = x% - INT(n% MOD 2 + 2 * (n% = 1))

y% = y% - INT(n% MOD 2 XOR 1 + 2 * (n% = 2))

n% = n% - (n% < 4)

ELSE

EXIT DO

END IF

END IF

END IF

LOOP

CLOSE #1

KILL "fill.bin"

END SUB

*peace*

Meg.