koobo / HippoPlayer

HippoPlayer - a module player for the classic Amiga
MIT License
105 stars 18 forks source link

There is a bug in HippoScope task #4

Closed khval closed 2 years ago

khval commented 7 years ago

I got one read or write error to memory, while messing with prefs as I was playing a protracker module. I was able to ignore the DSI (Data Storage Interput) error and continue, so it's really bad but not critical.

I guess the most likely place for random crash might be while changing tune, that’s where I look first, If I know the code better.

It might be hard to reproduce, but if I do, copy the registers into this topic.

koobo commented 7 years ago

I didn't really know how to properly do threaded programming then. There are threads and interrupts there which probably work due to luck :-)

khval commented 7 years ago

What interrupts? Oh that ones I have disabled :-) LOL, hippo uses like 30% cpu power on X1000, I might think lack of timers might have something to do with it. I hope I have not introduced new bugs, or maybe the bug is more likely to happen without.

koobo commented 7 years ago

It still works even if you disabled all interrupts? :-)

khval commented 7 years ago

YES :-) LOL the code has "lore GFX, WaitTOF", I guess that gives it some kind of timing.

khval commented 7 years ago

The is the 680x0 register at the crash

680x0 emulated registers: DATA: 00000000 5A5B6FE4 00000000 00000002 00000002 00000466 000001CB 000C0038 ADDR: 606A74D4 5A5B6FE4 6F442F04 5FDB93CE 5A5B6AFE 5FDB9008 6FFB8420 59B70FEC

koobo commented 3 years ago

I think the problem is that the scopes read sample data in a low priority task so as to draw it to the screen. Then if the module gets stopped and memory freed in a higher priority task, the scope task may be in the middle of drawing when it is pre-empted and the module disappears. Then when the scope task gets to run again, it will access unallocated memory where the module data used to be.

koobo commented 3 years ago

I added some semaphores to protect module data and module list data, maybe it will help :-)

koobo commented 2 years ago

ADDR: 606A74D4 5A5B6FE4 6F442F04 5FDB93CE 5A5B6AFE 5FDB9008 6FFB8420 59B70FEC

This looks like sample data... Address registers have been restored from stack but stack pointer was pointing to sample data, brilliant!

Closing this issue, I guess not relevant anymore.