X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=pico%2Fcd%2Fmemory.c;h=7d838fc983014383cf3a91bc8739090b0f3ef7dc;hb=274fcc35aa20e9777a8e09630a94088757384329;hp=2c53b330ffff2384c42f9f37b8be844049eb61af;hpb=a93a80deda2211dc89ea543841e71cdaf6f65917;p=picodrive.git diff --git a/pico/cd/memory.c b/pico/cd/memory.c index 2c53b33..7d838fc 100644 --- a/pico/cd/memory.c +++ b/pico/cd/memory.c @@ -100,7 +100,7 @@ static u32 m68k_reg_read16(u32 a) d = *(u16 *)(Pico_mcd->bios + 0x72); goto end; case 8: - d = Read_CDC_Host(0); + d = cdc_host_r(); goto end; case 0xA: elprintf(EL_UIO, "m68k FIXME: reserved read"); @@ -222,12 +222,13 @@ write_comm: pcd_sync_s68k(SekCyclesDone(), 0); Pico_mcd->s68k_regs[a] = d; - if (Pico_mcd->m.s68k_poll_a == (a & ~1) - && Pico_mcd->m.s68k_poll_cnt > POLL_LIMIT) + if (Pico_mcd->m.s68k_poll_a == (a & ~1)) { - SekSetStopS68k(0); + if (Pico_mcd->m.s68k_poll_cnt > POLL_LIMIT) { + elprintf(EL_CDPOLL, "s68k poll release, a=%02x", a); + SekSetStopS68k(0); + } Pico_mcd->m.s68k_poll_a = 0; - elprintf(EL_CDPOLL, "s68k poll release, a=%02x", a); } } @@ -285,9 +286,9 @@ u32 s68k_reg_read16(u32 a) elprintf(EL_CDREG3, "s68k_regs r3: %02x @%06x", (u8)d, SekPcS68k); return s68k_poll_detect(a, d); case 6: - return CDC_Read_Reg(); + return cdc_reg_r(); case 8: - return Read_CDC_Host(1); // Gens returns 0 here on byte reads + return cdc_host_r(); case 0xC: d = SekCyclesDoneS68k() - Pico_mcd->m.stopwatch_base_c; d /= 384; @@ -378,7 +379,7 @@ void s68k_reg_write8(u32 a, u32 d) //dprintf("s68k CDC reg addr: %x", d&0xf); break; case 7: - CDC_Write_Reg(d); + cdc_reg_w(d); return; case 0xa: elprintf(EL_CDREGS, "s68k set CDC dma addr"); @@ -406,8 +407,11 @@ void s68k_reg_write8(u32 a, u32 d) elprintf(EL_CDREGS|EL_CD, "s68k irq mask: %02x", d); d &= 0x7e; if ((d ^ Pico_mcd->s68k_regs[0x33]) & d & PCDS_IEN4) { - if (Pico_mcd->s68k_regs[0x37] & 4) - CDD_Export_Status(); + // XXX: emulate pending irq instead? + if (Pico_mcd->s68k_regs[0x37] & 4) { + elprintf(EL_INTS, "cdd export irq 4 (unmask)"); + SekInterruptS68k(4); + } } break; case 0x34: // fader @@ -417,15 +421,21 @@ void s68k_reg_write8(u32 a, u32 d) return; // d/m bit is unsetable case 0x37: { u32 d_old = Pico_mcd->s68k_regs[0x37]; - Pico_mcd->s68k_regs[0x37] = d&7; + Pico_mcd->s68k_regs[0x37] = d & 7; if ((d&4) && !(d_old&4)) { - CDD_Export_Status(); + // ?? + pcd_event_schedule_s68k(PCD_EVENT_CDC, 12500000/75); + + if (Pico_mcd->s68k_regs[0x33] & PCDS_IEN4) { + elprintf(EL_INTS, "cdd export irq 4"); + SekInterruptS68k(4); + } } return; } case 0x4b: Pico_mcd->s68k_regs[a] = (u8) d; - CDD_Import_Command(); + cdd_process(); return; case 0x58: return; @@ -662,7 +672,7 @@ void PicoWrite8_mcd_io(u32 a, u32 d) return; } - PicoWrite16_io(a, d); + PicoWrite8_io(a, d); } void PicoWrite16_mcd_io(u32 a, u32 d) @@ -671,7 +681,7 @@ void PicoWrite16_mcd_io(u32 a, u32 d) elprintf(EL_CDREGS, "m68k_regs w16: [%02x] %04x @%06x", a & 0x3f, d, SekPc); - m68k_reg_write8(a, d >> 8); + m68k_reg_write8(a, d >> 8); if ((a & 0x3e) != 0x0e) // special case m68k_reg_write8(a + 1, d & 0xff); return;