// --------------------- Opcodes 0x0108+ ---------------------
// movep.x (Aa),Dn - 0000nnn1 dx001aaa nn
int OpMovep(int op)
{
int nea=0,dir=0,size=0,ea=0;
int use=0,bytes=0,i=0;
nea =(op>>9)&7;
dir =(op>>7)&1;
size=(op>>6)&1; size++;
bytes=1<<size;
ea =0x10|(op&7);
use=op&~0x0e07;
if (op!=use) { OpUse(op,use); return 0; } // Use existing handler
OpStart(op); Cycles=20;
EaCalc(11,0x0007, ea,size);
ot("\n");
EaCalc( 0, 0, 0x3c,1);
EaRead( 0, 0, 0x3c,1,0);
ot(" add r11,r11,r0 ;@ Add on address offset\n\n");
if (dir==0)
{
ot(";@ Get bytes from address r11, r11+2, etc:\n\n");
EaRead (11, 10, ea,0,1);
for (i=1;i<bytes;i++)
{
ot(" add r11,r11,#2\n\n");
EaRead (11, 0, ea,0,1);
ot(" orr r10,r10,r0,lsr #%d\n",i*8);
}
ot("\n");
ot(";@ Save the value into the data register:\n");
EaCalc (0,0x0e00,nea,size);
EaWrite(0, 10,nea,size,1);
}
if (dir)
{
ot(";@ Get the value from the data register:\n");
EaCalc (0,0x0e00,nea,size);
EaRead (0, 10,nea,size,1);
ot(";@ Save bytes into address r11, r11+2, etc:\n\n");
for (i=0;i<bytes;i++)
{
EaWrite(11, 10, ea,0,1);
if (i<bytes-1)
{
ot(" add r11,r11,#2\n");
ot(" mov r10,r10,lsl #8\n\n");
}
}
}
OpEnd();
return 0;
}