X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?p=cyclone68000.git;a=blobdiff_plain;f=OpBranch.cpp;h=9a7c8da37aa32233468471e063348a8cce6017ab;hp=fb4f56166eead278055208999acefb95d3e6be36;hb=HEAD;hpb=c6237d9e43c8a8854155757b80b77161a9570535 diff --git a/OpBranch.cpp b/OpBranch.cpp index fb4f561..9a7c8da 100644 --- a/OpBranch.cpp +++ b/OpBranch.cpp @@ -113,8 +113,8 @@ int OpLink(int op) if(reg!=7) { ot(";@ Get An\n"); - EaCalc(11, 7, 8, 2, 1); - EaRead(11, 1, 8, 2, 7, 1); + EaCalc(11, 7, 8, 2); + EaRead(11, 1, 8, 2, 7); } ot(" ldr r0,[r7,#0x3c] ;@ Get A7\n"); @@ -128,7 +128,7 @@ int OpLink(int op) ot(";@ Save to An\n"); if(reg!=7) - EaWrite(11,8, 8, 2, 7, 1); + EaWrite(11, 8, 8, 2, 7); ot(";@ Get offset:\n"); EaCalc(0,0,0x3c,1); // abused r8 is ok because of imm EA @@ -154,8 +154,8 @@ int OpUnlk(int op) OpStart(op,0x10); ot(";@ Get An\n"); - EaCalc(11, 0xf, 8, 2, 1); - EaRead(11, 0, 8, 2, 0xf, 1); + EaCalc(11, 0xf, 8, 2); + EaRead(11, 0, 8, 2, 0xf); ot(" add r8,r0,#4 ;@ A7+=4, abuse r8\n"); ot("\n"); @@ -165,7 +165,7 @@ int OpUnlk(int op) ot(" str r8,[r7,#0x3c] ;@ Save A7\n"); ot("\n"); ot(";@ An = value from stack:\n"); - EaWrite(11, 0, 8, 2, 7, 1); + EaWrite(11, 0, 8, 2, 7); Cycles=12; OpEnd(0x10); @@ -312,6 +312,7 @@ static const char * const Cond[16]= // Emit a Dbra opcode, 0101cccc 11001nnn vv int OpDbra(int op) { + const char *cond; int use=0; int cc=0; @@ -321,25 +322,12 @@ int OpDbra(int op) if (op!=use) { OpUse(op,use); return 0; } // Use existing handler OpStart(op); - switch (cc) + if (cc>=2) { - case 0: // T - case 1: // F - break; - case 2: // hi - ot(" tst r10,#0x60000000 ;@ hi: !C && !Z\n"); - ot(" beq DbraTrue\n\n"); - break; - case 3: // ls - ot(" tst r10,#0x60000000 ;@ ls: C || Z\n"); - ot(" bne DbraTrue\n\n"); - break; - default: - ot(";@ Is the condition true?\n"); - ot(" msr cpsr_flg,r10 ;@ ARM flags = 68000 flags\n"); - ot(";@ If so, don't dbra\n"); - ot(" b%s DbraTrue\n\n",Cond[cc]); - break; + ot(";@ Is the condition true?\n"); + cond=TestCond(cc); + ot(";@ If so, don't dbra\n"); + ot(" b%s DbraTrue\n\n",cond); } if (cc!=0) @@ -419,6 +407,7 @@ int OpBranch(int op) int offset=0; int cc=0; const char *asr_r11=""; + const char *cond; int pc_reg=0; offset=(char)(op&0xff); @@ -436,24 +425,10 @@ int OpBranch(int op) OpStart(op,size?0x10:0); Cycles=10; // Assume branch taken - switch (cc) + if (cc>=2) { - case 0: // T - case 1: // F - break; - case 2: // hi - ot(" tst r10,#0x60000000 ;@ hi: !C && !Z\n"); - ot(" bne BccDontBranch%i\n\n",8<