X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=cpu%2FCyclone%2FOpLogic.cpp;h=b6eb07553995b41effd4eb5159fafb03405dcc4e;hb=2c559c66ef1e7021f92e40244100f60c774fdd2c;hp=4a795e40a685402bb062b0046821704e7a539ec8;hpb=cc68a136aa179a5f32fe40208371eb9c2b0aadae;p=picodrive.git diff --git a/cpu/Cyclone/OpLogic.cpp b/cpu/Cyclone/OpLogic.cpp index 4a795e4..b6eb075 100644 --- a/cpu/Cyclone/OpLogic.cpp +++ b/cpu/Cyclone/OpLogic.cpp @@ -27,7 +27,7 @@ int OpBtstReg(int op) use&=~0x0e00; // Use same handler for all registers if (op!=use) { OpUse(op,use); return 0; } // Use existing handler - OpStart(op); + OpStart(op,tea); if(type==1||type==3) { Cycles=8; @@ -88,7 +88,7 @@ int OpBtstImm(int op) use=OpBase(op); if (op!=use) { OpUse(op,use); return 0; } // Use existing handler - OpStart(op); + OpStart(op,sea|tea); ot(" mov r10,#1\n"); ot("\n"); @@ -145,10 +145,10 @@ int OpNeg(int op) use=OpBase(op); if (op!=use) { OpUse(op,use); return 0; } // Use existing handler - OpStart(op); Cycles=size<2?4:6; + OpStart(op,ea); Cycles=size<2?4:6; if(ea >= 0x10) { Cycles*=2; -#ifdef CYCLONE_FOR_GENESIS +#if CYCLONE_FOR_GENESIS // This is same as in Starscream core, CLR uses only 6 cycles for memory EAs. // May be this is similar case as with TAS opcode, but this time the dummy // read is ignored somehow? Without this hack Fatal Rewind hangs even in Gens. @@ -170,10 +170,10 @@ int OpNeg(int op) ot(" orr r3,r9,#0xb0000000 ;@ for old Z\n"); OpGetFlags(1,1,0); if(size!=2) { - ot(" movs r1,r1,asr #%i\n",size?16:24); + ot(" movs r1,r1,asr #%i\n",size?16:24); ot(" orreq r9,r9,#0x40000000 ;@ possily missed Z\n"); - } - ot(" andeq r9,r9,r3 ;@ fix Z\n"); + } + ot(" andeq r9,r9,r3 ;@ fix Z\n"); ot("\n"); } @@ -254,7 +254,7 @@ int OpTst(int op) use=OpBase(op); if (op!=use) { OpUse(op,use); return 0; } // Use existing handler - OpStart(op); Cycles=4; + OpStart(op,sea); Cycles=4; EaCalc ( 0,0x003f,sea,size,1); EaRead ( 0, 0,sea,size,0x003f,1); @@ -322,7 +322,7 @@ int OpSet(int op) use=OpBase(op); if (op!=use) { OpUse(op,use); return 0; } // Use existing handler - OpStart(op); Cycles=8; + OpStart(op,ea); Cycles=8; if (ea<8) Cycles=4; ot(" mov r1,#0\n"); @@ -429,9 +429,9 @@ static int EmitAsr(int op,int type,int dir,int count,int size,int usereg) if(count == 1) { if(dir==0) { if(size!=2) { - ot(" orr r0,r0,r0,lsr #%i\n", size?16:24); - ot(" bic r0,r0,#0x%x\n", 1<<(32-wide)); - } + ot(" orr r0,r0,r0,lsr #%i\n", size?16:24); + ot(" bic r0,r0,#0x%x\n", 1<<(32-wide)); + } GetXBit(0); ot(" movs r0,r0,rrx\n"); OpGetFlags(0,1); @@ -619,7 +619,7 @@ int OpAsrEa(int op) use=OpBase(op); if (op!=use) { OpUse(op,use); return 0; } // Use existing handler - OpStart(op); Cycles=6; // EmitAsr() will add 2 + OpStart(op,ea); Cycles=6; // EmitAsr() will add 2 EaCalc (10,0x003f,ea,size,1); EaRead (10, 0,ea,size,0x003f,1); @@ -632,7 +632,7 @@ int OpAsrEa(int op) return 0; } -int OpTas(int op) +int OpTas(int op, int gen_special) { int ea=0; int use=0; @@ -645,7 +645,11 @@ int OpTas(int op) use=OpBase(op); if (op!=use) { OpUse(op,use); return 0; } // Use existing handler - OpStart(op); Cycles=4; + if (!gen_special) OpStart(op,ea); + else + ot("Op%.4x_%s\n", op, ms?"":":"); + + Cycles=4; if(ea>=8) Cycles+=10; EaCalc (10,0x003f,ea,0,1); @@ -657,7 +661,7 @@ int OpTas(int op) #if CYCLONE_FOR_GENESIS // the original Sega hardware ignores write-back phase (to memory only) - if (ea < 0x10) { + if (ea < 0x10 || gen_special) { #endif ot(" orr r1,r1,#0x80000000 ;@ set bit7\n"); @@ -667,6 +671,13 @@ int OpTas(int op) #endif OpEnd(); + +#if (CYCLONE_FOR_GENESIS == 2) + if (!gen_special && ea >= 0x10) { + OpTas(op, 1); + } +#endif + return 0; }