X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=Pico%2Fcd%2FPico.c;h=a0f288084e922cd91b89d50857178afa55f355ca;hb=1c88b865ceb1e1801bcf20010088fd62cdf2cc06;hp=0759acb4157cd19333057add11c4262ab9085eb0;hpb=d9153729685381acb0559d8a4fdca47cb839427a;p=picodrive.git diff --git a/Pico/cd/Pico.c b/Pico/cd/Pico.c index 0759acb..a0f2880 100644 --- a/Pico/cd/Pico.c +++ b/Pico/cd/Pico.c @@ -1,10 +1,4 @@ -// This is part of Pico Library - -// (c) Copyright 2004 Dave, All rights reserved. // (c) Copyright 2007 notaz, All rights reserved. -// Free for non-commercial use. - -// For commercial use, separate licencing terms must be obtained. #include "../PicoInt.h" @@ -14,6 +8,8 @@ extern unsigned char formatted_bram[4*0x10]; extern unsigned int s68k_poll_adclk; +void (*PicoMCDopenTray)(void) = NULL; +int (*PicoMCDcloseTray)(void) = NULL; #define dump_ram(ram,fname) \ { \ @@ -79,6 +75,12 @@ int PicoResetMCD(int hard) //PicoMemResetCDdecode(1); // don't have to call this in 2M mode #endif + // use SRam.data for RAM cart + if (SRam.data) free(SRam.data); + SRam.data = NULL; + if (PicoOpt&0x8000) + SRam.data = calloc(1, 0x12000); + return 0; } @@ -214,13 +216,15 @@ static __inline void update_chips(void) // delayed setting of DMNA bit (needed for Silpheed) if (Pico_mcd->m.state_flags & 2) { Pico_mcd->m.state_flags &= ~2; - Pico_mcd->s68k_regs[3] |= 2; - Pico_mcd->s68k_regs[3] &= ~1; + if (!(Pico_mcd->s68k_regs[3] & 4)) { + Pico_mcd->s68k_regs[3] |= 2; + Pico_mcd->s68k_regs[3] &= ~1; #ifdef USE_POLL_DETECT - if ((s68k_poll_adclk&0xfe) == 2) { - SekSetStopS68k(0); s68k_poll_adclk = 0; - } + if ((s68k_poll_adclk&0xfe) == 2) { + SekSetStopS68k(0); s68k_poll_adclk = 0; + } #endif + } } }