summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSND\weimingzhi_cp <SND\weimingzhi_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97>2010-05-21 08:32:39 +0000
committerSND\weimingzhi_cp <SND\weimingzhi_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97>2010-05-21 08:32:39 +0000
commit54ef2e8a8000b8056aa32eb00179ab15dd48e2d8 (patch)
tree6a8cfca34b8fc3861302d7a17db0dd7f53ecb74f
parent2030af5d172802ddc2c74dfe4962a220237ebd20 (diff)
downloadpcsxr-54ef2e8a8000b8056aa32eb00179ab15dd48e2d8.tar.gz
revert the previous revert, and fixed the value in mdec1Interrupt().
git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@48431 e17a0e51-4ae3-4d35-97c3-1a29b211df97
-rw-r--r--ChangeLog10
-rw-r--r--libpcsxcore/cdrom.c4
-rw-r--r--libpcsxcore/ix86/iR3000A.c12
-rw-r--r--libpcsxcore/ix86_64/iR3000A-64.c12
-rw-r--r--libpcsxcore/mdec.c12
-rw-r--r--libpcsxcore/ppc/pR3000A.c16
-rw-r--r--libpcsxcore/psxcounters.c12
-rw-r--r--libpcsxcore/psxdma.c4
-rw-r--r--libpcsxcore/psxinterpreter.c4
-rw-r--r--libpcsxcore/sio.c2
10 files changed, 49 insertions, 39 deletions
diff --git a/ChangeLog b/ChangeLog
index 6bc7af20..1220ae13 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -12,6 +12,16 @@ May 21, 2010 Wei Mingzhi <whistler_wmz@users.sf.net>
* libpcsxcore/psxbios.c: Implemented several HLE BIOS functions inside the
core instead of calling the standard C functions. (Not done yet)
* plugins/dfsound/sdl.c: Changed buffer size.
+ * libpcsxcore/psxinterpreter.c: Revert the previous revert (why the problem
+ on amd64 disappeared?).
+ * libpcsxcore/ppc/pR3000A.c: Likewise.
+ * libpcsxcore/cdrom.c: Likewise.
+ * libpcsxcore/ix86_64/iR3000A-64.c: Likewise.
+ * libpcsxcore/ix86/iR3000A.c: Likewise.
+ * libpcsxcore/sio.c: Likewise.
+ * libpcsxcore/psxdma.c: Likewise.
+ * libpcsxcore/psxcounters.c: Likewise.
+ * libpcsxcore/mdec.c: Likewise, and fixed the cycle value in mdec1Interrupt().
May 20, 2010 Wei Mingzhi <whistler_wmz@users.sf.net>
diff --git a/libpcsxcore/cdrom.c b/libpcsxcore/cdrom.c
index 30ead1c2..55657e7f 100644
--- a/libpcsxcore/cdrom.c
+++ b/libpcsxcore/cdrom.c
@@ -85,8 +85,8 @@ unsigned char Test23[] = { 0x43, 0x58, 0x44, 0x32, 0x39 ,0x34, 0x30, 0x51 };
// 1x = 75 sectors per second
// PSXCLK = 1 sec in the ps
-// so (PSXCLK / 75) / BIAS = cdr read time (linuzappz)
-#define cdReadTime ((PSXCLK / 75) / BIAS)
+// so (PSXCLK / 75) = cdr read time (linuzappz)
+#define cdReadTime (PSXCLK / 75)
static struct CdrStat stat;
static struct SubQ *subq;
diff --git a/libpcsxcore/ix86/iR3000A.c b/libpcsxcore/ix86/iR3000A.c
index b8076409..f8583d84 100644
--- a/libpcsxcore/ix86/iR3000A.c
+++ b/libpcsxcore/ix86/iR3000A.c
@@ -97,7 +97,7 @@ static void iFlushRegs() {
static void iRet() {
/* store cycle */
- count = (pc - pcold)/4;
+ count = ((pc - pcold) / 4) * BIAS;
ADD32ItoM((u32)&psxRegs.cycle, count);
if (resp) ADD32ItoR(ESP, resp);
RET();
@@ -148,7 +148,7 @@ static void SetBranch() {
iFlushRegs();
MOV32ItoM((u32)&psxRegs.code, psxRegs.code);
/* store cycle */
- count = (pc - pcold) / 4;
+ count = ((pc - pcold) / 4) * BIAS;
ADD32ItoM((u32)&psxRegs.cycle, count);
if (resp) ADD32ItoR(ESP, resp);
@@ -180,7 +180,7 @@ static void iJump(u32 branchPC) {
iFlushRegs();
MOV32ItoM((u32)&psxRegs.code, psxRegs.code);
/* store cycle */
- count = (pc - pcold)/4;
+ count = ((pc - pcold) / 4) * BIAS;
ADD32ItoM((u32)&psxRegs.cycle, count);
if (resp) ADD32ItoR(ESP, resp);
@@ -199,7 +199,7 @@ static void iJump(u32 branchPC) {
MOV32ItoM((u32)&psxRegs.pc, branchPC);
CALLFunc((u32)psxBranchTest);
/* store cycle */
- count = (pc - pcold)/4;
+ count = ((pc - pcold) / 4) * BIAS;
ADD32ItoM((u32)&psxRegs.cycle, count);
if (resp) ADD32ItoR(ESP, resp);
@@ -236,7 +236,7 @@ static void iBranch(u32 branchPC, int savectx) {
iFlushRegs();
MOV32ItoM((u32)&psxRegs.code, psxRegs.code);
/* store cycle */
- count = ((pc+4) - pcold)/4;
+ count = (((pc+4) - pcold) / 4) * BIAS;
ADD32ItoM((u32)&psxRegs.cycle, count);
if (resp) ADD32ItoR(ESP, resp);
@@ -256,7 +256,7 @@ static void iBranch(u32 branchPC, int savectx) {
MOV32ItoM((u32)&psxRegs.pc, branchPC);
CALLFunc((u32)psxBranchTest);
/* store cycle */
- count = (pc - pcold)/4;
+ count = ((pc - pcold) / 4) * BIAS;
ADD32ItoM((u32)&psxRegs.cycle, count);
if (resp) ADD32ItoR(ESP, resp);
diff --git a/libpcsxcore/ix86_64/iR3000A-64.c b/libpcsxcore/ix86_64/iR3000A-64.c
index d7754bb9..b686def2 100644
--- a/libpcsxcore/ix86_64/iR3000A-64.c
+++ b/libpcsxcore/ix86_64/iR3000A-64.c
@@ -110,7 +110,7 @@ static void iFlushRegs() {
static void iRet() {
/* store cycle */
- count = (pc - pcold)/4;
+ count = ((pc - pcold) / 4) * BIAS;
ADD32ItoM((uptr)&psxRegs.cycle, count);
StackRes();
RET();
@@ -161,7 +161,7 @@ static void SetBranch() {
iFlushRegs();
MOV32ItoM((uptr)&psxRegs.code, psxRegs.code);
/* store cycle */
- count = (pc - pcold)/4;
+ count = ((pc - pcold) / 4) * BIAS;
ADD32ItoM((uptr)&psxRegs.cycle, count);
//PUSH64M((uptr)&target);
@@ -193,7 +193,7 @@ static void iJump(u32 branchPC) {
iFlushRegs();
MOV32ItoM((uptr)&psxRegs.code, psxRegs.code);
/* store cycle */
- count = (pc - pcold)/4;
+ count = ((pc - pcold) / 4) * BIAS;
ADD32ItoM((uptr)&psxRegs.cycle, count);
//PUSHI(branchPC);
@@ -213,7 +213,7 @@ static void iJump(u32 branchPC) {
MOV32ItoM((uptr)&psxRegs.pc, branchPC);
CALLFunc((uptr)psxBranchTest);
/* store cycle */
- count = (pc - pcold)/4;
+ count = ((pc - pcold) / 4) * BIAS;
ADD32ItoM((uptr)&psxRegs.cycle, count);
StackRes();
@@ -257,7 +257,7 @@ static void iBranch(u32 branchPC, int savectx) {
iFlushRegs();
MOV32ItoM((uptr)&psxRegs.code, psxRegs.code);
/* store cycle */
- count = ((pc+4) - pcold)/4;
+ count = (((pc+4) - pcold) / 4) * BIAS;
ADD32ItoM((uptr)&psxRegs.cycle, count);
//if (resp) ADD32ItoR(ESP, resp);
@@ -278,7 +278,7 @@ static void iBranch(u32 branchPC, int savectx) {
MOV32ItoM((uptr)&psxRegs.pc, branchPC);
CALLFunc((uptr)psxBranchTest);
/* store cycle */
- count = (pc - pcold)/4;
+ count = ((pc - pcold) / 4) * BIAS;
ADD32ItoM((uptr)&psxRegs.cycle, count);
StackRes();
diff --git a/libpcsxcore/mdec.c b/libpcsxcore/mdec.c
index 7165af4b..5e84152a 100644
--- a/libpcsxcore/mdec.c
+++ b/libpcsxcore/mdec.c
@@ -225,7 +225,7 @@ static int aanscales[DSIZE2] = {
1370031, 1900287, 1790031, 1610986, 1370031, 1076426, 741455, 377991,
1232995, 1710213, 1610986, 1449849, 1232995, 968758, 667292, 340183,
1048576, 1454417, 1370031, 1232995, 1048576, 823861, 567485, 289301,
- 823861, 1142728, 1076426, 968758, 823861, 647303, 445870, 227303,
+ 823861, 1142728, 1076426, 968758, 823861, 647303, 445870, 227303,
567485, 787125, 741455, 667292, 567485, 445870, 307121, 156569,
289301, 401273, 377991, 340183, 289301, 227303, 156569, 79818
};
@@ -516,16 +516,16 @@ void psxDma1(u32 adr, u32 bcr, u32 chcr) {
image = (u16 *)PSXM(adr);
if (mdec.reg0 & MDEC0_RGB24) { // 15-b decoding
- // MDECOUTDMA_INT(((size * (1000000 / 9000)) / 4) /** 4*/ / BIAS);
- MDECOUTDMA_INT((size / 4) / BIAS);
+ // MDECOUTDMA_INT(((size * (1000000 / 9000)) / 4) /** 4*/);
+ MDECOUTDMA_INT(size / 4);
size = size / ((16 * 16) / 2);
for (; size > 0; size--, image += (16 * 16)) {
mdec.rl = rl2blk(blk, mdec.rl);
yuv2rgb15(blk, image);
}
} else { // 24-b decoding
- // MDECOUTDMA_INT(((size * (1000000 / 9000)) / 4) /** 4*/ / BIAS);
- MDECOUTDMA_INT((size / 4) / BIAS);
+ // MDECOUTDMA_INT(((size * (1000000 / 9000)) / 4) /** 4*/);
+ MDECOUTDMA_INT(size / 4);
size = size / ((24 * 16) / 2);
for (; size > 0; size--, image += (24 * 16)) {
mdec.rl = rl2blk(blk, mdec.rl);
@@ -545,7 +545,7 @@ void mdec1Interrupt() {
// PSXCLK / 60 or PSXCLK / 50 since the bug happened at end of frame.
// PSXCLK / 1000 seems good for FF9. (for FF9 need < ~28000)
// CAUTION: commented interrupt-handling may lead to problems, keep an eye ;-)
- MDECOUTDMA_INT(PSXCLK / 1000);
+ MDECOUTDMA_INT(PSXCLK / 1000 * BIAS);
// psxRegs.interrupt |= 0x02000000;
// psxRegs.intCycle[5 + 24 + 1] *= 8;
// psxRegs.intCycle[5 + 24] = psxRegs.cycle;
diff --git a/libpcsxcore/ppc/pR3000A.c b/libpcsxcore/ppc/pR3000A.c
index d0037b64..93745f82 100644
--- a/libpcsxcore/ppc/pR3000A.c
+++ b/libpcsxcore/ppc/pR3000A.c
@@ -741,7 +741,7 @@ static void Return()
static void iRet() {
/* store cycle */
- count = idlecyclecount + (pc - pcold)/4;
+ count = (idlecyclecount + (pc - pcold) / 4) * BIAS;
ADDI(PutHWRegSpecial(CYCLECOUNT), GetHWRegSpecial(CYCLECOUNT), count);
Return();
}
@@ -793,7 +793,7 @@ static void SetBranch() {
LIW(0, psxRegs.code);
STW(0, OFFSET(&psxRegs, &psxRegs.code), GetHWRegSpecial(PSXREGS));
/* store cycle */
- count = idlecyclecount + (pc - pcold)/4;
+ count = (idlecyclecount + (pc - pcold) / 4) * BIAS;
ADDI(PutHWRegSpecial(CYCLECOUNT), GetHWRegSpecial(CYCLECOUNT), count);
treg = GetHWRegSpecial(TARGET);
@@ -816,7 +816,7 @@ static void SetBranch() {
DisposeHWReg(GetHWRegFromCPUReg(treg));
FlushAllHWReg();
- count = idlecyclecount + (pc - pcold)/4;
+ count = (idlecyclecount + (pc - pcold) / 4) * BIAS;
ADDI(PutHWRegSpecial(CYCLECOUNT), GetHWRegSpecial(CYCLECOUNT), count);
FlushAllHWReg();
CALLFunc((u32)psxBranchTest);
@@ -836,7 +836,7 @@ static void iJump(u32 branchPC) {
LIW(0, psxRegs.code);
STW(0, OFFSET(&psxRegs, &psxRegs.code), GetHWRegSpecial(PSXREGS));
/* store cycle */
- count = idlecyclecount + (pc - pcold)/4;
+ count = (idlecyclecount + (pc - pcold) / 4) * BIAS;
ADDI(PutHWRegSpecial(CYCLECOUNT), GetHWRegSpecial(CYCLECOUNT), count);
LIW(PutHWRegSpecial(ARG2), branchPC);
@@ -855,7 +855,7 @@ static void iJump(u32 branchPC) {
LIW(PutHWRegSpecial(PSXPC), branchPC);
FlushAllHWReg();
- count = idlecyclecount + (pc - pcold)/4;
+ count = (idlecyclecount + (pc - pcold) / 4) * BIAS;
//if (/*psxRegs.code == 0 &&*/ count == 2 && branchPC == pcold) {
// LIW(PutHWRegSpecial(CYCLECOUNT), 0);
//} else {
@@ -916,7 +916,7 @@ static void iBranch(u32 branchPC, int savectx) {
LIW(0, psxRegs.code);
STW(0, OFFSET(&psxRegs, &psxRegs.code), GetHWRegSpecial(PSXREGS));
/* store cycle */
- count = idlecyclecount + ((pc+4) - pcold)/4;
+ count = (idlecyclecount + ((pc+4) - pcold) / 4) * BIAS;
ADDI(PutHWRegSpecial(CYCLECOUNT), GetHWRegSpecial(CYCLECOUNT), count);
LIW(PutHWRegSpecial(ARG2), branchPC);
@@ -937,7 +937,7 @@ static void iBranch(u32 branchPC, int savectx) {
FlushAllHWReg();
/* store cycle */
- count = idlecyclecount + (pc - pcold)/4;
+ count = (idlecyclecount + (pc - pcold) / 4) * BIAS;
//if (/*psxRegs.code == 0 &&*/ count == 2 && branchPC == pcold) {
// LIW(PutHWRegSpecial(CYCLECOUNT), 0);
//} else {
@@ -3324,7 +3324,7 @@ static void recHLE() {
CALLFunc((u32)psxHLEt[0]); // call dummy function
}
- count = idlecyclecount + (pc - pcold)/4 + 20;
+ count = (idlecyclecount + (pc - pcold) / 4 + 20) * BIAS;
ADDI(PutHWRegSpecial(CYCLECOUNT), GetHWRegSpecial(CYCLECOUNT), count);
FlushAllHWReg();
CALLFunc((u32)psxBranchTest);
diff --git a/libpcsxcore/psxcounters.c b/libpcsxcore/psxcounters.c
index 961739cb..d1089b66 100644
--- a/libpcsxcore/psxcounters.c
+++ b/libpcsxcore/psxcounters.c
@@ -116,7 +116,7 @@ void _psxRcntWcount( u32 index, u32 value )
value &= 0xffff;
}
- rcnts[index].cycleStart = psxRegs.cycle * BIAS;
+ rcnts[index].cycleStart = psxRegs.cycle;
rcnts[index].cycleStart -= value * rcnts[index].rate;
// TODO: <=.
@@ -137,7 +137,7 @@ u32 _psxRcntRcount( u32 index )
{
u32 count;
- count = psxRegs.cycle * BIAS;
+ count = psxRegs.cycle;
count -= rcnts[index].cycleStart;
count /= rcnts[index].rate;
@@ -158,7 +158,7 @@ void psxRcntSet()
s32 countToUpdate;
u32 i;
- psxNextsCounter = psxRegs.cycle * BIAS;
+ psxNextsCounter = psxRegs.cycle;
psxNextCounter = 0x7fffffff;
for( i = 0; i < CounterQuantity; ++i )
@@ -189,7 +189,7 @@ void psxRcntReset( u32 index )
{
if( rcnts[index].mode & RcCountToTarget )
{
- count = psxRegs.cycle * BIAS;
+ count = psxRegs.cycle;
count -= rcnts[index].cycleStart;
count /= rcnts[index].rate;
count -= rcnts[index].target;
@@ -215,7 +215,7 @@ void psxRcntReset( u32 index )
}
else if( rcnts[index].counterState == CountToOverflow )
{
- count = psxRegs.cycle * BIAS;
+ count = psxRegs.cycle;
count -= rcnts[index].cycleStart;
count /= rcnts[index].rate;
count -= 0xffff;
@@ -244,7 +244,7 @@ void psxRcntUpdate()
{
u32 cycle;
- cycle = psxRegs.cycle * BIAS;
+ cycle = psxRegs.cycle;
// rcnt 0.
if( cycle - rcnts[0].cycleStart >= rcnts[0].cycle )
diff --git a/libpcsxcore/psxdma.c b/libpcsxcore/psxdma.c
index f6c3807e..fa29101f 100644
--- a/libpcsxcore/psxdma.c
+++ b/libpcsxcore/psxdma.c
@@ -48,7 +48,7 @@ void psxDma4(u32 madr, u32 bcr, u32 chcr) { // SPU
break;
}
SPU_writeDMAMem(ptr, (bcr >> 16) * (bcr & 0xffff) * 2);
- SPUDMA_INT(((bcr >> 16) * (bcr & 0xffff) / 2) / BIAS);
+ SPUDMA_INT((bcr >> 16) * (bcr & 0xffff) / 2);
return;
case 0x01000200: //spu to cpu transfer
@@ -112,7 +112,7 @@ void psxDma2(u32 madr, u32 bcr, u32 chcr) { // GPU
}
size = (bcr >> 16) * (bcr & 0xffff);
GPU_writeDataMem(ptr, size);
- GPUDMA_INT((size / 4) / BIAS);
+ GPUDMA_INT(size / 4);
return;
case 0x01000401: // dma chain
diff --git a/libpcsxcore/psxinterpreter.c b/libpcsxcore/psxinterpreter.c
index 7e39d2b1..1f4b46cd 100644
--- a/libpcsxcore/psxinterpreter.c
+++ b/libpcsxcore/psxinterpreter.c
@@ -286,7 +286,7 @@ __inline void doBranch(u32 tar) {
debugI();
psxRegs.pc += 4;
- psxRegs.cycle++;
+ psxRegs.cycle += BIAS;
// check for load delay
tmp = psxRegs.code >> 26;
@@ -789,7 +789,7 @@ inline void execI() {
if (Config.Debug) ProcessDebug();
psxRegs.pc += 4;
- psxRegs.cycle++;
+ psxRegs.cycle += BIAS;
psxBSC[psxRegs.code >> 26]();
}
diff --git a/libpcsxcore/sio.c b/libpcsxcore/sio.c
index a4b1a491..3b2c3d6f 100644
--- a/libpcsxcore/sio.c
+++ b/libpcsxcore/sio.c
@@ -71,7 +71,7 @@ char Mcd1Data[MCD_SIZE], Mcd2Data[MCD_SIZE];
static inline void SIO_INT() {
if (!Config.Sio) {
psxRegs.interrupt |= 0x80;
- psxRegs.intCycle[7 + 1] = 200; /*271;*/
+ psxRegs.intCycle[7 + 1] = 400;
psxRegs.intCycle[7] = psxRegs.cycle;
}
}