First, the IRQ problem. What the game does every frame is:
Code: Select all
F000 <- 9 ;during NMI (scanline 290)
F004 <- 5 ;during NMI (scanline 290)
F008 <- 2 ;during NMI (scanline 290)
F008 <- 2 ;during NMI (scanline 290)
F001 <- 0 ;at scanline 14 (resets Audio chip, accidentally sets VRC4 IRQ latch D3..D0 to 0
F003 <- 0 ;at scanline 14 (resets Audio chip, accidentally sets VRC4 IRQ latch D3..D0 to 0
...
IRQ should be triggered at scanline 148 but it does not
...
goes back to the beginning of loop
I checked what might be the source of problems with no IRQ triggering and the problem is FCEUX itself - those lines bellow. Maybe because #23 aggregates VRC2 and VRC4 with different address lines, they did this way:
Code: Select all
static DECLFW(M23Write) {
A |= ((A >> 2) & 0x3) | ((A >> 4) & 0x3) | ((A >> 6) & 0x3);// actually there is many-in-one mapper source, some pirate or
// licensed games use various address bits for registers
VRC24Write(A, V);
}
But this causes write to F003 to be treaten as write to IRQ Acknowledge register which moves
A bit to E, but because A was 0, now E is 0 and IRQs are disabled;
If I replace it with
Code: Select all
static DECLFW(M23Write) {
VRC24Write((A & 0xF000) | ((A >> 2) & 3), V);
}
,
this (and other #23 games which are VRC4 will work, but #23 which are VRC2 will not.
So probably this game need INES2.0 header.
---
Now the audio - thank you lidnariq for pointing that that pin 11 and pin 10 might be clokcks. At first I thought like you that pin12/pin11/pin10 are just bits0/1/2 of the audio sample and when I merged it into WAV file, I got somethink like your WAV. Even connecting speaker to pin 12 produces quite similar (but not very exact) sound like on the analog output - it is more metalic. Applying RC lowpass filter qives better results but it is still not the same as on analog output.
Definitelly pin 12 is DATA, pin11 is CLK1, pin 10 is CLK2. Looks like CLK2 clockes some control bit stream and CLK1 clockes data (but it does not seem to be just plain wave, maybe some kind of compression)
I rememeber I found similar chip in one of famiclone's zapper, which emited sound after pressing trigger - there it was called HT2880
It has quite similar beaviour (but different pinout). But what's more interesting is that it has TEST1, TEST2 and TEST3 signals (just like those 3 weird pins here), which unfortunatelly datasheet does not explains.
What I am also curious is pin14/13 - they seem to be some indicator of sound being played, but they only apply to the SONG3.