make Ea* functions easier to work with
[cyclone68000.git] / OpArith.cpp
index e956831..8d3e42e 100644 (file)
@@ -37,8 +37,8 @@ int OpArith(int op)
   OpStart(op, sea, tea); Cycles=4;\r
 \r
   // imm must be read first\r
-  EaCalcReadNoSE(-1,10,sea,size,0);\r
-  EaCalcReadNoSE((type!=6)?11:-1,0,tea,size,0x003f);\r
+  EaCalcRead(-1,10,sea,size,0,earwt_msb_dont_care);\r
+  EaCalcRead((type!=6)?11:-1,0,tea,size,0x003f,earwt_msb_dont_care);\r
 \r
   if (size<2) shiftstr=(char *)(size?",asl #16":",asl #24");\r
   if (size<2) ot("  mov r10,r10,asl #%i\n",size?16:24);\r
@@ -61,7 +61,7 @@ int OpArith(int op)
 \r
   if (type!=6)\r
   {\r
-    EaWrite(11, 1, tea,size,0x003f,1);\r
+    EaWrite(11, 1, tea,size,0x003f,earwt_shifted_up);\r
   }\r
 \r
   // Correct cycles:\r
@@ -112,7 +112,7 @@ int OpAddq(int op)
 \r
   if (size>0 && (ea&0x38)==0x08) size=2; // addq.w #n,An is also 32-bit\r
 \r
-  EaCalcReadNoSE(11,0,ea,size,0x003f);\r
+  EaCalcRead(11,0,ea,size,0x003f,earwt_msb_dont_care);\r
 \r
   shift=32-(8<<size);\r
 \r
@@ -140,7 +140,7 @@ int OpAddq(int op)
   if ((ea&0x38)!=0x08) OpGetFlags(type,1);\r
   ot("\n");\r
 \r
-  EaWrite(11,     1, ea,size,0x003f,1);\r
+  EaWrite(11, 1, ea,size,0x003f,earwt_shifted_up);\r
 \r
   OpEnd(ea);\r
 \r
@@ -175,9 +175,9 @@ int OpArithReg(int op)
 \r
   OpStart(op,ea); Cycles=4;\r
 \r
-  EaCalcReadNoSE(dir?11:-1,0,ea,size,0x003f);\r
+  EaCalcRead(dir?11:-1,0,ea,size,0x003f,earwt_msb_dont_care);\r
 \r
-  EaCalcReadNoSE(dir?-1:11,1,rea,size,0x0e00);\r
+  EaCalcRead(dir?-1:11,1,rea,size,0x0e00,earwt_msb_dont_care);\r
 \r
   ot(";@ Do arithmetic:\n");\r
   if (type==0) strop = "orrs";\r
@@ -197,8 +197,8 @@ int OpArithReg(int op)
 \r
   ot(";@ Save result:\n");\r
   if (size<2) ot("  mov r1,r1,asr #%d\n",size?16:24);\r
-  if (dir) EaWrite(11, 1, ea,size,0x003f,0,0);\r
-  else     EaWrite(11, 1,rea,size,0x0e00,0,0);\r
+  if (dir) EaWrite(11, 1, ea,size,0x003f,earwt_msb_dont_care);\r
+  else     EaWrite(11, 1,rea,size,0x0e00,earwt_msb_dont_care);\r
 \r
   if(rea==ea) {\r
     if(ea<8) Cycles=(size>=2)?8:4; else Cycles+=(size>=2)?26:14;\r
@@ -240,7 +240,7 @@ int OpMul(int op)
   if(type) Cycles=54;\r
   else     Cycles=sign?158:140;\r
 \r
-  EaCalcReadNoSE(-1,0,ea,1,0x003f);\r
+  EaCalcRead(-1,0,ea,1,0x003f,earwt_msb_dont_care);\r
 \r
   EaCalc(11,0x0e00,rea, 2);\r
   EaRead(11,     2,rea, 2,0x0e00);\r
@@ -344,7 +344,7 @@ int OpMul(int op)
   }\r
   ot("\n");\r
 \r
