-
Notifications
You must be signed in to change notification settings - Fork 19
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
sound generator occasionally not turned off in BRISCOLA #23
Comments
Is it related to the latest firmware releases, after the SOUND statement fixes, or was it already present before? I mean, could it be related to the latest changes in the SOUND management mods? |
past firmware was buggy, the voices were always turned on, so I can't tell. |
Wait a moment. Noise mixing is controlled by bits 3-5. Bits 0-2 set the normal analog channels. |
No, I didn't have any sound running before, I'm just starting fresh with a new instance of the emulator. I am also unable to replicate the issue by running I've put a watchpoint at the address
Could it be that the interrupt keyboard routine is interfering with the read of register 7? E.g. interrupt occurring just in between the selection of reg 7 and the actual |
the debug code to paste in the JavaScript console is the following: debugBefore = ()=> {
let state = cpu.getState();
if(state.pc == 0x2982 && (state.a != 191 && state.a !=183)) console.log(`a=${state.a}`);
} |
There could be a race condition between the interrupt service routine and the SOUND code. I could try to atomize the SOUND code in the part that reads & sets the PSG disabling interrupts before such point. |
I played several games of Briscola and never experienced such issue. Unless more detailed info to replicate it on the real machine, I classify it as an emulator bug and, at the moment, close this issue. |
I am now able to replicate it. If you run the following program, the value 10 volume 1,15
20 sound 4,10:sound 4,0
30 if sstat(7)<>191 then print sstat(7)
40 goto 20 I guess it's the keyboard interrupt routine, because if I decrease the |
I must apologize. You were right. When the firmware is executing the CH3 interrupt service routine, during the keyboard reading the code loads adn save the reg 7 (the mixer) for setting the keyboard lines for proper input/output states, in case the user had "played" with regs 14 & 15. If the interrupt service routine is called while the BASIC is executing the SOUND statement, this leads to unwanted behaviors since there is a real race condition between 2 points of the FW that are accessing the same PSG register. |
When playing
biscola.bas
, occasionally the sound generator is not turned off (in the emulator you can hear an high-pitched continuous tone that you won't hear on the real machine). The issue manifests once in two or three complete briscola matches.As the issue occurs and the game goes on, I still can hear the "card shuffle" sound, but after it the voice is never turned off (which is very odd).
I stopped the program and dumped the state of the sound chip, you can see bit 0 of reg7 is 0 instead of 1:

Does this gives you a clue?
The text was updated successfully, but these errors were encountered: