[Core/CD] improved CDD status codes description & added support for (unused ?) error request code

This commit is contained in:
ekeeke 2018-08-31 01:52:31 +02:00
parent d539061d99
commit 39c3c6634b
2 changed files with 39 additions and 24 deletions

View File

@ -211,7 +211,7 @@ void cdd_reset(void)
cdd.lba = 0;
/* reset status */
cdd.status = cdd.loaded ? CD_STOP : NO_DISC;
cdd.status = cdd.loaded ? CD_TOC : NO_DISC;
/* reset CD-DA fader (full volume) */
cdd.fader[0] = cdd.fader[1] = 0x400;
@ -1778,7 +1778,7 @@ void cdd_process(void)
/* Process CDD command */
switch (scd.regs[0x42>>1].byte.h & 0x0f)
{
case 0x00: /* Drive Status */
case 0x00: /* Report Drive Status */
{
/* RS1-RS8 normally unchanged */
scd.regs[0x38>>1].byte.h = cdd.status;
@ -1800,21 +1800,21 @@ void cdd_process(void)
case 0x01: /* Stop Drive */
{
/* update status */
cdd.status = cdd.loaded ? CD_STOP : NO_DISC;
cdd.status = cdd.loaded ? CD_TOC : NO_DISC;
/* no audio track playing */
scd.regs[0x36>>1].byte.h = 0x01;
/* RS1-RS8 ignored, expects 0x0 (drive busy ?) in RS0 once */
scd.regs[0x38>>1].w = CD_BUSY << 8;
/* RS1-RS8 ignored, expects 0x0 (CD_STOP) in RS0 once */
scd.regs[0x38>>1].w = CD_STOP << 8;
scd.regs[0x3a>>1].w = 0x0000;
scd.regs[0x3c>>1].w = 0x0000;
scd.regs[0x3e>>1].w = 0x0000;
scd.regs[0x40>>1].w = ~CD_BUSY & 0x0f;
scd.regs[0x40>>1].w = ~CD_STOP & 0x0f;
return;
}
case 0x02: /* Read TOC */
case 0x02: /* Report TOC infos */
{
/* Infos automatically retrieved by CDD processor from Q-Channel */
/* commands 0x00-0x02 (current block) and 0x03-0x05 (Lead-In) */
@ -1886,10 +1886,20 @@ void cdd_process(void)
break;
}
case 0x06: /* Latest Error Information */
{
scd.regs[0x38>>1].w = (cdd.status << 8) | 0x06;
scd.regs[0x3a>>1].w = 0x0000; /* no error */
scd.regs[0x3c>>1].w = 0x0000;
scd.regs[0x3e>>1].w = 0x0000;
scd.regs[0x40>>1].byte.h = 0x00;
break;
}
default:
{
#ifdef LOG_ERROR
error("Unknown CDD Command %02X (%X)\n", scd.regs[0x44>>1].byte.l, s68k.pc);
error("Invalid CDD request code %02X (%X)\n", scd.regs[0x44>>1].byte.l, s68k.pc);
#endif
return;
}
@ -2157,7 +2167,6 @@ void cdd_process(void)
break;
}
case 0x0a: /* N-Track Jump Control ? (usually sent before CD_SEEK or CD_PLAY commands) */
{
/* TC3 corresponds to seek direction (00=forward, FF=reverse) */
@ -2179,14 +2188,14 @@ void cdd_process(void)
scd.regs[0x36>>1].byte.h = 0x01;
/* update status */
cdd.status = cdd.loaded ? CD_STOP : NO_DISC;
cdd.status = cdd.loaded ? CD_TOC : NO_DISC;
/* RS1-RS8 ignored, expects 0x0 (drive busy ?) in RS0 once */
scd.regs[0x38>>1].w = CD_BUSY << 8;
/* RS1-RS8 ignored, expects CD_STOP in RS0 once */
scd.regs[0x38>>1].w = CD_STOP << 8;
scd.regs[0x3a>>1].w = 0x0000;
scd.regs[0x3c>>1].w = 0x0000;
scd.regs[0x3e>>1].w = 0x0000;
scd.regs[0x40>>1].w = ~CD_BUSY & 0x0f;
scd.regs[0x40>>1].w = ~CD_STOP & 0x0f;
#ifdef CD_TRAY_CALLBACK
CD_TRAY_CALLBACK
@ -2214,8 +2223,8 @@ void cdd_process(void)
}
default: /* Unknown command */
#ifdef LOG_CDD
error("Unknown CDD Command !!!\n");
#ifdef LOG_ERROR
error("Unsupported CDD command %02X (%X)\n", scd.regs[0x42>>1].byte.h & 0x0f, s68k.pc);
#endif
scd.regs[0x38>>1].byte.h = cdd.status;
break;

View File

@ -54,15 +54,21 @@
#define cdd scd.cdd_hw
/* CDD status */
#define CD_BUSY 0x00
#define CD_PLAY 0x01
#define CD_SEEK 0x02
#define CD_SCAN 0x03
#define CD_PAUSE 0x04
#define CD_OPEN 0x05
#define CD_STOP 0x09
#define NO_DISC 0x0B
#define CD_END 0x0C
#define CD_STOP 0x00
#define CD_PLAY 0x01
#define CD_SEEK 0x02
#define CD_SCAN 0x03
#define CD_PAUSE 0x04
#define CD_OPEN 0x05
#define NO_VALID_CHK 0x06 /* unused */
#define NO_VALID_CMD 0x07 /* unused */
#define CD_ERROR 0x08 /* unused */
#define CD_TOC 0x09
#define CD_TRACK_MOVE 0x0A /* unused */
#define NO_DISC 0x0B
#define CD_END 0x0C
#define CD_TRAY 0x0E /* unused */
#define CD_TEST 0x0F /* unusec */
/* CD-DA digital filter types */
#define CD_TYPE_DEFAULT 0x00