mirror of
https://github.com/ekeeke/Genesis-Plus-GX.git
synced 2024-11-04 01:45:08 +01:00
[SCD] improved CDD emulation accuracy (various fixes in CD player menu)
This commit is contained in:
parent
8b3f89addf
commit
7530e89c01
@ -920,6 +920,9 @@ void cdd_update(void)
|
||||
}
|
||||
else if (cdd.toc.tracks[cdd.index].fd)
|
||||
{
|
||||
/* AUDIO track playing */
|
||||
scd.regs[0x36>>1].byte.h = 0x00;
|
||||
|
||||
if (cdd.lba < cdd.toc.tracks[cdd.index].start)
|
||||
{
|
||||
fseek(cdd.toc.tracks[cdd.index].fd, (cdd.toc.tracks[cdd.index].start * 2352) - cdd.toc.tracks[cdd.index].offset, SEEK_SET);
|
||||
@ -961,38 +964,37 @@ void cdd_process(void)
|
||||
case 0x02: /* Read TOC */
|
||||
{
|
||||
/* Infos automatically retrieved by CDD processor from Q-Channel */
|
||||
/* commands 0x00-0x02: from current block Q-Channel data field */
|
||||
/* commands 0x03-0x05: from Lead-In area Q-Channel data field */
|
||||
/* commands 0x00-0x02 (current block) and 0x03-0x05 (Lead-In) */
|
||||
switch (scd.regs[0x44>>1].byte.l)
|
||||
{
|
||||
case 0x00: /* Absolute position (MM:SS:FF) */
|
||||
case 0x00: /* Current Absolute Time (MM:SS:FF) */
|
||||
{
|
||||
int lba = cdd.lba + 150;
|
||||
scd.regs[0x38>>1].w = cdd.status << 8;
|
||||
scd.regs[0x3a>>1].w = lut_BCD_16[(lba/75)/60];
|
||||
scd.regs[0x3c>>1].w = lut_BCD_16[(lba/75)%60];
|
||||
scd.regs[0x3e>>1].w = lut_BCD_16[(lba%75)];
|
||||
scd.regs[0x40>>1].byte.h = 0x00; /* TODO: check what is returned in RS8 (note: bit 1 is checked by BIOS) */
|
||||
scd.regs[0x40>>1].byte.h = cdd.index ? 0x01 : 0x04; /* Current block flags (bit0 = mute status, bit1: pre-emphasis status, bit2: track type) */
|
||||
break;
|
||||
}
|
||||
|
||||
case 0x01: /* Track relative position (MM:SS:FF) */
|
||||
case 0x01: /* Current Track Relative Time (MM:SS:FF) */
|
||||
{
|
||||
int lba = cdd.lba - cdd.toc.tracks[cdd.index].start;
|
||||
scd.regs[0x38>>1].w = (cdd.status << 8) | 0x01;
|
||||
scd.regs[0x3a>>1].w = lut_BCD_16[(lba/75)/60];
|
||||
scd.regs[0x3c>>1].w = lut_BCD_16[(lba/75)%60];
|
||||
scd.regs[0x3e>>1].w = lut_BCD_16[(lba%75)];
|
||||
scd.regs[0x40>>1].byte.h = 0x00; /* TODO: check what is returned in RS8 */
|
||||
scd.regs[0x40>>1].byte.h = cdd.index ? 0x00 : 0x04; /* Current block flags (bit0 = mute status, bit1: pre-emphasis status, bit2: track type) */
|
||||
break;
|
||||
}
|
||||
|
||||
case 0x02: /* Current track */
|
||||
case 0x02: /* Current Track Number */
|
||||
{
|
||||
scd.regs[0x38>>1].w = (cdd.status << 8) | 0x02;
|
||||
scd.regs[0x3a>>1].w = (cdd.index < cdd.toc.last) ? lut_BCD_16[cdd.index + 1] : 0x0A0A;
|
||||
scd.regs[0x3c>>1].w = 0x0000;
|
||||
scd.regs[0x3e>>1].w = 0x0000; /* TODO: check what is returned in RS6 */
|
||||
scd.regs[0x3e>>1].w = 0x0000; /* Disk Control Code (?) in RS6 */
|
||||
scd.regs[0x40>>1].byte.h = 0x00;
|
||||
break;
|
||||
}
|
||||
@ -1008,17 +1010,17 @@ void cdd_process(void)
|
||||
break;
|
||||
}
|
||||
|
||||
case 0x04: /* Number of tracks */
|
||||
case 0x04: /* First & Last Track Numbers */
|
||||
{
|
||||
scd.regs[0x38>>1].w = (cdd.status << 8) | 0x04;
|
||||
scd.regs[0x3a>>1].w = 0x0001;
|
||||
scd.regs[0x3c>>1].w = lut_BCD_16[cdd.toc.last];
|
||||
scd.regs[0x3e>>1].w = 0x0000; /* TODO: check what is returned in RS6-RS7 */
|
||||
scd.regs[0x40>>1].byte.h = 0x00; /* TODO: check what is returned in RS8 */
|
||||
scd.regs[0x3e>>1].w = 0x0000; /* Drive Version (?) in RS6-RS7 */
|
||||
scd.regs[0x40>>1].byte.h = 0x00; /* Lead-In flags (bit0 = mute status, bit1: pre-emphasis status, bit2: track type) */
|
||||
break;
|
||||
}
|
||||
|
||||
case 0x05: /* Track start (MM:SS:FF) */
|
||||
case 0x05: /* Track Start Time (MM:SS:FF) */
|
||||
{
|
||||
int track = scd.regs[0x46>>1].byte.h * 10 + scd.regs[0x46>>1].byte.l;
|
||||
int lba = cdd.toc.tracks[track-1].start + 150;
|
||||
@ -1026,10 +1028,10 @@ void cdd_process(void)
|
||||
scd.regs[0x3a>>1].w = lut_BCD_16[(lba/75)/60];
|
||||
scd.regs[0x3c>>1].w = lut_BCD_16[(lba/75)%60];
|
||||
scd.regs[0x3e>>1].w = lut_BCD_16[(lba%75)];
|
||||
scd.regs[0x40>>1].byte.h = track % 10;
|
||||
scd.regs[0x40>>1].byte.h = track % 10; /* Track Number (low digit) */
|
||||
if (track == 1)
|
||||
{
|
||||
/* RS6 bit 3 is set for DATA track */
|
||||
/* RS6 bit 3 is set for the first (DATA) track */
|
||||
scd.regs[0x3e>>1].byte.h |= 0x08;
|
||||
}
|
||||
break;
|
||||
|
@ -53,7 +53,7 @@
|
||||
#define CD_END 0x0C
|
||||
|
||||
/* CD blocks scanning speed */
|
||||
#define CD_SCAN_SPEED 10
|
||||
#define CD_SCAN_SPEED 30
|
||||
|
||||
#define CD_MAX_TRACKS 100
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user