X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=cpu%2FCyclone%2FOpLogic.cpp;h=94b00172d77e14ceb4cd3a2c2393947217f3dea0;hb=8b99ab90aa519639a87c302c9a26fef526febde9;hp=762370490078cb9c5592fd61103ea6d6fe4de713;hpb=03c5768cb5cb2cd8a7ea3e4383fd10065d27970e;p=picodrive.git diff --git a/cpu/Cyclone/OpLogic.cpp b/cpu/Cyclone/OpLogic.cpp index 7623704..94b0017 100644 --- a/cpu/Cyclone/OpLogic.cpp +++ b/cpu/Cyclone/OpLogic.cpp @@ -143,16 +143,8 @@ int OpNeg(int op) use=OpBase(op,size); if (op!=use) { OpUse(op,use); return 0; } // Use existing handler - OpStart(op,ea); Cycles=size<2?4:6; - if(ea >= 0x10) { - Cycles*=2; -#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. - if(type==1&&size<2) Cycles-=2; -#endif - } + OpStart(op,ea); Cycles=size<2?4:6; + if(ea >= 0x10) Cycles*=2; EaCalc (10,0x003f,ea,size,0,0); @@ -207,6 +199,7 @@ int OpNeg(int op) ot("\n"); } + if (type==1) eawrite_check_addrerr=1; EaWrite(10, 1,ea,size,0x003f,0,0); OpEnd(ea); @@ -307,7 +300,7 @@ int OpExt(int op) int OpSet(int op) { int cc=0,ea=0; - int size=0,use=0; + int size=0,use=0,changed_cycles=0; char *cond[16]= { "al","", "hi","ls","cc","cs","ne","eq", @@ -325,7 +318,8 @@ int OpSet(int op) use=OpBase(op,size); if (op!=use) { OpUse(op,use); return 0; } // Use existing handler - OpStart(op,ea); Cycles=8; + changed_cycles=ea<8 && cc>=2; + OpStart(op,ea,0,changed_cycles); Cycles=8; if (ea<8) Cycles=4; if (cc) @@ -359,10 +353,12 @@ int OpSet(int op) ot("\n"); + eawrite_check_addrerr=1; EaCalc (0,0x003f, ea,size,0,0); EaWrite(0, 1, ea,size,0x003f,0,0); - OpEnd(ea); + opend_op_changes_cycles=changed_cycles; + OpEnd(ea,0); return 0; } @@ -403,7 +399,7 @@ static int EmitAsr(int op,int type,int dir,int count,int size,int usereg) ot("\n"); } - if (type==0 && dir) ot(" mov r3,r0 ;@ save old value for V flag calculation\n"); + if (type==0 && dir) ot(" adds r3,r0,#0 ;@ save old value for V flag calculation, also clear V\n"); ot(";@ Shift register:\n"); if (type==0) ot(" movs r0,r0,%s %s\n",dir?"asl":"asr",pct); @@ -434,7 +430,8 @@ static int EmitAsr(int op,int type,int dir,int count,int size,int usereg) ot(" mov r1,#0x80000000\n"); ot(" ands r3,r3,r1,asr %s\n", pct); ot(" cmpne r3,r1,asr %s\n", pct); - ot(" biceq r9,r9,#0x10000000\n"); + ot(" eoreq r1,r0,r3\n"); // above check doesn't catch (-1)<<(32+), so we need this + ot(" tsteq r1,#0x80000000\n"); ot(" orrne r9,r9,#0x10000000\n"); ot("\n"); } @@ -585,7 +582,6 @@ int OpAsr(int op) int count=0,dir=0; int size=0,usereg=0,type=0; - ea=0; count =(op>>9)&7; dir =(op>>8)&1; size =(op>>6)&3; @@ -604,7 +600,7 @@ int OpAsr(int op) if (op!=use) { OpUse(op,use); return 0; } // Use existing handler - OpStart(op); Cycles=size<2?6:8; + OpStart(op,ea,0,count<0); Cycles=size<2?6:8; EaCalc(10,0x0007, ea,size,1); EaRead(10, 0, ea,size,0x0007,1); @@ -613,7 +609,8 @@ int OpAsr(int op) EaWrite(10, 0, ea,size,0x0007,1); - OpEnd(); + opend_op_changes_cycles = (count<0); + OpEnd(ea,0); return 0; }