-  EaWrite(11,    1,rea, 2,0x0e00,1);\r
+  EaWrite(11, 1,rea, 2,0x0e00,earwt_shifted_up);\r
 \r
   if (type==0) ot("endofop%.4x%s\n",op,ms?"":":");\r
   OpEnd(ea);\r
@@ -397,15 +397,15 @@ int OpAbcd(int op)
   if (mem)\r
   {\r
     ot(";@ Get src/dest EA vals\n");\r
-    EaCalc (0,0x000f, sea,0,1);\r
-    EaRead (0,     6, sea,0,0x000f,1);\r
-    EaCalcReadNoSE(11,0,dea,0,0x0e00);\r
+    EaCalc (0,0x000f, sea,0,earwt_shifted_up);\r
+    EaRead (0,     6, sea,0,0x000f,earwt_shifted_up);\r
+    EaCalcRead(11,0,dea,0,0x0e00,earwt_msb_dont_care);\r
   }\r
   else\r
   {\r
     ot(";@ Get src/dest reg vals\n");\r
-    EaCalcReadNoSE(-1,6,sea,0,0x0007);\r
-    EaCalcReadNoSE(11,0,dea,0,0x0e00);\r
+    EaCalcRead(-1,6,sea,0,0x0007,earwt_msb_dont_care);\r
+    EaCalcRead(11,0,dea,0,0x0e00,earwt_msb_dont_care);\r
     ot("  mov r6,r6,asl #24\n");\r
   }\r
   ot("  mov r1,r0,asl #24\n\n");\r
@@ -470,7 +470,7 @@ int OpAbcd(int op)
   ot("  str r10,[r7,#0x4c] ;@ Save X bit\n");\r
   ot("\n");\r
 \r
-  EaWrite(11,     0, dea,0,0x0e00,1);\r
+  EaWrite(11, 0, dea,0,0x0e00,earwt_shifted_up);\r
 \r
   ot("  ldr r6,[r7,#0x54]\n");\r
   OpEnd(sea,dea);\r
@@ -494,7 +494,7 @@ int OpNbcd(int op)
   OpStart(op,ea); Cycles=6;\r
   if(ea >= 8)  Cycles+=2;\r
 \r
-  EaCalcReadNoSE(6,0,ea,0,0x003f);\r
+  EaCalcRead(6,0,ea,0,0x003f,earwt_msb_dont_care);\r
 \r
   // this is rewrite of Musashi's code\r
   ot("  ldr r2,[r7,#0x4c]\n");\r
@@ -520,7 +520,7 @@ int OpNbcd(int op)
   ot("  orr r10,r10,#0x20000000 ;@ C\n");\r
   ot("\n");\r
 \r
-  EaWrite(6, 1, ea,0,0x3f,0,0);\r
+  EaWrite(6, 1, ea,0,0x3f,earwt_msb_dont_care);\r
 \r
   ot("finish%.4x%s\n",op,ms?"":":");\r
   ot("  tst r11,r11\n");\r
@@ -564,14 +564,14 @@ int OpAritha(int op)
   // different emus act differently in this situation, I couldn't fugure which is right behaviour.\r
   //if (type == 1)\r
   {\r
-    EaCalcReadNoSE(-1,0,sea,size,0x003f);\r
-    EaCalcReadNoSE(type!=1?11:-1,1,dea,2,0x0e00);\r
+    EaCalcRead(-1,0,sea,size,0x003f,earwt_msb_dont_care);\r
+    EaCalcRead(type!=1?11:-1,1,dea,2,0x0e00,earwt_msb_dont_care);\r
   }\r
 #if 0\r
   else\r
   {\r
-    EaCalcReadNoSE(type!=1?11:-1,1,dea,2,0x0e00);\r
-    EaCalcReadNoSE(-1,0,sea,size,0x003f);\r
+    EaCalcRead(type!=1?11:-1,1,dea,2,0x0e00,earwt_msb_dont_care);\r
+    EaCalcRead(-1,0,sea,size,0x003f,earwt_msb_dont_care);\r
   }\r
 #endif\r
 \r
