X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=cpu%2FCyclone%2FOpLogic.cpp;h=762370490078cb9c5592fd61103ea6d6fe4de713;hb=03c5768cb5cb2cd8a7ea3e4383fd10065d27970e;hp=49ed29f8fb800a4e3fda8abc0a44ce4829b18517;hpb=cfb3dfa0f2a36569a6b090e87568b1a1c423f75c;p=picodrive.git diff --git a/cpu/Cyclone/OpLogic.cpp b/cpu/Cyclone/OpLogic.cpp index 49ed29f..7623704 100644 --- a/cpu/Cyclone/OpLogic.cpp +++ b/cpu/Cyclone/OpLogic.cpp @@ -23,7 +23,7 @@ int OpBtstReg(int op) if (EaCanWrite(tea)==0) return 1; } - use=OpBase(op); + use=OpBase(op,size); use&=~0x0e00; // Use same handler for all registers if (op!=use) { OpUse(op,use); return 0; } // Use existing handler @@ -36,15 +36,15 @@ int OpBtstReg(int op) if(size>=2) Cycles+=2; } - EaCalc (0,0x0e00,sea,0); - EaRead (0, 0,sea,0,0x0e00); + EaCalcReadNoSE(-1,10,sea,0,0x0e00); + + EaCalcReadNoSE((type>0)?11:-1,0,tea,size,0x003f); + if (tea>=0x10) - ot(" and r10,r0,#7 ;@ mem - do mod 8\n"); - else ot(" and r10,r0,#31 ;@ reg - do mod 32\n"); + ot(" and r10,r10,#7 ;@ mem - do mod 8\n"); // size always 0 + else ot(" and r10,r10,#31 ;@ reg - do mod 32\n"); // size always 2 ot("\n"); - EaCalc(11,0x003f,tea,size); - EaRead(11, 0,tea,size,0x003f); ot(" mov r1,#1\n"); ot(" tst r0,r1,lsl r10 ;@ Do arithmetic\n"); ot(" bicne r9,r9,#0x40000000\n"); @@ -57,7 +57,7 @@ int OpBtstReg(int op) if (type==2) ot(" bic r1,r0,r1,lsl r10 ;@ Clear bit\n"); if (type==3) ot(" orr r1,r0,r1,lsl r10 ;@ Set bit\n"); ot("\n"); - EaWrite(11, 1,tea,size,0x003f); + EaWrite(11, 1,tea,size,0x003f,0,0); } OpEnd(tea); @@ -85,19 +85,18 @@ int OpBtstImm(int op) if (EaCanWrite(tea)==0) return 1; } - use=OpBase(op); + use=OpBase(op,size); if (op!=use) { OpUse(op,use); return 0; } // Use existing handler OpStart(op,sea,tea); - ot(" mov r10,#1\n"); ot("\n"); - EaCalc ( 0,0x0000,sea,0); - EaRead ( 0, 0,sea,0,0); + EaCalcReadNoSE(-1,0,sea,0,0); + ot(" mov r10,#1\n"); ot(" bic r9,r9,#0x40000000 ;@ Blank Z flag\n"); if (tea>=0x10) - ot(" and r0,r0,#7 ;@ mem - do mod 8\n"); - else ot(" and r0,r0,#0x1F ;@ reg - do mod 32\n"); + ot(" and r0,r0,#7 ;@ mem - do mod 8\n"); // size always 0 + else ot(" and r0,r0,#0x1F ;@ reg - do mod 32\n"); // size always 2 ot(" mov r10,r10,lsl r0 ;@ Make bit mask\n"); ot("\n"); @@ -108,8 +107,7 @@ int OpBtstImm(int op) if(size>=2) Cycles+=2; } - EaCalc (11,0x003f,tea,size); - EaRead (11, 0,tea,size,0x003f); + EaCalcReadNoSE((type>0)?11:-1,0,tea,size,0x003f); ot(" tst r0,r10 ;@ Do arithmetic\n"); ot(" orreq r9,r9,#0x40000000 ;@ Get Z flag\n"); ot("\n"); @@ -120,7 +118,7 @@ int OpBtstImm(int op) if (type==2) ot(" bic r1,r0,r10 ;@ Clear bit\n"); if (type==3) ot(" orr r1,r0,r10 ;@ Set bit\n"); ot("\n"); - EaWrite(11, 1,tea,size,0x003f); + EaWrite(11, 1,tea,size,0x003f,0,0); } OpEnd(sea,tea); @@ -142,7 +140,7 @@ int OpNeg(int op) if (EaCanRead (ea,size)==0||EaAn(ea)) return 1; if (EaCanWrite(ea )==0) return 1; - use=OpBase(op); + use=OpBase(op,size); if (op!=use) { OpUse(op,use); return 0; } // Use existing handler OpStart(op,ea); Cycles=size<2?4:6; @@ -156,16 +154,16 @@ int OpNeg(int op) #endif } - EaCalc (10,0x003f,ea,size); + EaCalc (10,0x003f,ea,size,0,0); - if (type!=1) EaRead (10,0,ea,size,0x003f); // Don't need to read for 'clr' + if (type!=1) EaRead (10,0,ea,size,0x003f,0,0); // Don't need to read for 'clr' (or do we, for a dummy read?) if (type==1) ot("\n"); if (type==0) { ot(";@ Negx:\n"); GetXBit(1); - if(size!=2) ot(" mov r0,r0,lsl #%i\n",size?16:24); + if(size!=2) ot(" mov r0,r0,asl #%i\n",size?16:24); ot(" rscs r1,r0,#0 ;@ do arithmetic\n"); ot(" orr r3,r9,#0xb0000000 ;@ for old Z\n"); OpGetFlags(1,1,0); @@ -188,7 +186,7 @@ int OpNeg(int op) if (type==2) { ot(";@ Neg:\n"); - if(size!=2) ot(" mov r0,r0,lsl #%i\n",size?16:24); + if(size!=2) ot(" mov r0,r0,asl #%i\n",size?16:24); ot(" rsbs r1,r0,#0\n"); OpGetFlags(1,1); if(size!=2) ot(" mov r1,r1,asr #%i\n",size?16:24); @@ -198,13 +196,18 @@ int OpNeg(int op) if (type==3) { ot(";@ Not:\n"); - ot(" mvn r1,r0\n"); + if(size!=2) { + ot(" mov r0,r0,asl #%i\n",size?16:24); + ot(" mvn r1,r0,asr #%i\n",size?16:24); + } + else + ot(" mvn r1,r0\n"); ot(" adds r1,r1,#0 ;@ Defines NZ, clears CV\n"); OpGetFlags(0,0); ot("\n"); } - EaWrite(10, 1,ea,size,0x003f); + EaWrite(10, 1,ea,size,0x003f,0,0); OpEnd(ea); @@ -251,7 +254,7 @@ int OpTst(int op) // See if we can do this opcode: if (EaCanWrite(sea)==0||EaAn(sea)) return 1; - use=OpBase(op); + use=OpBase(op,size); if (op!=use) { OpUse(op,use); return 0; } // Use existing handler OpStart(op,sea); Cycles=4; @@ -279,13 +282,13 @@ int OpExt(int op) size=(op>>6)&1; shift=32-(8<