JonAbbott wrote:I've spotted some bugs in Sound_Configure which I've corrected in the latest dev build, however 2067BC is still causing problems due to the way it sets the log tables, I need to add code to workaround the problem. Might be worth holding off testing until I've done that.
This is now resolved, the updated module is on the dev site. Sadly 2067BC still doesn't work, it looks like an IRQ is triggering and corrupting the return. The only IRQ's 2067BC sets up are sound related, so I'll need to NOP out all the "SWI Sound_InstallVoice" instructions to confirm it's a Voice Generator causing the issue.
The sequence of events leading up to the crash are:
97c84 SWI OS_CLI (*LOAD <PreHist$Dir>.Grafix.BkSpriteC1 9000)
97c88 ADR R0, &9000
97c94 ADR R1, &65000
97ca0 BL &97Ca0 (DietSprite_Expand) <-- the IRQ triggers whilst this is executing
67000 <-- next address the JIT sees (it should be 97ca4)
If I call 97c84 through the JIT after the crash, it works correctly, so its almost certainly IRQ related.
The music also sounds awful on the Pi, due to the buffer size difference. Now that the Voice Generators are hypervised I can implement a staging buffer, repeatedly call the Voice Generator's Fill code until the buffer overflows past the size the OS requires, then pass on the correct size buffer to the OS.
EDIT: After NOP'ing all the SWI Sound_Configure and SWI Sound_InstallVoice, 2067BC works, so there's almost certainly an issue with one of these. Oddly, it only shows up with the second Channel Manager that's enabled when you start a level. The title sequence Channel Manager and associated Voice Generators work okay. I'll look at a disassembly of them to see if I can figure out what's going on.
EDIT2: The issue is in the Channel Manager installed by Sound_Configure, it's jumping to the wrong address when it calls the Voice Generator Fill code.