{\r
char text[32]="";\r
int shift=0;\r
- \r
+ \r
shift=32-(8<<size);\r
\r
DisaPc=2; DisaGetEa(text,ea,size); // Get text version of the effective address\r
\r
if (ea<0x10)\r
{\r
- int lsl=0,low=0,i;\r
+ int lsl=0,low=0,nsarm=size&3,i;\r
if (size>=2||(size==0&&(top||!sign_extend))) {\r
if(mask)\r
for (i=mask|0x8000; (i&1)==0; i>>=1) low++; // Find out how high up the EA mask is\r
lsl=2-low; // Having a lsl #2 here saves one opcode\r
}\r
\r
+ if (top) nsarm=3;\r
+\r
ot(";@ EaRead : Read register[r%d] into r%d:\n",a,v);\r
\r
- if (lsl>0) ot(" ldr%s r%d,[r7,r%d,lsl #%i]\n",Narm[size&3],v,a,lsl);\r
- else if (lsl<0) ot(" ldr%s r%d,[r7,r%d,lsr #%i]\n",Narm[size&3],v,a,-lsl);\r
- else ot(" ldr%s r%d,[r7,r%d]\n",Sarm[size&3],v,a);\r
+ if (lsl>0) ot(" ldr%s r%d,[r7,r%d,lsl #%i]\n",Narm[nsarm],v,a,lsl);\r
+ else if (lsl<0) ot(" ldr%s r%d,[r7,r%d,lsr #%i]\n",Narm[nsarm],v,a,-lsl);\r
+ else ot(" ldr%s r%d,[r7,r%d]\n",Sarm[nsarm],v,a);\r
\r
- if (top && shift) ot(" mov r%d,r%d,asl #%d\n",v,v,shift);\r
+ if (top&&shift) ot(" mov r%d,r%d,asl #%d\n",v,v,shift);\r
\r
ot("\n"); return 0;\r
}\r
{\r
int lsr=9-shift;\r
\r
- if (lsr>=0) ot(" mov r2,r8,lsr #%d ;@ Get quick value\n", lsr);\r
- else ot(" mov r2,r8,lsl #%d ;@ Get quick value\n",-lsr);\r
+ ot(" and r2,r8,#0x0e00 ;@ Get quick value\n");\r
+\r
+ if (lsr>=0) sprintf(count,"r2,lsr #%d", lsr);\r
+ else sprintf(count,"r2,lsl #%d", -lsr);\r
\r
- ot(" and r2,r2,#0x%.4x\n",7<<shift);\r
ot("\n");\r
- strcpy(count,"r2");\r
}\r
-\r
- if (num==8) sprintf(count,"#0x%.4x",8<<shift);\r
+ else\r
+ {\r
+ sprintf(count,"#0x%.4x",8<<shift);\r
+ }\r
\r
if (type==0) ot(" adds r1,r0,%s\n",count);\r
if (type==1) ot(" subs r1,r0,%s\n",count);\r
if (op!=use) { OpUse(op,use); return 0; } // Use existing handler\r
OpStart(op);\r
\r
- if (cc>=2)\r
+ switch (cc)\r
{\r
- ot(";@ Is the condition true?\n");\r
- if ((cc&~1)==2) ot(" eor r9,r9,#0x20000000 ;@ Invert carry for hi/ls\n");\r
- ot(" msr cpsr_flg,r9 ;@ ARM flags = 68000 flags\n");\r
- if ((cc&~1)==2) ot(" eor r9,r9,#0x20000000\n");\r
- ot(";@ If so, don't dbra\n");\r
- ot(" b%s DbraTrue%.4x\n",Cond[cc],op);\r
- ot("\n");\r
+ case 0: // T\r
+ case 1: // F\r
+ break;\r
+ case 2: // hi\r
+ ot(" tst r9,#0x60000000 ;@ hi: !C && !Z\n");\r
+ ot(" beq DbraTrue%.4x\n\n",op);\r
+ break;\r
+ case 3: // ls\r
+ ot(" tst r9,#0x60000000 ;@ ls: C || Z\n");\r
+ ot(" bne DbraTrue%.4x\n\n",op);\r
+ break;\r
+ default:\r
+ ot(";@ Is the condition true?\n");\r
+ ot(" msr cpsr_flg,r9 ;@ ARM flags = 68000 flags\n");\r
+ ot(";@ If so, don't dbra\n");\r
+ ot(" b%s DbraTrue%.4x\n\n",Cond[cc],op);\r
+ break;\r
}\r
\r
- ot(";@ Decrement Dn.w\n");\r
- ot(" and r1,r8,#0x0007\n");\r
- ot(" mov r1,r1,lsl #2\n");\r
- ot(" ldrsh r0,[r7,r1]\n");\r
- ot(" sub r0,r0,#1\n");\r
- ot(" strh r0,[r7,r1]\n");\r
- ot("\n");\r
+ if (cc!=0)\r
+ {\r
+ ot(";@ Decrement Dn.w\n");\r
+ ot(" and r1,r8,#0x0007\n");\r
+ ot(" mov r1,r1,lsl #2\n");\r
+ ot(" ldrsh r0,[r7,r1]\n");\r
+ ot(" sub r0,r0,#1\n");\r
+ ot(" strh r0,[r7,r1]\n");\r
+ ot("\n");\r
\r
- ot(";@ Check if Dn.w is -1\n");\r
- ot(" cmps r0,#-1\n");\r
- ot(" beq DbraMin1%.4x\n",op);\r
- ot("\n");\r
+ ot(";@ Check if Dn.w is -1\n");\r
+ ot(" cmn r0,#1\n");\r
+ ot("\n");\r
\r
- ot(";@ Get Branch offset:\n");\r
- ot(" ldrsh r0,[r4]\n");\r
- ot(" add r4,r4,r0 ;@ r4 = New PC\n");\r
- ot("\n");\r
- Cycles=12-2;\r
- OpEnd();\r
+ ot(";@ Get Branch offset:\n");\r
+ ot(" ldrnesh r0,[r4]\n");\r
+ ot(" addeq r4,r4,#2 ;@ Skip branch offset\n");\r
+ ot(" subeq r5,r5,#4 ;@ additional cycles\n");\r
+ ot(" addne r4,r4,r0 ;@ r4 = New PC\n");\r
+ ot("\n");\r
+ Cycles=12-2;\r
+ OpEnd();\r
+ }\r
\r
- ot(";@ Dn.w is -1:\n");\r
- ot("DbraMin1%.4x%s\n", op, ms?"":":");\r
- ot(" add r4,r4,#2 ;@ Skip branch offset\n");\r
- ot("\n");\r
- Cycles=12+2;\r
- OpEnd();\r
-\r
- ot(";@ condition true:\n");\r
- ot("DbraTrue%.4x%s\n", op, ms?"":":");\r
- ot(" add r4,r4,#2 ;@ Skip branch offset\n");\r
- ot("\n");\r
- Cycles=12;\r
- OpEnd();\r
+ if (cc==0||cc>=2)\r
+ {\r
+ ot(";@ condition true:\n");\r
+ ot("DbraTrue%.4x%s\n", op, ms?"":":");\r
+ ot(" add r4,r4,#2 ;@ Skip branch offset\n");\r
+ ot("\n");\r
+ Cycles=12;\r
+ OpEnd();\r
+ }\r
\r
return 0;\r
}\r