use=OpBase(op);\r
if (op!=use) { OpUse(op,use); return 0; } // Use existing handler\r
\r
- OpStart(op); Cycles=4;\r
+ OpStart(op, sea|tea); Cycles=4;\r
\r
EaCalc(10,0x0000, sea,size,1);\r
EaRead(10, 10, sea,size,0,1);\r
if (num!=8) use|=0x0e00; // If num is not 8, use same handler\r
if (op!=use) { OpUse(op,use); return 0; } // Use existing handler\r
\r
- OpStart(op);\r
+ OpStart(op,ea);\r
Cycles=ea<8?4:8;\r
if(type==0&&size==1) Cycles=ea<0x10?4:8;\r
if(size>=2) Cycles=ea<0x10?8:12;\r
use&=~0x0e00; // Use same opcode for Dn\r
if (op!=use) { OpUse(op,use); return 0; } // Use existing handler\r
\r
- OpStart(op); Cycles=4;\r
+ OpStart(op,ea); Cycles=4;\r
\r
ot(";@ Get r10=EA r11=EA value\n");\r
EaCalc(10,0x003f, ea,size,1);\r
if(size>=2) Cycles+=4;\r
} else {\r
if(size>=2) {\r
- Cycles+=2;\r
- if(ea<0x10||ea==0x3c) Cycles+=2;\r
- }\r
+ Cycles+=2;\r
+ if(ea<0x10||ea==0x3c) Cycles+=2;\r
+ }\r
}\r
\r
OpEnd();\r
use&=~0x0e00; // Use same for all registers\r
if (op!=use) { OpUse(op,use); return 0; } // Use existing handler\r
\r
- OpStart(op);\r
+ OpStart(op,ea);\r
if(type) Cycles=54;\r
else Cycles=sign?158:140;\r
\r
ot("\n");\r
}\r
else\r
- {\r
+ {\r
ot(" mov r10,r10,lsl #16 ;@ use only 16 bits of divisor\n");\r
ot(" mov r10,r10,lsr #16\n");\r
- }\r
+ }\r
\r
ot(";@ Divide r2 by r10\n");\r
ot(" mov r3,#0\n");\r
\r
if (sign)\r
{\r
- // sign correction\r
+ // sign correction\r
ot(" and r1,r11,#1\n");\r
ot(" teq r1,r11,lsr #1\n");\r
ot(" rsbne r3,r3,#0 ;@ negate if quotient is negative\n");\r
ot(" rsbne r2,r2,#0 ;@ negate the remainder if divident was negative\n");\r
ot("\n");\r
\r
- // signed overflow check\r
- ot(" mov r1,r3,asl #16\n");\r
- ot(" cmp r3,r1,asr #16 ;@ signed overflow?\n");\r
+ // signed overflow check\r
+ ot(" mov r1,r3,asl #16\n");\r
+ ot(" cmp r3,r1,asr #16 ;@ signed overflow?\n");\r
ot(" orrne r9,r9,#0x10000000 ;@ set overflow flag\n");\r
ot(" bne endofop%.4x ;@ overflow!\n",op);\r
}\r
- else\r
- {\r
- // overflow check\r
- ot(" movs r1,r3,lsr #16 ;@ check for overflow condition\n");\r
+ else\r
+ {\r
+ // overflow check\r
+ ot(" movs r1,r3,lsr #16 ;@ check for overflow condition\n");\r
ot(" orrne r9,r9,#0x10000000 ;@ set overflow flag\n");\r
ot(" bne endofop%.4x ;@ overflow!\n",op);\r
- }\r
+ }\r
\r
ot(" mov r1,r3,lsl #16 ;@ Clip to 16-bits\n");\r
ot(" adds r1,r1,#0 ;@ Defines NZ, clears CV\n");\r
if (sea==0x27||dea==0x27) use=op; // ..except -(a7)\r
if (op!=use) { OpUse(op,use); return 0; } // Use existing handler\r
\r
- OpStart(op); Cycles=6;\r
+ OpStart(op,sea|dea); Cycles=6;\r
\r
EaCalc( 0,0x0007, sea,0,1);\r
EaRead( 0, 10, sea,0,0x0007,1);\r
ot(" ldrb r0,[r7,#0x45] ;@ Get X bit\n");\r
ot(" mov r3,#0x00f00000\n");\r
ot(" and r2,r3,r1,lsr #4\n");\r
- ot(" tst r0,#2\n");\r
+ ot(" tst r0,#2\n");\r
ot(" and r0,r3,r10,lsr #4\n");\r
ot(" add r0,r0,r2\n");\r
ot(" addne r0,r0,#0x00100000\n");\r
ot(" mov r2,r10,lsr #28\n");\r
ot(" add r0,r0,r2,lsl #24\n");\r
ot(" cmp r0,#0x09900000\n");\r
- ot(" orrhi r9,r9,#0x20000000 ;@ C\n");\r
- ot(" subhi r0,r0,#0x0a000000\n");\r
-// ot(" and r3,r9,r0,lsr #3 ;@ Undefined V behavior part II\n");\r
-// ot(" orr r9,r9,r3,lsl #4 ;@ V\n");\r
+ ot(" orrhi r9,r9,#0x20000000 ;@ C\n");\r
+ ot(" subhi r0,r0,#0x0a000000\n");\r
+// ot(" and r3,r9,r0,lsr #3 ;@ Undefined V behavior part II\n");\r
+// ot(" orr r9,r9,r3,lsl #4 ;@ V\n");\r
ot(" movs r0,r0,lsl #4\n");\r
- ot(" orrmi r9,r9,#0x90000000 ;@ Undefined N+V behavior\n"); // this is what Musashi really does\r
- ot(" bicne r9,r9,#0x40000000 ;@ Z flag\n");\r
+ ot(" orrmi r9,r9,#0x90000000 ;@ Undefined N+V behavior\n"); // this is what Musashi really does\r
+ ot(" bicne r9,r9,#0x40000000 ;@ Z flag\n");\r
}\r
else\r
{\r
ot(" ldrb r0,[r7,#0x45] ;@ Get X bit\n");\r
ot(" mov r3,#0x00f00000\n");\r
ot(" and r2,r3,r10,lsr #4\n");\r
- ot(" tst r0,#2\n");\r
+ ot(" tst r0,#2\n");\r
ot(" and r0,r3,r1,lsr #4\n");\r
ot(" sub r0,r0,r2\n");\r
ot(" subne r0,r0,#0x00100000\n");\r
ot(" mov r2,r10,lsr #28\n");\r
ot(" sub r0,r0,r2,lsl #24\n");\r
ot(" cmp r0,#0x09900000\n");\r
- ot(" orrhi r9,r9,#0xa0000000 ;@ N and C\n");\r
- ot(" addhi r0,r0,#0x0a000000\n");\r
-// ot(" and r3,r9,r0,lsr #3 ;@ Undefined V behavior part II\n");\r
-// ot(" orr r9,r9,r3,lsl #4 ;@ V\n");\r
+ ot(" orrhi r9,r9,#0xa0000000 ;@ N and C\n");\r
+ ot(" addhi r0,r0,#0x0a000000\n");\r
+// ot(" and r3,r9,r0,lsr #3 ;@ Undefined V behavior part II\n");\r
+// ot(" orr r9,r9,r3,lsl #4 ;@ V\n");\r
ot(" movs r0,r0,lsl #4\n");\r
-// ot(" orrmi r9,r9,#0x80000000 ;@ Undefined N behavior\n");\r
- ot(" bicne r9,r9,#0x40000000 ;@ Z flag\n");\r
+// ot(" orrmi r9,r9,#0x80000000 ;@ Undefined N behavior\n");\r
+ ot(" bicne r9,r9,#0x40000000 ;@ Z flag\n");\r
}\r
\r
ot(" mov r2,r9,lsr #28\n");\r
use=OpBase(op);\r
if(op!=use) { OpUse(op,use); return 0; } // Use existing handler\r
\r
- OpStart(op); Cycles=6;\r
+ OpStart(op,ea); Cycles=6;\r
if(ea >= 8) Cycles+=2;\r
\r
EaCalc(10,0x3f, ea,0,1);\r
use&=~0x0e00; // Use same opcode for An\r
if (op!=use) { OpUse(op,use); return 0; } // Use existing handler\r
\r
- OpStart(op); Cycles=(size==2)?6:8;\r
+ OpStart(op,sea); Cycles=(size==2)?6:8;\r
if(size==2&&(sea<0x10||sea==0x3c)) Cycles+=2;\r
if(type==1) Cycles=6;\r
\r
if (size==0&&(sea==0x27||dea==0x27)) use=op; // ___x.b -(a7)\r
if (op!=use) { OpUse(op,use); return 0; } // Use existing handler\r
\r
- OpStart(op); Cycles=4;\r
+ OpStart(op,sea|dea); Cycles=4;\r
if(size>=2) Cycles+=4;\r
if(sea>=0x10) Cycles+=2;\r
\r
if (type==5 && size<2)\r
{\r
ot(";@ Make sure the carry bit will tip the balance:\n");\r
- ot(" mvn r2,#0\n");\r
+ ot(" mvn r2,#0\n");\r
ot(" orr r11,r11,r2,lsr #%i\n",(size==0)?8:16);\r
ot("\n");\r
}\r
use&=~0x0e00; // Use 1 handler for register d0-7\r
if (op!=use) { OpUse(op,use); return 0; } // Use existing handler\r
\r
- OpStart(op); Cycles=4;\r
+ OpStart(op,ea); Cycles=4;\r
if(eor) {\r
if(ea>8) Cycles+=4;\r
if(size>=2) Cycles+=4;\r
if (size==0&&(sea==0x1f||dea==0x1f)) use=op; // ..except (a7)+\r
if (op!=use) { OpUse(op,use); return 0; } // Use existing handler\r
\r
- OpStart(op); Cycles=4;\r
+ OpStart(op,sea); Cycles=4;\r
\r
ot(";@ Get src operand into r10:\n");\r
EaCalc (0,0x000f, sea,size,1);\r
use&=~0x0e00; // Use 1 handler for register d0-7\r
if (op!=use) { OpUse(op,use); return 0; } // Use existing handler\r
\r
- OpStart(op); Cycles=10;\r
+ OpStart(op,ea); Cycles=10;\r
\r
ot(";@ Get EA into r10 and value into r0:\n");\r
EaCalc (10,0x003f, ea,size,1);\r