fix compatibility with ancient gas
[cyclone68000.git] / OpArith.cpp
index ca279da..09517b8 100644 (file)
@@ -37,33 +37,31 @@ 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
 \r
   ot(";@ Do arithmetic:\n");\r
 \r
-  if (type==0) ot("  orr r1,r10,r0%s\n",shiftstr);\r
-  if (type==1) ot("  and r1,r10,r0%s\n",shiftstr);\r
+  if (type==0) ot("  orrs r1,r10,r0%s\n",shiftstr);\r
+  if (type==1) ot("  ands r1,r10,r0%s\n",shiftstr);\r
   if (type==2||type==6)\r
                ot("  rsbs r1,r10,r0%s ;@ Defines NZCV\n",shiftstr);\r
   if (type==3) ot("  adds r1,r10,r0%s ;@ Defines NZCV\n",shiftstr);\r
-  if (type==5) ot("  eor r1,r10,r0%s\n",shiftstr);\r
+  if (type==5) ot("  eors r1,r10,r0%s\n",shiftstr);\r
 \r
-  if (type<2 || type==5) ot("  adds r1,r1,#0 ;@ Defines NZ, clears CV\n"); // 0,1,5\r
-\r
-  if (type< 2) OpGetFlags(0,0); // Ori/And\r
+  if (type< 2) OpGetFlagsNZ(1); // Ori/And\r
   if (type==2) OpGetFlags(1,1); // Sub: Subtract/X-bit\r
   if (type==3) OpGetFlags(0,1); // Add: X-bit\r
-  if (type==5) OpGetFlags(0,0); // Eor\r
+  if (type==5) OpGetFlagsNZ(1); // Eor\r
   if (type==6) OpGetFlags(1,0); // Cmp: Subtract\r
   ot("\n");\r
 \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
@@ -114,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
@@ -142,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
@@ -177,14 +175,14 @@ 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 = "orr";\r
+  if (type==0) strop = "orrs";\r
   if (type==1) strop = (char *) (dir ? "subs" : "rsbs");\r
-  if (type==4) strop = "and";\r
+  if (type==4) strop = "ands";\r
   if (type==5) strop = "adds";\r
 \r
   if (size==0) asl=",asl #24";\r
@@ -193,15 +191,14 @@ int OpArithReg(int op)
   if (size<2) ot("  mov r0,r0%s\n",asl);\r
   ot("  %s r1,r0,r1%s\n",strop,asl);\r
 \r
-  if ((type&1)==0) ot("  adds r1,r1,#0 ;@ Defines NZ, clears CV\n");\r
-\r
-  OpGetFlags(type==1,type&1); // 1==subtract\r
+  if (type&1) OpGetFlags(type==1,type&1); // add/subtract\r
+  else        OpGetFlagsNZ(1);\r
   ot("\n");\r
 \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
@@ -243,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
@@ -327,9 +324,8 @@ int OpMul(int op)
       ot("\n");\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
-    OpGetFlags(0,0);\r
+    ot("  movs r1,r3,lsl #16 ;@ Clip to 16-bits\n");\r
+    OpGetFlagsNZ(1);\r
 \r
     ot("  mov r1,r1,lsr #16\n");\r
     ot("  orr r1,r1,r2,lsl #16 ;@ Insert remainder\n");\r
@@ -343,13 +339,12 @@ int OpMul(int op)
     ot("  mov r2,r2,%s #16\n",sign?"asr":"lsr");\r
     ot("\n");\r
 \r
-    ot("  mul r1,r2,r0\n");\r
-    ot("  adds r1,r1,#0 ;@ Defines NZ, clears CV\n");\r
-    OpGetFlags(0,0);\r
+    ot("  muls r1,r2,r0\n");\r
+    OpGetFlagsNZ(1);\r
   }\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
