lgblgblgb / xemu

Emulations (running on Linux/Unix/Windows/macOS, utilizing SDL2) of some - mainly - 8 bit machines, including the Commodore LCD, Commodore 65, and the MEGA65 as well.
https://github.com/lgblgblgb/xemu/wiki
GNU General Public License v2.0
208 stars 32 forks source link

MEGA65: increase number of SIDs to four, to match the current hardware implementation #277

Closed lgblgblgb closed 3 years ago

lgblgblgb commented 3 years ago

mega65-core has four SIDs implemented. Xemu/MEGA65 still has the "C65 legacy" using the dual-SID solution. So the task is to fix the situation, and having four SIDs emulated. Note, that it's unrelated that we have the MEGA65 MIXER implemented or not (ie: #272).

$D400, $D420 on the left and $D440, $D460 on the right

lgblgblgb commented 3 years ago

First ugly try.

lgblgblgb commented 3 years ago

basic BASIC :) POKEs seems to OK to make some sound using either of the four SIDs at least. Unfortunately I am not aware to have some good example to utilizing 4 SIDs to really test it out. LUMA intended to use SIDs at $D400 and $D420 but still I cannot hear difference (as before this commit there was only two SIDs emulated at $D400 and $D440, so this change should bring back the "half" of the music)

lgblgblgb commented 3 years ago

Note: it seems increasing the number of SIDs to four triggered some race-conditions between the audio callback thread of SDL and the main thread of emulation. I try to "decorate" things with spinlocks to avoid it, hitting another strange bug meanwhile, may be workarounded ...

lgblgblgb commented 3 years ago

Still unsure about LUMA does not have proper "two SID" sound. I have the suspect, that the SID emulation (I borrowed from project WebSID) has some problems. Since I modified it heavily to allow more SIDs to be emulated, but probably, some data structures are still shared, so there is an anomaly that SID instances can have effect on the others. This must be checked and fixed.