From: kub Date: Fri, 26 Apr 2024 22:32:04 +0000 (+0200) Subject: mcd, improve pre/post reading X-Git-Tag: v2.00~73 X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ce5c904a3955abee20e3c38fd0f3ddc8d09d4a94;p=picodrive.git mcd, improve pre/post reading --- diff --git a/pico/cd/cdd.c b/pico/cd/cdd.c index 1db9a8f5..89ca183b 100644 --- a/pico/cd/cdd.c +++ b/pico/cd/cdd.c @@ -162,7 +162,7 @@ void cdd_reset(void) cdd.latency = 0; /* reset track index */ - cdd.index = 0; + cdd.index = -1; /* reset logical block address */ cdd.lba = 0; @@ -830,10 +830,10 @@ void cdd_update(void) } } - if (Pico_mcd->s68k_regs[0x4b] & 0x1) { + if (Pico_mcd->m.state_flags & PCD_ST_CDD_CMD) { /* pending delayed command */ cdd_process(); - Pico_mcd->s68k_regs[0x4b] &= ~0x1; + Pico_mcd->m.state_flags &= ~PCD_ST_CDD_CMD; } } @@ -1006,8 +1006,8 @@ void cdd_process(void) (Pico_mcd->s68k_regs[0x48+0] * 10 + Pico_mcd->s68k_regs[0x48+1]) - 150; /* if drive is currently reading, another block or 2 are decoded before the seek starts */ - if (cdd.status == CD_PLAY && !(Pico_mcd->s68k_regs[0x4b] & 0x1)) { - Pico_mcd->s68k_regs[0x4b] |= 0x1; + if (cdd.status == CD_PLAY && !(Pico_mcd->m.state_flags & PCD_ST_CDD_CMD)) { + Pico_mcd->m.state_flags |= PCD_ST_CDD_CMD; return; } @@ -1037,7 +1037,6 @@ void cdd_process(void) } /* block transfer always starts 3 blocks earlier */ - cdd.latency -= 3; lba -= 3; /* get track index */ @@ -1072,8 +1071,8 @@ void cdd_process(void) (Pico_mcd->s68k_regs[0x48+0] * 10 + Pico_mcd->s68k_regs[0x48+1]) - 150; /* if drive is currently reading, another block or 2 are decoded before the seek starts */ - if (cdd.status == CD_PLAY && !(Pico_mcd->s68k_regs[0x4b] & 0x1)) { - Pico_mcd->s68k_regs[0x4b] |= 0x1; + if (cdd.status == CD_PLAY && !(Pico_mcd->m.state_flags & PCD_ST_CDD_CMD)) { + Pico_mcd->m.state_flags |= PCD_ST_CDD_CMD; return; } @@ -1113,7 +1112,11 @@ void cdd_process(void) case 0x06: /* Pause */ { - /* TODO another block is decoded before pausing? */ + /* if drive is currently reading, another block or 2 are decoded before the seek starts */ + if (cdd.status == CD_PLAY && !(Pico_mcd->m.state_flags & PCD_ST_CDD_CMD)) { + Pico_mcd->m.state_flags |= PCD_ST_CDD_CMD; + return; + } /* no audio track playing */ Pico_mcd->s68k_regs[0x36+0] = 0x01; diff --git a/pico/pico_int.h b/pico/pico_int.h index c576ecbf..fbdeb873 100644 --- a/pico/pico_int.h +++ b/pico/pico_int.h @@ -523,6 +523,7 @@ struct mcd_pcm #define PCD_ST_S68K_SLEEP 4 #define PCD_ST_S68K_POLL 16 #define PCD_ST_M68K_POLL 32 +#define PCD_ST_CDD_CMD 64 #define PCD_ST_S68K_IFL2 0x100 struct mcd_misc