X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?p=cyclone68000.git;a=blobdiff_plain;f=OpMove.cpp;h=8022da16597c6bf788ee13dabdd75597cd69641f;hp=82c589c0d4f24ae29a6855483d71431e3c281780;hb=HEAD;hpb=3504ce942735ae4283cd47ca6defaae87b550c57 diff --git a/OpMove.cpp b/OpMove.cpp index 82c589c..8022da1 100644 --- a/OpMove.cpp +++ b/OpMove.cpp @@ -96,6 +96,7 @@ void SuperChange(int op,int srh_reg) // Emit a Move opcode, 00xxdddd ddssssss int OpMove(int op) { + EaRWType eatype; int sea=0,tea=0; int size=0,use=0; int movea=0; @@ -133,30 +134,42 @@ int OpMove(int op) if (movea==0) { - EaCalcRead(-1,1,sea,size,0x003f,1,1); - OpGetFlagsNZ(1); + if (sea < 0x10 && size < 2) + { + eatype = earwt_zero_extend; + EaCalcRead(-1,1,sea,size,0x003f,eatype); + ot(" movs r2,r1,lsl #%d\n",size?16:24); + OpGetFlagsNZ(2); + } + else + { + eatype = earwt_shifted_up; + EaCalcRead(-1,1,sea,size,0x003f,eatype,1); + OpGetFlagsNZ(1); + } ot("\n"); } else { - EaCalcRead(-1,1,sea,size,0x003f); + eatype = earwt_sign_extend; + EaCalcRead(-1,1,sea,size,0x003f,eatype); size=2; // movea always expands to 32-bits } eawrite_check_addrerr=1; #if SPLIT_MOVEL_PD if ((tea&0x38)==0x20 && size==2) { // -(An) - EaCalc (8,0x0e00,tea,size,0,0); + EaCalc (8,0x0e00,tea,size,earwt_msb_dont_care); ot(" mov r11,r1\n"); ot(" add r0,r8,#2\n"); - EaWrite(0, 1,tea,1,0x0e00,0,0); - EaWrite(8, 11,tea,1,0x0e00,1); + EaWrite(0, 1,tea,1,0x0e00,earwt_msb_dont_care); + EaWrite(8, 11,tea,1,0x0e00,earwt_shifted_up); } else #endif { - EaCalc (0,0x0e00,tea,size,0,0); - EaWrite(0, 1,tea,size,0x0e00,0,0); + EaCalc (0,0x0e00,tea,size,eatype); + EaWrite(0, 1,tea,size,0x0e00,eatype); } #if CYCLONE_FOR_GENESIS && !MEMHANDLERS_CHANGE_CYCLES @@ -239,13 +252,13 @@ int OpMoveSr(int op) { eawrite_check_addrerr=1; OpFlagsToReg(type==0); - EaCalc (0,0x003f,ea,size,0,0); - EaWrite(0, 1,ea,size,0x003f,0,0); + EaCalc (0,0x003f,ea,size,earwt_msb_dont_care); + EaWrite(0, 1,ea,size,0x003f,earwt_msb_dont_care); } if (type==2 || type==3) { - EaCalcReadNoSE(-1,0,ea,size,0x003f); + EaCalcRead(-1,0,ea,size,0x003f,earwt_msb_dont_care); OpRegToFlags(type==3,1); if (type==3) { SuperChange(op,1); @@ -278,7 +291,7 @@ int OpArithSr(int op) OpStart(op,ea,0,0,size!=0); Cycles=16; - EaCalcRead(-1,0,ea,size,0x003f); + EaCalcRead(-1,0,ea,size,0x003f,earwt_sign_extend); ot(" eor r1,r0,r0,ror #1 ;@ Bit 0=C^V\n"); ot(" tst r1,#1 ;@ 1 if C!=V\n"); @@ -392,10 +405,8 @@ int OpMovem(int op) ot(";@ Get the address into r6:\n"); EaCalc(6,0x003f,cea,size); -#if !MEMHANDLERS_NEED_PREV_PC // must save PC, need a spare register - ot(" str r4,[r7,#0x40] ;@ Save PC\n"); -#endif + FlushPC(1); ot(";@ r4=Register Index*4:\n"); if (decr) ot(" mov r4,#0x40 ;@ order reversed for -(An)\n"); @@ -423,22 +434,22 @@ int OpMovem(int op) if (dir) { - ot(" ;@ Copy memory to register:\n",1<