X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=cpu%2FCyclone%2FOpLogic.cpp;h=4bd0869569c4a281995c7c44af9a6f4e3e173cd3;hb=0e11c502b05a9ccd67d34d1f0975852d8c3d4232;hp=3389a8e5398f4af37bea6797122ff8a5faa648a6;hpb=85a36a57a816ac643ee5f982d774532a0ca4d58b;p=picodrive.git diff --git a/cpu/Cyclone/OpLogic.cpp b/cpu/Cyclone/OpLogic.cpp index 3389a8e..4bd0869 100644 --- a/cpu/Cyclone/OpLogic.cpp +++ b/cpu/Cyclone/OpLogic.cpp @@ -207,6 +207,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 +308,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 +326,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 +361,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,19 +407,12 @@ 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); if (type==1) ot(" movs r0,r0,%s %s\n",dir?"lsl":"lsr",pct); - if (dir==0 && size<2) - { - ot(";@ restore after right shift:\n"); - ot(" mov r0,r0,lsl #%d\n",32-(8<>9)&7; dir =(op>>8)&1; size =(op>>6)&3; @@ -599,13 +602,13 @@ int OpAsr(int op) // Use the same opcode for target registers: use=op&~0x0007; - // As long as count is not 8, use the same opcode for all shift counts:: + // As long as count is not 8, use the same opcode for all shift counts: if (usereg==0 && count!=8 && !(count==1&&type==2)) { use|=0x0e00; count=-1; } if (usereg) { use&=~0x0e00; count=-1; } // Use same opcode for all Dn 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); @@ -614,7 +617,8 @@ int OpAsr(int op) EaWrite(10, 0, ea,size,0x0007,1); - OpEnd(); + opend_op_changes_cycles = (count<0); + OpEnd(ea,0); return 0; }