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

If you let "sprites5.bbc" run for a while, then interrupt with ESC, and then CHAIN "sprites2.bbc", it can crash #13

Closed
breakintoprogram opened this issue Dec 23, 2022 · 6 comments
Labels
bug Something isn't working

Comments

@breakintoprogram
Copy link
Owner

breakintoprogram commented Dec 23, 2022

This bug was reported by Lennart Benschop on 23/12/2023.
It shows the reboot message for Agon VPD 1.02 and then hangs

@breakintoprogram breakintoprogram added the bug Something isn't working label Dec 23, 2022
@breakintoprogram
Copy link
Owner Author

I'm able to replicate this.
Note that it does not seem to happen if you LOAD then RUN sprites_2 instead of CHAIN

@breakintoprogram
Copy link
Owner Author

breakintoprogram commented Feb 25, 2023

Added VDU 23,27,16 to clear the screen and reset the sprite system
That seems to crash if called more than once after running SPRITES_5.BAS
Indicates some issues with malloc/free, possibly the bitmaps.

@breakintoprogram
Copy link
Owner Author

breakintoprogram commented Mar 26, 2023

Lennart Benschop has also noted that it crashes if running for more than a couple of minutes. I can replicate this.

Also:
- sprites_4.bas crashes, though it will run a lot longer before it does
- sprites_3.bas is fine; that only has 1 frame per sprite
- triangles.bas crashes in MODE 2 after 30 seconds or so

@breakintoprogram
Copy link
Owner Author

breakintoprogram commented Mar 26, 2023

This is looking like the increased throughput of the comms is overflowing something in FabGL.

Potential fix:

- VGAController->enableBackgroundPrimitiveExecution(true)
- VGAController->enableBackgroundPrimitiveExecution(false)

And also:

- Canvas->waitCompletion(false) after lengthy drawing operations like triangle, circle

@breakintoprogram
Copy link
Owner Author

breakintoprogram commented Mar 26, 2023

The above fixes have not resolved the original issue. Forked this issue breakintoprogram/agon-vdp#28

@breakintoprogram
Copy link
Owner Author

breakintoprogram commented Mar 27, 2023

The fault can be fixed in sprites_2.bas by adding an extra line (345 of the below snippet)

  320   VDU 23,27,4,I%: REM Select sprite I%
  330   VDU 23,27,5: REM Clear frames for current sprite
  340   VDU 23,27,6,0: REM Add bitmap 0 as frame 0 of sprite
  345   VDU 23,27,6,0: REM Dummy frame 1 for this sprite seems to fix the crash
  350   VDU 23,27,11: REM Show the sprite

Seems to indicate an issue with the sprite engine when a sprite is assigned less frames than previous.

Fix:

Set the current sprite frame to 0 and make invisible when clearing the sprite(s).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Released
Development

No branches or pull requests

1 participant