X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=Pico%2Fcd%2FPico.c;h=9e87e9ed91a899638a81d8fd228ed9e3e2cc264b;hb=d1df87866b45a5ab9f1b6c6c8a40da6a3a777f83;hp=d98795603a9dda94c3934fb2dd758d3524d2e721;hpb=672ad671130bb662f099b790fdaef4be85e6c146;p=picodrive.git diff --git a/Pico/cd/Pico.c b/Pico/cd/Pico.c index d987956..9e87e9e 100644 --- a/Pico/cd/Pico.c +++ b/Pico/cd/Pico.c @@ -32,6 +32,7 @@ int PicoResetMCD(int hard) { // clear everything except BIOS memset(Pico_mcd->prg_ram, 0, sizeof(mcd_state) - sizeof(Pico_mcd->bios)); + *(unsigned int *)(Pico_mcd->bios + 0x70) = 0xffffffff; // reset hint vector (simplest way to implement reg6) PicoMCD |= 2; // s68k reset pending Pico_mcd->s68k_regs[3] = 1; // 2M word RAM mode with m68k access after reset counter75hz = 0; @@ -64,9 +65,23 @@ static __inline void SekRunS68k(int cyc) #endif } -// TODO: tidy -extern unsigned char m68k_regs[0x40]; -extern unsigned char s68k_regs[0x200]; +static __inline void check_cd_dma(void) +{ + int ddx; + + if (!(Pico_mcd->scd.Status_CDC & 0x08)) return; + + ddx = Pico_mcd->s68k_regs[4] & 7; + if (ddx < 2) return; // invalid + if (ddx < 4) { + Pico_mcd->s68k_regs[4] |= 0x40; // Data set ready in host port + return; + } + if (ddx == 6) return; // invalid + + Update_CDC_TRansfer(ddx); // now go and do the actual transfer +} + // Accurate but slower frame which does hints static int PicoFrameHintsMCD(void) @@ -115,6 +130,8 @@ static int PicoFrameHintsMCD(void) if(Pico.m.padDelay[1]++ > 25) Pico.m.padTHPhase[1]=0; } + check_cd_dma(); + // H-Interrupts: if(y <= lines_vis && --hint < 0) // y <= lines_vis: Comix Zone, Golden Axe { @@ -165,7 +182,7 @@ static int PicoFrameHintsMCD(void) //dprintf("m68k starting exec @ %06x", SekPc); if(Pico.m.dma_bytes) SekCycleCnt+=CheckDMA(); SekRun(cycles_68k); - if ((Pico_mcd->m68k_regs[1]&3) == 1) { // no busreq/no reset + if ((Pico_mcd->m.busreq&3) == 1) { // no busreq/no reset #if 0 int i; FILE *f = fopen("prg_ram.bin", "wb"); @@ -193,6 +210,9 @@ static int PicoFrameHintsMCD(void) counter75hz -= counter75hz_lim; Check_CD_Command(); } + + if (Pico_mcd->rot_comp.Reg_58 & 0x8000) + gfx_cd_update(); } // draw a frame just after vblank in alternative render mode