From fc4803bdc2c9840a007c60e422fb0531107b80f2 Mon Sep 17 00:00:00 2001 From: notaz Date: Thu, 5 Feb 2015 02:36:58 +0200 Subject: [PATCH] dma: some timing hacks untested --- libpcsxcore/cdrom.c | 5 ++++- libpcsxcore/mdec.c | 12 +++++------- libpcsxcore/psxdma.c | 9 ++++++--- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/libpcsxcore/cdrom.c b/libpcsxcore/cdrom.c index 2e6277b8..556b512f 100644 --- a/libpcsxcore/cdrom.c +++ b/libpcsxcore/cdrom.c @@ -1418,7 +1418,10 @@ void psxDma3(u32 madr, u32 bcr, u32 chcr) { CDRDMA_INT( (cdsize/4) / 4 ); } else if( chcr == 0x11000000 ) { - CDRDMA_INT( (cdsize/4) * 1 ); + // CDRDMA_INT( (cdsize/4) * 1 ); + // halted + psxRegs.cycle += (cdsize/4) * 24/2; + CDRDMA_INT(16); } return; diff --git a/libpcsxcore/mdec.c b/libpcsxcore/mdec.c index bed4e53b..d6c7ab68 100644 --- a/libpcsxcore/mdec.c +++ b/libpcsxcore/mdec.c @@ -32,7 +32,7 @@ * 320x240x16@60Hz => 9.216 MB/s * so 2.0 to 4.0 should be fine. */ -#define MDEC_BIAS 2.0f +#define MDEC_BIAS 2 #define DSIZE 8 #define DSIZE2 (DSIZE * DSIZE) @@ -545,15 +545,13 @@ void psxDma1(u32 adr, u32 bcr, u32 chcr) { int blk[DSIZE2 * 6]; u8 * image; int size; - int dmacnt; + u32 words; if (chcr != 0x01000200) return; - size = (bcr >> 16) * (bcr & 0xffff); + words = (bcr >> 16) * (bcr & 0xffff); /* size in byte */ - size *= 4; - /* I guess the memory speed is limitating */ - dmacnt = size; + size = words * 4; if (!(mdec.reg1 & MDEC1_BUSY)) { /* add to pending */ @@ -625,7 +623,7 @@ void psxDma1(u32 adr, u32 bcr, u32 chcr) { } /* define the power of mdec */ - MDECOUTDMA_INT((int) ((dmacnt* MDEC_BIAS))); + MDECOUTDMA_INT(words * MDEC_BIAS); } } diff --git a/libpcsxcore/psxdma.c b/libpcsxcore/psxdma.c index b0f3fba4..03ee5639 100644 --- a/libpcsxcore/psxdma.c +++ b/libpcsxcore/psxdma.c @@ -220,7 +220,7 @@ void gpuInterrupt() { } void psxDma6(u32 madr, u32 bcr, u32 chcr) { - u32 size; + u32 words; u32 *mem = (u32 *)PSXM(madr); #ifdef PSXDMA_LOG @@ -238,7 +238,7 @@ void psxDma6(u32 madr, u32 bcr, u32 chcr) { } // already 32-bit size - size = bcr; + words = bcr; while (bcr--) { *mem-- = SWAP32((madr - 4) & 0xffffff); @@ -246,7 +246,10 @@ void psxDma6(u32 madr, u32 bcr, u32 chcr) { } mem++; *mem = 0xffffff; - GPUOTCDMA_INT(size); + //GPUOTCDMA_INT(size); + // halted + psxRegs.cycle += words; + GPUOTCDMA_INT(16); return; } #ifdef PSXDMA_LOG -- 2.39.5