X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=pico%2Fcd%2Fmcd.c;h=ef8d8f21da87dbdc1a6bd287913d19eed593cec4;hb=a93a80deda2211dc89ea543841e71cdaf6f65917;hp=8a84eb12d4de33ab4ec300dd1500eed3bf68bb23;hpb=33be04ca5fee314271f1959672e22cf94d670ea6;p=picodrive.git diff --git a/pico/cd/mcd.c b/pico/cd/mcd.c index 8a84eb1..ef8d8f2 100644 --- a/pico/cd/mcd.c +++ b/pico/cd/mcd.c @@ -21,6 +21,7 @@ PICO_INTERNAL void PicoInitMCD(void) { SekInitS68k(); Init_CD_Driver(); + gfx_init(); } PICO_INTERNAL void PicoExitMCD(void) @@ -30,6 +31,8 @@ PICO_INTERNAL void PicoExitMCD(void) PICO_INTERNAL void PicoPowerMCD(void) { + SekCycleCntS68k = SekCycleAimS68k = 0; + int fmt_size = sizeof(formatted_bram); memset(Pico_mcd->prg_ram, 0, sizeof(Pico_mcd->prg_ram)); memset(Pico_mcd->word_ram2M, 0, sizeof(Pico_mcd->word_ram2M)); @@ -55,7 +58,6 @@ void pcd_soft_reset(void) // Reset_CD(); // breaks Fahrenheit CD swap LC89510_Reset(); - gfx_cd_reset(); #ifdef _ASM_CD_MEMORY_C //PicoMemResetCDdecode(1); // don't have to call this in 2M mode #endif @@ -110,6 +112,14 @@ static __inline void SekRunS68k(unsigned int to) #endif } +static void pcd_set_cycle_mult(void) +{ + // ~1.63 for NTSC, ~1.645 for PAL + if (Pico.m.pal) + m68k_cycle_mult = ((12500000ull << 16) / (50*312*488)); + else + m68k_cycle_mult = ((12500000ull << 16) / (60*262*488)) + 1; +} unsigned int pcd_cycles_m68k_to_s68k(unsigned int c) { @@ -150,7 +160,7 @@ static unsigned int event_time_next; static event_cb *pcd_event_cbs[PCD_EVENT_COUNT] = { [PCD_EVENT_CDC] = pcd_cdc_event, [PCD_EVENT_TIMER3] = pcd_int3_timer_event, - [PCD_EVENT_GFX] = gfx_cd_update, + [PCD_EVENT_GFX] = gfx_update, [PCD_EVENT_DMA] = pcd_dma_event, }; @@ -302,12 +312,7 @@ PICO_INTERNAL void PicoFrameMCD(void) if (!(PicoOpt&POPT_ALT_RENDERER)) PicoFrameStart(); - // ~1.63 for NTSC, ~1.645 for PAL - if (Pico.m.pal) - m68k_cycle_mult = ((12500000ull << 16) / (50*312*488)); - else - m68k_cycle_mult = ((12500000ull << 16) / (60*262*488)) + 1; - + pcd_set_cycle_mult(); PicoFrameHints(); } @@ -316,6 +321,7 @@ void pcd_state_loaded(void) unsigned int cycles; int diff; + pcd_set_cycle_mult(); pcd_state_loaded_mem(); memset(Pico_mcd->pcm_mixbuf, 0, sizeof(Pico_mcd->pcm_mixbuf)); @@ -335,17 +341,15 @@ void pcd_state_loaded(void) pcd_event_schedule(SekCycleAimS68k, PCD_EVENT_TIMER3, Pico_mcd->s68k_regs[0x31] * 384); - if (Pico_mcd->rot_comp.Reg_58 & 0x8000) { - Pico_mcd->rot_comp.Reg_58 &= 0x7fff; - Pico_mcd->rot_comp.Reg_64 = 0; - if (Pico_mcd->s68k_regs[0x33] & PCDS_IEN1) - SekInterruptS68k(1); - } if (Pico_mcd->scd.Status_CDC & 0x08) Update_CDC_TRansfer(Pico_mcd->s68k_regs[4] & 7); } if (Pico_mcd->pcm.update_cycles == 0) Pico_mcd->pcm.update_cycles = cycles; + + // reschedule + event_time_next = 0; + pcd_run_events(SekCycleCntS68k); } // vim:shiftwidth=2:ts=2:expandtab