cdd.lba = 0;
/* reset status */
- cdd.status = cdd.loaded ? CD_STOP : NO_DISC;
-
+ cdd.status = NO_DISC;
+
/* reset CD-DA fader (full volume) */
cdd.volume = 0x400;
/* CD loaded */
cdd.loaded = 1;
+
+ /* disc not scanned yet */
+ cdd.status = NO_DISC;
+
return 0;
}
/* CD unloaded */
cdd.loaded = 0;
+
+ if (cdd.status != CD_OPEN)
+ cdd.status = NO_DISC;
}
/* reset TOC */
case 0x02: /* Read TOC */
{
+ if (cdd.status == NO_DISC)
+ cdd.status = cdd.loaded ? CD_STOP : NO_DISC;
+
/* Infos automatically retrieved by CDD processor from Q-Channel */
/* commands 0x00-0x02 (current block) and 0x03-0x05 (Lead-In) */
switch (Pico_mcd->regs[0x44>>1].byte.l)
if (PicoMCDcloseTray)
PicoMCDcloseTray();
+
return;
}
memset(Pico_mcd->s68k_regs, 0, sizeof(Pico_mcd->s68k_regs));
memset(&Pico_mcd->pcm, 0, sizeof(Pico_mcd->pcm));
memset(&Pico_mcd->m, 0, sizeof(Pico_mcd->m));
- Pico_mcd->s68k_regs[0x38+9] = 0x0f; // default checksum
cdc_init();
- cdd_reset();
gfx_init();
// cold reset state (tested)
void pcd_soft_reset(void)
{
- // Reset_CD(); // breaks Fahrenheit CD swap
+ elprintf(EL_CD, "cd: soft reset");
Pico_mcd->m.s68k_pend_ints = 0;
cdc_reset();
//PicoMemResetCDdecode(1); // don't have to call this in 2M mode
#endif
+ memset(&Pico_mcd->s68k_regs[0x38], 0, 9);
+ Pico_mcd->s68k_regs[0x38+9] = 0x0f; // default checksum
+
pcd_event_schedule_s68k(PCD_EVENT_CDC, 12500000/75);
// TODO: test if register state/timers change
return;\r
}\r
case 0x4b:\r
- Pico_mcd->s68k_regs[a] = (u8) d;\r
+ Pico_mcd->s68k_regs[a] = 0; // (u8) d; ?\r
cdd_process();\r
+ {\r
+ static const char *nm[] =\r
+ { "stat", "stop", "read_toc", "play",\r
+ "seek", "???", "pause", "resume",\r
+ "ff", "fr", "tjump", "???",\r
+ "close","open", "???", "???" };\r
+ u8 *c = &Pico_mcd->s68k_regs[0x42];\r
+ u8 *s = &Pico_mcd->s68k_regs[0x38];\r
+ elprintf(EL_CD,\r
+ "CDD command: %02x %02x %02x %02x %02x %02x %02x %02x %12s",\r
+ c[0], c[1], c[2], c[3], c[4], c[5], c[6], c[7], nm[c[0] & 0x0f]);\r
+ elprintf(EL_CD,\r
+ "CDD status: %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x",\r
+ s[0], s[1], s[2], s[3], s[4], s[5], s[6], s[7], s[8], s[9]);\r
+ }\r
return;\r
case 0x58:\r
return;\r
break;
case MA_MAIN_CHANGE_CD:
if (PicoAHW & PAHW_MCD) {
+ // if cd is loaded, cdd_unload() triggers eject and
+ // returns 1, else we'll select and load new CD here
if (!cdd_unload())
menu_loop_tray();
return 1;