@@ -402,80 +397,73 @@ 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_msb_dont_care);\r
+    EaRead (0,     6, sea,0,0x000f,earwt_msb_dont_care);\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
-    ot("  mov r6,r6,asl #24\n");\r
+    EaCalcRead(-1,6,sea,0,0x0007,earwt_msb_dont_care);\r
+    EaCalcRead(11,0,dea,0,0x0e00,earwt_msb_dont_care);\r
   }\r
-  ot("  mov r1,r0,asl #24\n\n");\r
 \r
   ot("  bic r10,r10,#0xb1000000 ;@ clear all flags except old Z\n");\r
 \r
+  ot("  ldr r1,[r7,#0x4c] ;@ Get X bit\n");\r
+  ot("  and r2,r0,#0x0f\n");\r
+  ot("  movs r12,r1,lsl #3 ;@ X into carry\n");\r
+  ot("  and r1,r6,#0x0f\n");\r
   if (type)\r
   {\r
-    ot("  ldr r0,[r7,#0x4c] ;@ Get X bit\n");\r
-    ot("  mov r3,#0x00f00000\n");\r
-    ot("  and r2,r3,r1,lsr #4\n");\r
-    ot("  tst r0,#0x20000000\n");\r
-    ot("  and r0,r3,r6,lsr #4\n");\r
-    ot("  add r0,r0,r2\n");\r
-    ot("  addne r0,r0,#0x00100000\n");\r
-//    ot("  tst r0,#0x00800000\n");\r
-//    ot("  orreq r10,r10,#0x01000000 ;@ Undefined V behavior\n");\r
-    ot("  cmp r0,#0x00900000\n");\r
-    ot("  addhi r0,r0,#0x00600000 ;@ Decimal adjust units\n");\r
-\r
-    ot("  mov r2,r1,lsr #28\n");\r
-    ot("  add r0,r0,r2,lsl #24\n");\r
-    ot("  mov r2,r6,lsr #28\n");\r
-    ot("  add r0,r0,r2,lsl #24\n");\r
-    ot("  cmp r0,#0x09900000\n");\r
+    // abcd\r
+    ot("  adc r1,r2,r1\n");\r
+    ot("  cmp r1,#9\n");\r
+\r
+    ot("  and r0,r0,#0xf0\n");\r
+    ot("  and r6,r6,#0xf0\n");\r
+    ot("  add r1,r1,r0\n");\r
+    ot("  add r1,r1,r6\n");\r
+    ot("  mov r12,r1\n");\r
+    ot("  addhi r12,r12,#6 ;@ Decimal adjust units\n");\r
+    ot("  tst r1,#0x80\n");\r
+    ot("  orreq r10,r10,#0x10000000 ;@ Undefined V behavior\n");\r
+    ot("  cmp r12,#0x9f\n");\r
     ot("  orrhi r10,r10,#0x20000000 ;@ C\n");\r
-    ot("  subhi r0,r0,#0x0a000000\n");\r
-//    ot("  and r3,r10,r0,lsr #3 ;@ Undefined V behavior part II\n");\r
-//    ot("  orr r10,r10,r3,lsl #4 ;@ V\n");\r
-    ot("  movs r0,r0,lsl #4\n");\r
-    ot("  orrmi r10,r10,#0x90000000 ;@ Undefined N+V behavior\n"); // this is what Musashi really does\r
-    ot("  bicne r10,r10,#0x40000000 ;@ Z flag\n");\r
+    ot("  subhi r12,r12,#0xa0\n");\r
+    ot("  movs r0,r12,lsl #24\n");\r
+    ot("  bicpl r10,r10,#0x10000000 ;@ Undefined V behavior part II\n");\r
   }\r
   else\r
   {\r
-    ot("  ldr r0,[r7,#0x4c] ;@ Get X bit\n");\r
-    ot("  mov r3,#0x00f00000\n");\r
-    ot("  and r2,r3,r6,lsr #4\n");\r
-    ot("  tst r0,#0x20000000\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("  tst r0,#0x00800000\n");\r
-//    ot("  orreq r10,r10,#0x01000000 ;@ Undefined V behavior\n");\r
-    ot("  cmp r0,#0x00900000\n");\r
-    ot("  subhi r0,r0,#0x00600000 ;@ Decimal adjust units\n");\r
-\r
-    ot("  mov r2,r1,lsr #28\n");\r
-    ot("  add r0,r0,r2,lsl #24\n");\r
-    ot("  mov r2,r6,lsr #28\n");\r
-    ot("  sub r0,r0,r2,lsl #24\n");\r
-    ot("  cmp r0,#0x09900000\n");\r
-    ot("  orrhi r10,r10,#0xa0000000 ;@ N and C\n");\r
-    ot("  addhi r0,r0,#0x0a000000\n");\r
-//    ot("  and r3,r10,r0,lsr #3 ;@ Undefined V behavior part II\n");\r
-//    ot("  orr r10,r10,r3,lsl #4 ;@ V\n");\r
-    ot("  movs r0,r0,lsl #4\n");\r
-//    ot("  orrmi r10,r10,#0x80000000 ;@ Undefined N behavior\n");\r
-    ot("  bicne r10,r10,#0x40000000 ;@ Z flag\n");\r
+    // sbcd\r
+    ot("  mov r12,#0 ;@ corf\n");\r
+    ot("  adc r1,r1,#0\n");\r
+    ot("  sub r1,r2,r1\n");\r
+    ot("  cmp r1,#0x0f\n");\r
+    ot("  movhi r12,#6\n");\r
+\r
+    ot("  and r0,r0,#0xf0\n");\r
+    ot("  and r6,r6,#0xf0\n");\r
+    ot("  add r1,r1,r0\n");\r
+    ot("  sub r1,r1,r6\n");\r
+    ot("  tst r1,#0x80\n");\r
+    ot("  orrne r10,r10,#0x10000000 ;@ Undefined V behavior\n");\r
+    ot("  cmp r1,r12\n");\r
+    ot("  orrlt r10,r10,#0x20000000 ;@ C\n");\r
+    ot("  cmp r1,#0xff\n");\r
+    ot("  addhi r1,r1,#0xa0\n");\r
+    ot("  sub r12,r1,r12\n");\r
+    ot("  movs r0,r12,lsl #24\n");\r
+    ot("  bicmi r10,r10,#0x10000000 ;@ Undefined V behavior part II\n");\r
   }\r
 \r
+  ot("  orrmi r10,r10,#0x80000000 ;@ Undefined N behavior\n");\r
+  ot("  bicne r10,r10,#0x40000000 ;@ Z flag\n");\r
   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
@@ -499,37 +487,34 @@ 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(11,0,ea,0,0x003f,earwt_zero_extend);\r
 \r
   // this is rewrite of Musashi's code\r
   ot("  ldr r2,[r7,#0x4c]\n");\r
   ot("  bic r10,r10,#0xb0000000 ;@ clear all flags, except Z\n");\r
-  ot("  mov r0,r0,asl #24\n");\r
   ot("  and r2,r2,#0x20000000\n");\r
-  ot("  add r2,r0,r2,lsr #5 ;@ add X\n");\r
-  ot("  rsb r11,r2,#0x9a000000 ;@ do arithmetic\n");\r
+  ot("  rsb r1,r0,#0 ;@ do arithmetic\n");\r
+  ot("  subs r1,r1,r2,lsr #29 ;@ X\n");\r
 \r
-  ot("  cmp r11,#0x9a000000\n");\r
   ot("  beq finish%.4x\n",op);\r
   ot("\n");\r
 \r
-  ot("  mvn r3,r11,lsr #31 ;@ Undefined V behavior\n",op);\r
-  ot("  and r2,r11,#0x0f000000\n");\r
-  ot("  cmp r2,#0x0a000000\n");\r
-  ot("  andeq r11,r11,#0xf0000000\n");\r
-  ot("  addeq r11,r11,#0x10000000\n");\r
-  ot("  and r3,r3,r11,lsr #31 ;@ Undefined V behavior part II\n",op);\r
-  ot("  movs r1,r11,asr #24\n");\r
+  ot("  movs r1,r1,lsl #24\n");\r
+  ot("  orrmi r10,r10,#0x10000000 ;@ Undefined V behavior\n");\r
+  ot("  orr r2,r1,r0,lsl #24\n");\r
+  ot("  tst r2,#0x0f000000\n");\r
+  ot("  andeq r1,r1,#0xf0000000\n");\r
+  ot("  orreq r1,r1,#0x06000000\n");\r
+  ot("  adds r1,r1,#0x9a000000\n");\r
+  ot("  bicmi r10,r10,#0x10000000 ;@ Undefined V behavior part II\n");\r
+  ot("  orrmi r10,r10,#0x80000000 ;@ Undefined N behavior\n");\r
   ot("  bicne r10,r10,#0x40000000 ;@ Z\n");\r
-  ot("  orr r10,r10,r3,lsl #28 ;@ save V\n",op);\r
   ot("  orr r10,r10,#0x20000000 ;@ C\n");\r
   ot("\n");\r
 \r
-  EaWrite(6, 1, ea,0,0x3f,0,0);\r
+  EaWrite(11, 1, ea,0,0x3f,earwt_shifted_up);\r
 \r
   ot("finish%.4x%s\n",op,ms?"":":");\r
-  ot("  tst r11,r11\n");\r
-  ot("  orrmi r10,r10,#0x80000000 ;@ N\n");\r
   ot("  str r10,[r7,#0x4c] ;@ Save X\n");\r
   ot("\n");\r
 \r
@@ -569,14 +554,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
@@ -628,15 +613,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
@@ -665,7 +650,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
@@ -707,26 +692,28 @@ 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
 \r
   ot(";@ Do arithmetic:\n");\r
-  if (eor==0) ot("  rsbs r1,r0,r1%s\n",asl);\r
   if (eor)\r
   {\r
-    ot("  eor r1,r0,r1%s\n",asl);\r
-    ot("  adds r1,r1,#0 ;@ Defines NZ, clears CV\n");\r
+    ot("  eors r1,r0,r1%s\n",asl);\r
+    OpGetFlagsNZ(1);\r
+  }\r
+  else\r
+  {\r
+    ot("  rsbs r1,r0,r1%s\n",asl);\r
+    OpGetFlags(1,0); // Cmp like subtract\r
   }\r
-\r
-  OpGetFlags(eor==0,0); // Cmp like subtract\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
@@ -751,11 +738,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
@@ -794,24 +781,24 @@ 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
-  if (size<2) ot("  mov r1,r1,asl #%d\n\n",size?16:24);\r
+\r
+  if (size<2) ot("  movs r1,r1,asl #%d\n\n",size?16:24);\r
+  else        ot("  adds r1,r1,#0 ;@ Define flags\n");\r
 \r
   ot(";@ get flags, including undocumented ones\n");\r
   ot("  and r3,r10,#0x80000000\n");\r
-  ot("  adds r1,r1,#0 ;@ Defines NZ, clears CV\n");\r
-  OpGetFlags(0,0);\r
+  OpGetFlagsNZ(1);\r
 \r
   ot(";@ is reg negative?\n");\r
   ot("  bmi chktrap%.4x\n",op);\r
 \r
   ot(";@ Do arithmetic:\n");\r
-  ot("  bic r10,r10,#0x80000000 ;@ N\n");\r
   ot("  cmp r1,r0\n");\r
   ot("  bgt chktrap%.4x\n",op);\r
 \r
@@ -828,3 +815,4 @@ int OpChk(int op)
   return 0;\r
 }\r
 \r
+// vim:ts=2:sw=2:expandtab\r