@@ -623,15 +623,15 @@ int OpAddx(int op)
   if (mem)\r
   {\r
     ot(";@ Get src/dest EA vals\n");\r
-    EaCalc (0,0x000f, sea,size,1);\r
-    EaRead (0,     6, sea,size,0x000f,1);\r
-    EaCalcReadNoSE(11,0,dea,size,0x0e00);\r
+    EaCalc (0,0x000f, sea,size,earwt_shifted_up);\r
+    EaRead (0,     6, sea,size,0x000f,earwt_shifted_up);\r
+    EaCalcRead(11,0,dea,size,0x0e00,earwt_msb_dont_care);\r
   }\r
   else\r
   {\r
     ot(";@ Get src/dest reg vals\n");\r
-    EaCalcReadNoSE(-1,6,sea,size,0x0007);\r
-    EaCalcReadNoSE(11,0,dea,size,0x0e00);\r
+    EaCalcRead(-1,6,sea,size,0x0007,earwt_msb_dont_care);\r
+    EaCalcRead(11,0,dea,size,0x0e00,earwt_msb_dont_care);\r
     if (size<2) ot("  mov r6,r6,asl #%d\n\n",size?16:24);\r
   }\r
 \r
@@ -660,7 +660,7 @@ int OpAddx(int op)
   ot("\n");\r
 \r
   ot(";@ Save result:\n");\r
-  EaWrite(11, 1, dea,size,0x0e00,1);\r
+  EaWrite(11, 1, dea,size,0x0e00,earwt_shifted_up);\r
 \r
   ot("  ldr r6,[r7,#0x54]\n");\r
   OpEnd(sea,dea);\r
@@ -702,10 +702,10 @@ int OpCmpEor(int op)
   }\r
 \r
   ot(";@ Get EA into r11 and value into r0:\n");\r
-  EaCalcReadNoSE(eor?11:-1,0,ea,size,0x003f);\r
+  EaCalcRead(eor?11:-1,0,ea,size,0x003f,earwt_msb_dont_care);\r
 \r
   ot(";@ Get register operand into r1:\n");\r
-  EaCalcReadNoSE(-1,1,rea,size,0x0e00);\r
+  EaCalcRead(-1,1,rea,size,0x0e00,earwt_msb_dont_care);\r
 \r
   if (size<2) ot("  mov r0,r0,asl #%d\n\n",size?16:24);\r
   if (size<2) asl=(char *)(size?",asl #16":",asl #24");\r
@@ -723,7 +723,7 @@ int OpCmpEor(int op)
   }\r
   ot("\n");\r
 \r
-  if (eor) EaWrite(11, 1,ea,size,0x003f,1);\r
+  if (eor) EaWrite(11, 1,ea,size,0x003f,earwt_shifted_up);\r
 \r
   OpEnd(ea);\r
   return 0;\r
@@ -748,11 +748,11 @@ int OpCmpm(int op)
   OpStart(op,sea); Cycles=4;\r
 \r
   ot(";@ Get src operand into r11:\n");\r
-  EaCalc (0,0x0007, sea,size,1);\r
-  EaRead (0,    11, sea,size,0x0007,1);\r
+  EaCalc (0,0x0007, sea,size,earwt_shifted_up);\r
+  EaRead (0,    11, sea,size,0x0007,earwt_shifted_up);\r
 \r
   ot(";@ Get dst operand into r0:\n");\r
-  EaCalcReadNoSE(-1,0,dea,size,0x0e00);\r
+  EaCalcRead(-1,0,dea,size,0x0e00,earwt_msb_dont_care);\r
 \r
   if (size<2) asl=(char *)(size?",asl #16":",asl #24");\r
 \r
@@ -791,10 +791,10 @@ int OpChk(int op)
   OpStart(op,ea); Cycles=10;\r
 \r
   ot(";@ Get value into r0:\n");\r
-  EaCalcReadNoSE(-1,0,ea,size,0x003f);\r
+  EaCalcRead(-1,0,ea,size,0x003f,earwt_msb_dont_care);\r
 \r
   ot(";@ Get register operand into r1:\n");\r
-  EaCalcReadNoSE(-1,1,rea,size,0x0e00);\r
+  EaCalcRead(-1,1,rea,size,0x0e00,earwt_msb_dont_care);\r
 \r
   if (size<2) ot("  mov r0,r0,asl #%d\n",size?16:24);\r
 \r