looking for a pixel flood fill routine
looking for a pixel flood fill routine
Hello,
I am looking for a assembly source routine of pixel flood fill but i only have the Petyr Miladinow Pawlow routine in Basic.
would anyone have a floodfill assembler routine to give me ?
I am looking for a assembly source routine of pixel flood fill but i only have the Petyr Miladinow Pawlow routine in Basic.
would anyone have a floodfill assembler routine to give me ?
Re: looking for a pixel flood fill routine
I wonder if the one in "Le Retour du Dr Genius" would be easy to extract, I remember it to have been relatively fast.
Re: looking for a pixel flood fill routine
This is an interesting subject.
I'm a noob regarding the subject but I wonder: do fill algorithms on Oric take advantage of what I would call "byte structure" of the Hires screen? I mean, if a byte equals $64, it can be completely filled without checking neighborhood (might not be as simple as that with attributes and value of starting byte, but that's the idea: if the 6 visible pixels have the same value, they can be analysed as a whole)
I'm a noob regarding the subject but I wonder: do fill algorithms on Oric take advantage of what I would call "byte structure" of the Hires screen? I mean, if a byte equals $64, it can be completely filled without checking neighborhood (might not be as simple as that with attributes and value of starting byte, but that's the idea: if the 6 visible pixels have the same value, they can be analysed as a whole)
Re: looking for a pixel flood fill routine
Yes i'ts seems so easy to manage a single line, but the dificulty is to manage the stack and limits his size, how to have a fixed size of the stack.Symoon wrote: ↑Thu Sep 02, 2021 9:49 am This is an interesting subject.
I'm a noob regarding the subject but I wonder: do fill algorithms on Oric take advantage of what I would call "byte structure" of the Hires screen? I mean, if a byte equals $64, it can be completely filled without checking neighborhood (might not be as simple as that with attributes and value of starting byte, but that's the idea: if the 6 visible pixels have the same value, they can be analysed as a whole)
for help there is a nice wikipedia page : https://en.wikipedia.org/wiki/Flood_fill and Walk-based filling (Fixed-memory method)
but i'm not very good in English...
Re: looking for a pixel flood fill routine
Well, you can click on "Francais" on the bottom left to reach https://fr.wikipedia.org/wiki/Algorithm ... _diffusiongoyo wrote: ↑Thu Sep 09, 2021 11:14 am for help there is a nice wikipedia page : https://en.wikipedia.org/wiki/Flood_fill and Walk-based filling (Fixed-memory method)
but i'm not very good in English...
Generally speaking, on machines with limited memories you want to avoid using the stack for recursion, simply because some patterns (like a lot of small dots) will make the machine run out of memory.
The easiest way to handle that is to use an explicit stack (which you can allocate as an array anywhere in memory) and monitor the size, and if you can't push more to it, just continue with what you had stacked already, and when you are done there will be some parts that are not filled, but at least you would not have crashed
Re: looking for a pixel flood fill routine
I've begun investigating Le Retour du Dr Genuis, the fill code is using a king of specific stack if I understand correctly (I'm in the middle of checking the code). Maybe it's just designed to work with simple surfaces, I suspect using a stack on complicated filling zones could indeed fill... The memory!
Not sure if I'll go anywhere from there, I've begun many projects in the past 5 years and almost never finish any
Not sure if I'll go anywhere from there, I've begun many projects in the past 5 years and almost never finish any
Re: looking for a pixel flood fill routine
Well, you could still put the disassembly of the code somewhere, if you have just a simple example which draw a couple lines in BASIC and then fill in the values, that would allow other to look at it
Re: looking for a pixel flood fill routine
I'm far from it, still busy following the code, trying to identify all the subroutines and so on
Re: looking for a pixel flood fill routine
Good luck!
Technically this type of routine should not be very large, they could be using the POINT and CURSET functions from the ROM but that would be very slow, so I would suspect they use their own custom functions for that?
Re: looking for a pixel flood fill routine
Yes it seems so. There are tables with values of individual pixels on or off, being checked one by one, and I'm currently looking at the actual filling routine (before that, there was the system to find the places to fill on screen according to the displayed room in the game).
Having very little spare time doesn't help, but step by step I'm carrying on
Having very little spare time doesn't help, but step by step I'm carrying on
Re: looking for a pixel flood fill routine
It is not exactly a flood fill function but at paragraph 7.6 in the attached chapter of the geffer book, there's an assembly routine to fast draw a shape.
It says:
Perhaps an alternate approach.
Who knows ..
It says:
The following routine (Program 7.14), though still using the special graphics table, moves away from using character cells, and lets you draw an irregular shape, complete with colour.
All you have to do is provide the subroutine with the address of your object, plus details of its height (in pixels) and width (in character cells).
You must set up this information as follows:
1. Store the graphics shape in a free area of memory. The area must be pointed to by #8C, #8D.
2. A second free area is required, equal in size to the first, pointed to by #80, #81.
3. The data for the object must be stored line by line, with 1 byte for
each 6 pixels, or an attribute, and the number of bytes across
should be stored at #8E.
4. The number of lines down is required at location 8F.
5. Finally, you must load up the X and Y registers with the appropriate screen position (top left of the object).
With the parameters stored in exactly the same way, you call the routine at #115E in order to remove your artwork (Program 7.15).
Perhaps an alternate approach.
Who knows ..
Re: looking for a pixel flood fill routine
Based on the parameters, that looks like a routine that just copy some existing graphic data to the screen, like a sprite routine.
- ibisum
- Wing Commander
- Posts: 1655
- Joined: Fri Apr 03, 2009 8:56 am
- Location: Vienna, Austria
- Contact:
Re: looking for a pixel flood fill routine
Very interesting topic .. did you guys see this yet?
https://www.codeproject.com/Articles/60 ... -Algorithm
Also pretty relevant, mostly Atari though:
https://atariage.com/forums/topic/27844 ... fill-test/
https://www.codeproject.com/Articles/60 ... -Algorithm
Also pretty relevant, mostly Atari though:
https://atariage.com/forums/topic/27844 ... fill-test/
Re: looking for a pixel flood fill routine
A bit further, the book has a PAINT routine. It seems rather short, not sure how efficient - won't have time to investigate if I want to carry on the other one
Re: looking for a pixel flood fill routine
Thank you for yours help.
I think i am going to loot in anciens Oric archives to find an assembly code of the floodfill algo.
The Lorigraph floodfill Algo look like very speed and optimal but it's difficult to disassemble it for me.
I think i am going to loot in anciens Oric archives to find an assembly code of the floodfill algo.
The Lorigraph floodfill Algo look like very speed and optimal but it's difficult to disassemble it for me.