UNIF OneBus - PCM DMA timing and address fix
This commit is contained in:
parent
b761f9c55c
commit
4b6910f45b
|
@ -42,7 +42,7 @@ static uint8 inv_hack = 0; // some OneBus Systems have swapped PRG reg commans
|
|||
|
||||
// APU Registers
|
||||
static uint8 pcm_enable = 0, pcm_irq = 0;
|
||||
static int16 pcm_addr, pcm_size, pcm_latch, pcm_clock = 0xF6;
|
||||
static int16 pcm_addr, pcm_size, pcm_latch, pcm_clock = 0xE1;
|
||||
|
||||
static writefunc defapuwrite[64];
|
||||
static readfunc defapuread[64];
|
||||
|
@ -180,17 +180,19 @@ static void UNLOneBusIRQHook(void) {
|
|||
}
|
||||
|
||||
static DECLFW(UNLOneBusWriteAPU40XX) {
|
||||
// FCEU_printf("APU %04x:%04x\n",A,V);
|
||||
// if(((A & 0x3f)!=0x16) && ((apu40xx[0x30] & 0x10) || ((A & 0x3f)>0x17)))FCEU_printf("APU %04x:%04x\n",A,V);
|
||||
apu40xx[A & 0x3f] = V;
|
||||
switch (A & 0x3f) {
|
||||
case 0x12:
|
||||
if (apu40xx[0x30] & 0x10) {
|
||||
pcm_addr = V << 6;
|
||||
}
|
||||
break;
|
||||
case 0x13:
|
||||
if (apu40xx[0x30] & 0x10) {
|
||||
pcm_size = (V << 4) + 1;
|
||||
}
|
||||
break;
|
||||
case 0x15:
|
||||
if (apu40xx[0x30] & 0x10) {
|
||||
pcm_enable = V & 0x10;
|
||||
|
@ -202,6 +204,7 @@ static DECLFW(UNLOneBusWriteAPU40XX) {
|
|||
pcm_latch = pcm_clock;
|
||||
V &= 0xef;
|
||||
}
|
||||
break;
|
||||
}
|
||||
defapuwrite[A & 0x3f](A, V);
|
||||
}
|
||||
|
@ -214,6 +217,7 @@ static DECLFR(UNLOneBusReadAPU40XX) {
|
|||
if (apu40xx[0x30] & 0x10) {
|
||||
result = (result & 0x7f) | pcm_irq;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -229,7 +233,8 @@ static void UNLOneBusCpuHook(int a) {
|
|||
pcm_enable = 0;
|
||||
X6502_IRQBegin(FCEU_IQEXT);
|
||||
} else {
|
||||
uint8 raw_pcm = ARead[pcm_addr](pcm_addr) >> 1;
|
||||
uint16 addr = pcm_addr | ((apu40xx[0x30]^3) << 14);
|
||||
uint8 raw_pcm = ARead[addr](addr) >> 1;
|
||||
defapuwrite[0x11](0x4011, raw_pcm);
|
||||
pcm_addr++;
|
||||
pcm_addr &= 0x7FFF;
|
||||
|
|
Loading…
Reference in New Issue