From 8b9d21443e30fd1da7df11aa6d1c903cb954d6f0 Mon Sep 17 00:00:00 2001 From: notaz Date: Sun, 16 Jun 2013 19:43:12 +0300 Subject: [PATCH] disa improvements from PicoDrive --- Disa/Disa.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 49 insertions(+), 2 deletions(-) diff --git a/Disa/Disa.c b/Disa/Disa.c index 01a54bc..562929b 100644 --- a/Disa/Disa.c +++ b/Disa/Disa.c @@ -283,6 +283,21 @@ static int DisaMoveSr(int op) return 0; } +static int OpChk(int op) +{ + int sea=0,dea=0; + char seat[64]="",deat[64]=""; + + sea=op&0x003f; + DisaGetEa(seat,sea,0); + + dea=(op>>9)&7; dea|=8; + DisaGetEa(deat,dea,2); + + sprintf(DisaText,"chk %s, %s",seat,deat); + return 0; +} + // ================ Opcodes 0x41c0+ ================ static int DisaLea(int op) { @@ -337,6 +352,20 @@ static int MakeRegList(char *list,int mask,int ea) return 0; } +// ================ Opcodes 0x4800+ ================ +static int DisaNbcd(int op) +{ + // Nbcd 01001000 00eeeeee (eeeeee=ea) + int ea=0; + char eat[64]=""; + + ea=op&0x003f; + DisaGetEa(eat,ea,0); + + sprintf(DisaText,"nbcd %s",eat); + return 0; +} + // ================ Opcodes 0x4840+ ================ static int DisaSwap(int op) { @@ -476,6 +505,19 @@ static int DisaTst(int op) return 0; } +static int DisaTas(int op) +{ + // Tas 01001010 11eeeeee (eeeeee=ea) + int ea=0; + char eat[64]=""; + + ea=op&0x003f; + DisaGetEa(eat,ea,0); + + sprintf(DisaText,"tas %s",eat); + return 0; +} + // ================ Opcodes 0x4e80+ ================ static int DisaJsr(int op) { @@ -741,14 +783,16 @@ static int DisaExg(int op) static int DisaAddx(int op) { // 1t01ddd1 xx000sss addx - int type=0,size=0,dea=0,sea=0; + int type=0,size=0,dea=0,sea=0,mem; char deat[64]="",seat[64]=""; char *opcode[6]={"","subx","","","","addx"}; type=(op>>12)&5; dea =(op>> 9)&7; size=(op>> 6)&3; if (size>=3) return 1; - sea = op&0x3f; + sea = op&7; + mem = op&8; + if(mem) { sea+=0x20; dea+=0x20; } DisaGetEa(deat,dea,size); DisaGetEa(seat,sea,size); @@ -805,13 +849,16 @@ static int TryOp(int op) if ((op&0xff00)==0x0800) DisaBtstImm(op); // Btst/Bchg/Bclr/Bset if ((op&0xc000)==0x0000) DisaMove(op); if ((op&0xf900)==0x4000) DisaNeg(op); // Negx/Clr/Neg/Not + if ((op&0xf140)==0x4100) OpChk(op); if ((op&0xf1c0)==0x41c0) DisaLea(op); if ((op&0xf9c0)==0x40c0) DisaMoveSr(op); + if ((op&0xffc0)==0x4800) DisaNbcd(op); if ((op&0xfff8)==0x4840) DisaSwap(op); if ((op&0xffc0)==0x4840) DisaPea(op); if ((op&0xffb8)==0x4880) DisaExt(op); if ((op&0xfb80)==0x4880) DisaMovem(op); if ((op&0xff00)==0x4a00) DisaTst(op); + if ((op&0xffc0)==0x4ac0) DisaTas(op); if ((op&0xfff0)==0x4e40) DisaTrap(op); if ((op&0xfff8)==0x4e50) DisaLink(op); if ((op&0xfff8)==0x4e58) DisaUnlk(op); -- 2.39.2