looking for a pixel flood fill routine

Here you can ask questions or provide insights about how to use efficiently 6502 assembly code on the Oric.
User avatar
Symoon
Archivist
Posts: 2032
Joined: Sat Jan 14, 2006 12:44 am
Location: Paris, France
Contact:

Re: looking for a pixel flood fill routine

Post by Symoon »

I almost finished commenting (in French) the Retour du Dr Genius flood fill routine.
I'm just in a boring moment with real life, kind of "a new problem each day". When (if!) things calm down, I'll post it.

User avatar
goyo
Officer Cadet
Posts: 51
Joined: Sat Jan 12, 2019 10:16 am

Re: looking for a pixel flood fill routine

Post by goyo »

Nice !
but it's not urgent.
if you have the time, otherwise it's okay. :wink:

User avatar
Symoon
Archivist
Posts: 2032
Joined: Sat Jan 14, 2006 12:44 am
Location: Paris, France
Contact:

Re: looking for a pixel flood fill routine

Post by Symoon »

There it is! In French sorry, but I guess automatic translators can do the job if any non-French is curious.

Sorry it took so long, I struggled a lot with the stack management, I never found a long quiet moment to focus on it and understand. Now here we are ;)

BTW, the code is long, maybe it's worth to take a look at Geoff Philips' one in his book, I didn't test it but it might be easier / less memory consuming, etc.
retour_dr_Genius_routine_flood_fill.zip
(11.41 KiB) Downloaded 86 times

User avatar
Symoon
Archivist
Posts: 2032
Joined: Sat Jan 14, 2006 12:44 am
Location: Paris, France
Contact:

Re: looking for a pixel flood fill routine

Post by Symoon »

goyo wrote:
Tue Oct 12, 2021 2:30 pm
The Lorigraph floodfill Algo look like very speed and optimal but it's difficult to disassemble it for me.
Oh yes it looks much faster than Genius. Genuis looks nice and is no-so-slow, but I wonder if Lorigraph doesn't already use the idea I had (check/fill pixels by group of six before doing it of one by one).

User avatar
Dbug
Site Admin
Posts: 3837
Joined: Fri Jan 06, 2006 10:00 pm
Location: Oslo, Norway
Contact:

Re: looking for a pixel flood fill routine

Post by Dbug »

Symoon wrote:
Fri Nov 12, 2021 11:37 am
goyo wrote:
Tue Oct 12, 2021 2:30 pm
The Lorigraph floodfill Algo look like very speed and optimal but it's difficult to disassemble it for me.
Oh yes it looks much faster than Genius. Genuis looks nice and is no-so-slow, but I wonder if Lorigraph doesn't already use the idea I had (check/fill pixels by group of six before doing it of one by one).
Yeah, a quick exit with a byte test makes sense :)

User avatar
Symoon
Archivist
Posts: 2032
Joined: Sat Jan 14, 2006 12:44 am
Location: Paris, France
Contact:

Re: looking for a pixel flood fill routine

Post by Symoon »

Dbug wrote:
Fri Nov 12, 2021 12:01 pm
Yeah, a quick exit with a byte test makes sense :)
Well, I haven't deeply checked but I saw a CMP $40 while Lorigraph was executing the fill routine.
So I guess that's the idea ;)

So finally, it will probably be better to isolate Lorigraph's routine... Oh no, not again!

User avatar
jbperin
Flight Lieutenant
Posts: 377
Joined: Wed Nov 06, 2019 11:00 am
Location: Valence, France

Re: looking for a pixel flood fill routine

Post by jbperin »

Symoon wrote:
Fri Nov 12, 2021 12:01 am
There it is! In French sorry, but I guess automatic translators can do the job if any non-French is curious.
retour_dr_Genius_routine_flood_fill.zip
Waou :shock: nice work

It's very difficult to extract the meaning of an assembly code without knowing the design.
Well done.

User avatar
Symoon
Archivist
Posts: 2032
Joined: Sat Jan 14, 2006 12:44 am
Location: Paris, France
Contact:

Re: looking for a pixel flood fill routine

Post by Symoon »

Thanks!
Well, at least I knew from the start what I was looking for, it helped a lot ;)

User avatar
iss
Wing Commander
Posts: 1349
Joined: Sat Apr 03, 2010 5:43 pm
Location: Bulgaria
Contact:

Re: looking for a pixel flood fill routine

Post by iss »

@Symoon: Congrats for this huge amount of work!

User avatar
Symoon
Archivist
Posts: 2032
Joined: Sat Jan 14, 2006 12:44 am
Location: Paris, France
Contact:

Re: looking for a pixel flood fill routine

Post by Symoon »

Thanks, that's not that much work, it's just me complaining about the lack of spare time ;)
If you're curious and need some help translating, just let me know (I kept it in French both by lazyness and for Goyo)

User avatar
Dbug
Site Admin
Posts: 3837
Joined: Fri Jan 06, 2006 10:00 pm
Location: Oslo, Norway
Contact:

Re: looking for a pixel flood fill routine

Post by Dbug »

I tried to get Geffers routine to work, without success.
paint.zip
(1.42 KiB) Downloaded 2 times
It's from the book https://library.defence-force.org/index ... =007084743

I tried to call it from BASIC doing that:

Code: Select all

HIRES
CURSET120,100,3
CIRCLE50,1
POKE 0,120:POKE 1,100
CALL #1000
and all I get is just 6 white pixels in the center.
image_2022-01-16_143923.png
image_2022-01-16_143923.png (7.02 KiB) Viewed 183 times
I guess I must have missed something.

User avatar
Dbug
Site Admin
Posts: 3837
Joined: Fri Jan 06, 2006 10:00 pm
Location: Oslo, Norway
Contact:

Re: looking for a pixel flood fill routine

Post by Dbug »

I still did not manage to get Geffers assembler routine to run, but I managed to get the BASIC one to work, and then I converted it to C.
It still quite slow, but it does not explode on some relatively complex shape, so I guess it could relatively easily be converted to assembler.
image_2022-01-18_201908.png
image_2022-01-18_201908.png (9.32 KiB) Viewed 114 times
You can find the source code for the two programs on the SVN repository:
https://osdn.net/projects/oricsdk/scm/s ... sic/paint/
https://osdn.net/projects/oricsdk/scm/s ... e/c/paint/

User avatar
Dbug
Site Admin
Posts: 3837
Joined: Fri Jan 06, 2006 10:00 pm
Location: Oslo, Norway
Contact:

Re: looking for a pixel flood fill routine

Post by Dbug »

I continued playing with the flood fill code, for the ones interested:


User avatar
Symoon
Archivist
Posts: 2032
Joined: Sat Jan 14, 2006 12:44 am
Location: Paris, France
Contact:

Re: looking for a pixel flood fill routine

Post by Symoon »

Glad you tried Goeff's ones!
At the moment I gave up looking at the Lorigraph one. It was a bit complicated and couldn't spend time on it for a month. But it's the fastest of the (very few) I saw.

User avatar
Chema
Game master
Posts: 2851
Joined: Tue Jan 17, 2006 10:55 am
Location: Gijón, SPAIN
Contact:

Re: looking for a pixel flood fill routine

Post by Chema »

I'm interested! :)

I wonder if a lot of time is being wasted in the ROM curset function (maybe point too?) Are you using those to plot and to get the value of a pixel?

Use one of our fast putpixel or pixeladdress routines and you'll probably see it fly, but that would be assembler called within C, a bit of cheating :)

Post Reply