Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash/corruption during flood fill? #101

Open
danj2k opened this issue Jul 8, 2024 · 3 comments
Open

Crash/corruption during flood fill? #101

danj2k opened this issue Jul 8, 2024 · 3 comments

Comments

@danj2k
Copy link

danj2k commented Jul 8, 2024

I hope this is the right place to post, I looked in "about" on https://bbcmic.ro and it said to post issues here. I'm seeing an issue regarding using the GXR flood fill capability.

Steps to reproduce:

Open https://bbcmic.ro and copy and paste the BBC BASIC program from this gist: https://gist.githubusercontent.com/danj2k/374776c005929d4b0de9108f89db6b5f/raw/47c09ba141ace9c699c17d5537fe49819cac1b28/bbc_gbmap.bas
Click the "play" button

Expected outcome:

A cross-hatch filled labelled drawing of Great Britain

Screenshot from BeebEm:

image

Actual outcome:

Wales is filled successfully but England and Scotland are only filled a little bit, also weird corruption appears around the edges.

Screenshot:

image

The same program works as expected in offline emulators such as BeebEm.

@mattgodbolt
Copy link
Owner

Interestingly this works on the BBC Master emulation under jsbeeb (the emulator underpinning owlet). I will try and look at the GXR rom version (Which is a bit more owlet specific). thanks for the bug.

@ojwb
Copy link
Collaborator

ojwb commented Nov 21, 2024

This is actually a documented shortcoming of the GXR - from the manual:

Flooding a region with a colour which it already contains will not work. For
example if you are attempting a flood to non-background with the background
colour being black then you should not try to flood in black or a pattern which
contains black pixels. If you do this then it will try to fill a region, find that
pixels in it are still in the background colour and try again. When this occurs a
small region of the screen will be flooded and then the flood fill will give up.

The "England" pattern contains black and the background colour is black (the default) and &85 is "Flood until non-background".

If it works on a BBC Master, that probably means they managed to fix this limitation in that later version.

If it works in BeebEm and you're emulating a BBC B. then I think you must have a newer GXR version - owlet uses 1.20. You can check the version with: V.14:*H.G.

@ojwb
Copy link
Collaborator

ojwb commented Nov 21, 2024

If it works on a BBC Master, that probably means they managed to fix this limitation in that later version.

I found a copy of the "BBC Master Reference Manual Part 1" which says:

Flood fill to non-background [...] may fail to complete the flood fill if: [...]
the colour being used to fill the area can itself be filled (e.g. plot codes 131
and 135, which fill with background until non-background is found, will fail
in this way if the current background plotting mode (specified via VDU 18) is
0)

That doesn't explicitly include anything equivalent to the "pattern which contains black pixels" part from the standalone GXR documentation, but "the colour being used to fill the area can itself be filled" could be interpreted as including this case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants