|
|
1.1 ! root 1: /* ! 2: DSP M56001 emulation ! 3: Disassembler ! 4: ! 5: (C) 2003-2008 ARAnyM developer team ! 6: ! 7: This program is free software; you can redistribute it and/or modify ! 8: it under the terms of the GNU General Public License as published by ! 9: the Free Software Foundation; either version 2 of the License, or ! 10: (at your option) any later version. ! 11: ! 12: This program is distributed in the hope that it will be useful, ! 13: but WITHOUT ANY WARRANTY; without even the implied warranty of ! 14: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! 15: GNU General Public License for more details. ! 16: ! 17: You should have received a copy of the GNU General Public License ! 18: along with this program; if not, write to the Free Software ! 19: Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! 20: */ ! 21: ! 22: #ifdef HAVE_CONFIG_H ! 23: #include "config.h" ! 24: #endif ! 25: ! 26: #include <string.h> ! 27: #include <inttypes.h> ! 28: #include <stdbool.h> ! 29: #include <stdio.h> ! 30: ! 31: #include "dsp_core.h" ! 32: #include "dsp_cpu.h" ! 33: #include "dsp_disasm.h" ! 34: #include "profile.h" ! 35: ! 36: ! 37: /* More disasm infos, if wanted */ ! 38: #define DSP_DISASM_REG_PC 0 ! 39: ! 40: /********************************** ! 41: * Defines ! 42: **********************************/ ! 43: ! 44: /********************************** ! 45: * Variables ! 46: **********************************/ ! 47: ! 48: /* Current instruction */ ! 49: static Uint32 cur_inst; ! 50: static Uint16 disasm_cur_inst_len; ! 51: static char str_instr[50]; ! 52: static char str_instr2[120]; ! 53: static char parallelmove_name[64]; ! 54: ! 55: /* Previous instruction */ ! 56: static Uint32 prev_inst_pc; ! 57: static bool isLooping; ! 58: ! 59: /* Used to display dc instead of unknown instruction for illegal opcodes */ ! 60: static bool isInDisasmMode; ! 61: ! 62: void dsp56k_disasm_init(void) ! 63: { ! 64: prev_inst_pc = 0x10000; /* Init to an invalid value */ ! 65: isLooping = false; ! 66: isInDisasmMode = false; ! 67: } ! 68: ! 69: /********************************** ! 70: * Register change ! 71: **********************************/ ! 72: ! 73: static Uint32 registers_save[64]; ! 74: #if DSP_DISASM_REG_PC ! 75: static Uint32 pc_save; ! 76: #endif ! 77: ! 78: static const char *registers_name[64]={ ! 79: "","","","", ! 80: "x0","x1","y0","y1", ! 81: "a0","b0","a2","b2", ! 82: "a1","b1","a","b", ! 83: ! 84: "r0","r1","r2","r3", ! 85: "r4","r5","r6","r7", ! 86: "n0","n1","n2","n3", ! 87: "n4","n5","n6","n7", ! 88: ! 89: "m0","m1","m2","m3", ! 90: "m4","m5","m6","m7", ! 91: "","","","", ! 92: "","","","", ! 93: ! 94: "","","","", ! 95: "","","","", ! 96: "","sr","omr","sp", ! 97: "ssh","ssl","la","lc" ! 98: }; ! 99: ! 100: /********************************** ! 101: * Opcode disassembler ! 102: **********************************/ ! 103: ! 104: static Uint32 read_memory(Uint32 currPc); ! 105: ! 106: typedef void (*dsp_emul_t)(void); ! 107: ! 108: static void opcode8h_0(void); ! 109: ! 110: static int dsp_calc_ea(Uint32 ea_mode, char *dest); ! 111: static void dsp_calc_cc(Uint32 cc_mode, char *dest); ! 112: static void dsp_undefined(void); ! 113: ! 114: /* Instructions without parallel moves */ ! 115: static void dsp_andi(void); ! 116: static void dsp_bchg_aa(void); ! 117: static void dsp_bchg_ea(void); ! 118: static void dsp_bchg_pp(void); ! 119: static void dsp_bchg_reg(void); ! 120: static void dsp_bclr_aa(void); ! 121: static void dsp_bclr_ea(void); ! 122: static void dsp_bclr_pp(void); ! 123: static void dsp_bclr_reg(void); ! 124: static void dsp_bset_aa(void); ! 125: static void dsp_bset_ea(void); ! 126: static void dsp_bset_pp(void); ! 127: static void dsp_bset_reg(void); ! 128: static void dsp_btst_aa(void); ! 129: static void dsp_btst_ea(void); ! 130: static void dsp_btst_pp(void); ! 131: static void dsp_btst_reg(void); ! 132: static void dsp_div(void); ! 133: static void dsp_enddo(void); ! 134: static void dsp_illegal(void); ! 135: static void dsp_jcc_imm(void); ! 136: static void dsp_jcc_ea(void); ! 137: static void dsp_jclr_aa(void); ! 138: static void dsp_jclr_ea(void); ! 139: static void dsp_jclr_pp(void); ! 140: static void dsp_jclr_reg(void); ! 141: static void dsp_jmp_ea(void); ! 142: static void dsp_jmp_imm(void); ! 143: static void dsp_jscc_ea(void); ! 144: static void dsp_jscc_imm(void); ! 145: static void dsp_jsclr_aa(void); ! 146: static void dsp_jsclr_ea(void); ! 147: static void dsp_jsclr_pp(void); ! 148: static void dsp_jsclr_reg(void); ! 149: static void dsp_jset_aa(void); ! 150: static void dsp_jset_ea(void); ! 151: static void dsp_jset_pp(void); ! 152: static void dsp_jset_reg(void); ! 153: static void dsp_jsr_ea(void); ! 154: static void dsp_jsr_imm(void); ! 155: static void dsp_jsset_aa(void); ! 156: static void dsp_jsset_ea(void); ! 157: static void dsp_jsset_pp(void); ! 158: static void dsp_jsset_reg(void); ! 159: static void dsp_lua(void); ! 160: static void dsp_movem_ea(void); ! 161: static void dsp_movem_aa(void); ! 162: static void dsp_nop(void); ! 163: static void dsp_norm(void); ! 164: static void dsp_ori(void); ! 165: static void dsp_reset(void); ! 166: static void dsp_rti(void); ! 167: static void dsp_rts(void); ! 168: static void dsp_stop(void); ! 169: static void dsp_swi(void); ! 170: static void dsp_tcc(void); ! 171: static void dsp_wait(void); ! 172: static void dsp_do_ea(void); ! 173: static void dsp_do_aa(void); ! 174: static void dsp_do_imm(void); ! 175: static void dsp_do_reg(void); ! 176: static void dsp_rep_aa(void); ! 177: static void dsp_rep_ea(void); ! 178: static void dsp_rep_imm(void); ! 179: static void dsp_rep_reg(void); ! 180: static void dsp_movec_aa(void); ! 181: static void dsp_movec_ea(void); ! 182: static void dsp_movec_imm(void); ! 183: static void dsp_movec_reg(void); ! 184: static void dsp_movep_0(void); ! 185: static void dsp_movep_1(void); ! 186: static void dsp_movep_23(void); ! 187: ! 188: /* Parallel moves */ ! 189: static void dsp_pm_class2(void); ! 190: static void dsp_pm(void); ! 191: static void dsp_pm_0(void); ! 192: static void dsp_pm_1(void); ! 193: static void dsp_pm_2(void); ! 194: static void dsp_pm_4(void); ! 195: static void dsp_pm_8(void); ! 196: ! 197: ! 198: static const dsp_emul_t opcodes8h[512] = { ! 199: /* 0x00 - 0x3f */ ! 200: opcode8h_0, dsp_undefined, dsp_undefined, dsp_undefined, opcode8h_0, dsp_andi, dsp_undefined, dsp_ori, ! 201: dsp_undefined, dsp_undefined, dsp_undefined, dsp_undefined, dsp_undefined, dsp_andi, dsp_undefined, dsp_ori, ! 202: dsp_undefined, dsp_undefined, dsp_undefined, dsp_undefined, dsp_undefined, dsp_andi, dsp_undefined, dsp_ori, ! 203: dsp_undefined, dsp_undefined, dsp_undefined, dsp_undefined, dsp_undefined, dsp_andi, dsp_undefined, dsp_ori, ! 204: dsp_undefined, dsp_undefined, dsp_undefined, dsp_undefined, dsp_undefined, dsp_undefined, dsp_undefined, dsp_undefined, ! 205: dsp_undefined, dsp_undefined, dsp_undefined, dsp_undefined, dsp_undefined, dsp_undefined, dsp_undefined, dsp_undefined, ! 206: dsp_undefined, dsp_undefined, dsp_div, dsp_div, dsp_undefined, dsp_undefined, dsp_undefined, dsp_undefined, ! 207: dsp_norm, dsp_undefined, dsp_undefined, dsp_undefined, dsp_undefined, dsp_undefined, dsp_undefined, dsp_undefined, ! 208: ! 209: /* 0x40 - 0x7f */ ! 210: dsp_tcc, dsp_tcc, dsp_tcc, dsp_tcc, dsp_undefined, dsp_undefined, dsp_undefined, dsp_undefined, ! 211: dsp_tcc, dsp_tcc, dsp_tcc, dsp_tcc, dsp_undefined, dsp_undefined, dsp_undefined, dsp_undefined, ! 212: dsp_tcc, dsp_tcc, dsp_tcc, dsp_tcc, dsp_undefined, dsp_undefined, dsp_undefined, dsp_undefined, ! 213: dsp_tcc, dsp_tcc, dsp_tcc, dsp_tcc, dsp_undefined, dsp_undefined, dsp_undefined, dsp_undefined, ! 214: dsp_tcc, dsp_tcc, dsp_tcc, dsp_tcc, dsp_undefined, dsp_undefined, dsp_undefined, dsp_undefined, ! 215: dsp_tcc, dsp_tcc, dsp_tcc, dsp_tcc, dsp_undefined, dsp_undefined, dsp_undefined, dsp_undefined, ! 216: dsp_tcc, dsp_tcc, dsp_tcc, dsp_tcc, dsp_undefined, dsp_undefined, dsp_undefined, dsp_undefined, ! 217: dsp_tcc, dsp_tcc, dsp_tcc, dsp_tcc, dsp_undefined, dsp_undefined, dsp_undefined, dsp_undefined, ! 218: ! 219: /* 0x80 - 0xbf */ ! 220: dsp_undefined, dsp_undefined, dsp_undefined, dsp_undefined, dsp_undefined, dsp_undefined, dsp_undefined, dsp_undefined, ! 221: dsp_lua, dsp_undefined, dsp_undefined, dsp_undefined, dsp_undefined, dsp_movec_reg, dsp_undefined, dsp_undefined, ! 222: dsp_undefined, dsp_undefined, dsp_undefined, dsp_undefined, dsp_undefined, dsp_undefined, dsp_undefined, dsp_undefined, ! 223: dsp_undefined, dsp_undefined, dsp_undefined, dsp_undefined, dsp_undefined, dsp_movec_reg, dsp_undefined, dsp_undefined, ! 224: dsp_undefined, dsp_movec_aa, dsp_undefined, dsp_movec_aa, dsp_undefined, dsp_movec_imm, dsp_undefined, dsp_undefined, ! 225: dsp_undefined, dsp_movec_ea, dsp_undefined, dsp_movec_ea, dsp_undefined, dsp_movec_imm, dsp_undefined, dsp_undefined, ! 226: dsp_undefined, dsp_movec_aa, dsp_undefined, dsp_movec_aa, dsp_undefined, dsp_movec_imm, dsp_undefined, dsp_undefined, ! 227: dsp_undefined, dsp_movec_ea, dsp_undefined, dsp_movec_ea, dsp_undefined, dsp_movec_imm, dsp_undefined, dsp_undefined, ! 228: ! 229: /* 0xc0 - 0xff */ ! 230: dsp_do_aa, dsp_rep_aa, dsp_do_aa, dsp_rep_aa, dsp_do_imm, dsp_rep_imm, dsp_undefined, dsp_undefined, ! 231: dsp_do_ea, dsp_rep_ea, dsp_do_ea, dsp_rep_ea, dsp_do_imm, dsp_rep_imm, dsp_undefined, dsp_undefined, ! 232: dsp_undefined, dsp_undefined, dsp_undefined, dsp_undefined, dsp_do_imm, dsp_rep_imm, dsp_undefined, dsp_undefined, ! 233: dsp_do_reg, dsp_rep_reg, dsp_undefined, dsp_undefined, dsp_do_imm, dsp_rep_imm, dsp_undefined, dsp_undefined, ! 234: dsp_movem_aa, dsp_movem_aa, dsp_undefined, dsp_undefined, dsp_undefined, dsp_undefined, dsp_undefined, dsp_undefined, ! 235: dsp_undefined, dsp_undefined, dsp_undefined, dsp_undefined, dsp_movem_ea, dsp_movem_ea, dsp_undefined, dsp_undefined, ! 236: dsp_movem_aa, dsp_movem_aa, dsp_undefined, dsp_undefined, dsp_undefined, dsp_undefined, dsp_undefined, dsp_undefined, ! 237: dsp_undefined, dsp_undefined, dsp_undefined, dsp_undefined, dsp_movem_ea, dsp_movem_ea, dsp_undefined, dsp_undefined, ! 238: ! 239: /* 0x100 - 0x13f */ ! 240: dsp_pm_class2, dsp_pm_class2, dsp_pm_class2, dsp_pm_class2, dsp_pm_class2, dsp_pm_class2, dsp_pm_class2, dsp_pm_class2, ! 241: dsp_movep_0, dsp_movep_0, dsp_movep_1, dsp_movep_1, dsp_movep_23, dsp_movep_23, dsp_movep_23, dsp_movep_23, ! 242: dsp_pm_class2, dsp_pm_class2, dsp_pm_class2, dsp_pm_class2, dsp_pm_class2, dsp_pm_class2, dsp_pm_class2, dsp_pm_class2, ! 243: dsp_movep_0, dsp_movep_0, dsp_movep_1, dsp_movep_1, dsp_movep_23, dsp_movep_23, dsp_movep_23, dsp_movep_23, ! 244: dsp_pm_class2, dsp_pm_class2, dsp_pm_class2, dsp_pm_class2, dsp_pm_class2, dsp_pm_class2, dsp_pm_class2, dsp_pm_class2, ! 245: dsp_movep_0, dsp_movep_0, dsp_movep_1, dsp_movep_1, dsp_movep_23, dsp_movep_23, dsp_movep_23, dsp_movep_23, ! 246: dsp_pm_class2, dsp_pm_class2, dsp_pm_class2, dsp_pm_class2, dsp_pm_class2, dsp_pm_class2, dsp_pm_class2, dsp_pm_class2, ! 247: dsp_movep_0, dsp_movep_0, dsp_movep_1, dsp_movep_1, dsp_movep_23, dsp_movep_23, dsp_movep_23, dsp_movep_23, ! 248: ! 249: /* 0x140 - 0x17f */ ! 250: dsp_bclr_aa, dsp_bset_aa, dsp_bclr_aa, dsp_bset_aa, dsp_jclr_aa, dsp_jset_aa, dsp_jclr_aa, dsp_jset_aa, ! 251: dsp_bclr_ea, dsp_bset_ea, dsp_bclr_ea, dsp_bset_ea, dsp_jclr_ea, dsp_jset_ea, dsp_jclr_ea, dsp_jset_ea, ! 252: dsp_bclr_pp, dsp_bset_pp, dsp_bclr_pp, dsp_bset_pp, dsp_jclr_pp, dsp_jset_pp, dsp_jclr_pp, dsp_jset_pp, ! 253: dsp_jclr_reg, dsp_jset_reg, dsp_bclr_reg, dsp_bset_reg, dsp_jmp_ea, dsp_jcc_ea, dsp_undefined, dsp_undefined, ! 254: dsp_bchg_aa, dsp_btst_aa, dsp_bchg_aa, dsp_btst_aa, dsp_jsclr_aa, dsp_jsset_aa, dsp_jsclr_aa, dsp_jsset_aa, ! 255: dsp_bchg_ea, dsp_btst_ea, dsp_bchg_ea, dsp_btst_ea, dsp_jsclr_ea, dsp_jsset_ea, dsp_jsclr_ea, dsp_jsset_ea, ! 256: dsp_bchg_pp, dsp_btst_pp, dsp_bchg_pp, dsp_btst_pp, dsp_jsclr_pp, dsp_jsset_pp, dsp_jsclr_pp, dsp_jsset_pp, ! 257: dsp_jsclr_reg, dsp_jsset_reg, dsp_bchg_reg, dsp_btst_reg, dsp_jsr_ea, dsp_jscc_ea, dsp_undefined, dsp_undefined, ! 258: ! 259: /* 0x180 - 0x1bf */ ! 260: dsp_jmp_imm, dsp_jmp_imm, dsp_jmp_imm, dsp_jmp_imm, dsp_jmp_imm, dsp_jmp_imm, dsp_jmp_imm, dsp_jmp_imm, ! 261: dsp_undefined, dsp_undefined, dsp_undefined, dsp_undefined, dsp_undefined, dsp_undefined, dsp_undefined, dsp_undefined, ! 262: dsp_undefined, dsp_undefined, dsp_undefined, dsp_undefined, dsp_undefined, dsp_undefined, dsp_undefined, dsp_undefined, ! 263: dsp_undefined, dsp_undefined, dsp_undefined, dsp_undefined, dsp_undefined, dsp_undefined, dsp_undefined, dsp_undefined, ! 264: dsp_jsr_imm, dsp_jsr_imm, dsp_jsr_imm, dsp_jsr_imm, dsp_jsr_imm, dsp_jsr_imm, dsp_jsr_imm, dsp_jsr_imm, ! 265: dsp_undefined, dsp_undefined, dsp_undefined, dsp_undefined, dsp_undefined, dsp_undefined, dsp_undefined, dsp_undefined, ! 266: dsp_undefined, dsp_undefined, dsp_undefined, dsp_undefined, dsp_undefined, dsp_undefined, dsp_undefined, dsp_undefined, ! 267: dsp_undefined, dsp_undefined, dsp_undefined, dsp_undefined, dsp_undefined, dsp_undefined, dsp_undefined, dsp_undefined, ! 268: ! 269: /* 0x1c0 - 0x1ff */ ! 270: dsp_jcc_imm, dsp_jcc_imm, dsp_jcc_imm, dsp_jcc_imm, dsp_jcc_imm, dsp_jcc_imm, dsp_jcc_imm, dsp_jcc_imm, ! 271: dsp_jcc_imm, dsp_jcc_imm, dsp_jcc_imm, dsp_jcc_imm, dsp_jcc_imm, dsp_jcc_imm, dsp_jcc_imm, dsp_jcc_imm, ! 272: dsp_jcc_imm, dsp_jcc_imm, dsp_jcc_imm, dsp_jcc_imm, dsp_jcc_imm, dsp_jcc_imm, dsp_jcc_imm, dsp_jcc_imm, ! 273: dsp_jcc_imm, dsp_jcc_imm, dsp_jcc_imm, dsp_jcc_imm, dsp_jcc_imm, dsp_jcc_imm, dsp_jcc_imm, dsp_jcc_imm, ! 274: dsp_jscc_imm, dsp_jscc_imm, dsp_jscc_imm, dsp_jscc_imm, dsp_jscc_imm, dsp_jscc_imm, dsp_jscc_imm, dsp_jscc_imm, ! 275: dsp_jscc_imm, dsp_jscc_imm, dsp_jscc_imm, dsp_jscc_imm, dsp_jscc_imm, dsp_jscc_imm, dsp_jscc_imm, dsp_jscc_imm, ! 276: dsp_jscc_imm, dsp_jscc_imm, dsp_jscc_imm, dsp_jscc_imm, dsp_jscc_imm, dsp_jscc_imm, dsp_jscc_imm, dsp_jscc_imm, ! 277: dsp_jscc_imm, dsp_jscc_imm, dsp_jscc_imm, dsp_jscc_imm, dsp_jscc_imm, dsp_jscc_imm, dsp_jscc_imm, dsp_jscc_imm, ! 278: }; ! 279: ! 280: static const char* opcodes_alu[256] = { ! 281: /* 0x00 - 0x3f */ ! 282: "move" , "tfr b,a", "addr b,a", "tst a", "undefined", "cmp b,a" , "subr b,a", "cmpm b,a", ! 283: "undefined", "tfr a,b", "addr a,b", "tst b", "undefined", "cmp a,b" , "subr a,b", "cmpm a,b", ! 284: "add b,a" , "rnd a" , "addl b,a", "clr a", "sub b,a" , "undefined", "subl b,a", "not a", ! 285: "add a,b" , "rnd b" , "addl a,b", "clr b", "sub a,b" , "undefined", "subl a,b", "not b", ! 286: "add x,a" , "adc x,a", "asr a" , "lsr a", "sub x,a" , "sbc x,a" , "abs a" , "ror a", ! 287: "add x,b" , "adc x,b", "asr b" , "lsr b", "sub x,b" , "sbc x,b" , "abs b" , "ror b", ! 288: "add y,a" , "adc y,a", "asl a" , "lsl a", "sub y,a" , "sbc y,a" , "neg a" , "rol a", ! 289: "add y,b" , "adc y,b", "asl b" , "lsl b", "sub y,b" , "sbc y,b" , "neg b" , "rol b", ! 290: ! 291: /* 0x40 - 0x7f */ ! 292: "add x0,a", "tfr x0,a", "or x0,a", "eor x0,a", "sub x0,a", "cmp x0,a", "and x0,a", "cmpm x0,a", ! 293: "add x0,b", "tfr x0,b", "or x0,b", "eor x0,b", "sub x0,b", "cmp x0,b", "and x0,b", "cmpm x0,b", ! 294: "add y0,a", "tfr y0,a", "or y0,a", "eor y0,a", "sub y0,a", "cmp y0,a", "and y0,a", "cmpm y0,a", ! 295: "add y0,b", "tfr y0,b", "or y0,b", "eor y0,b", "sub y0,b", "cmp y0,b", "and y0,b", "cmpm y0,b", ! 296: "add x1,a", "tfr x1,a", "or x1,a", "eor x1,a", "sub x1,a", "cmp x1,a", "and x1,a", "cmpm x1,a", ! 297: "add x1,b", "tfr x1,b", "or x1,b", "eor x1,b", "sub x1,b", "cmp x1,b", "and x1,b", "cmpm x1,b", ! 298: "add y1,a", "tfr y1,a", "or y1,a", "eor y1,a", "sub y1,a", "cmp y1,a", "and y1,a", "cmpm y1,a", ! 299: "add y1,b", "tfr y1,b", "or y1,b", "eor y1,b", "sub y1,b", "cmp y1,b", "and y1,b", "cmpm y1,b", ! 300: ! 301: /* 0x80 - 0xbf */ ! 302: "mpy +x0,x0,a", "mpyr +x0,x0,a", "mac +x0,x0,a", "macr +x0,x0,a", "mpy -x0,x0,a", "mpyr -x0,x0,a", "mac -x0,x0,a", "macr -x0,x0,a", ! 303: "mpy +x0,x0,b", "mpyr +x0,x0,b", "mac +x0,x0,b", "macr +x0,x0,b", "mpy -x0,x0,b", "mpyr -x0,x0,b", "mac -x0,x0,b", "macr -x0,x0,b", ! 304: "mpy +y0,y0,a", "mpyr +y0,y0,a", "mac +y0,y0,a", "macr +y0,y0,a", "mpy -y0,y0,a", "mpyr -y0,y0,a", "mac -y0,y0,a", "macr -y0,y0,a", ! 305: "mpy +y0,y0,b", "mpyr +y0,y0,b", "mac +y0,y0,b", "macr +y0,y0,b", "mpy -y0,y0,b", "mpyr -y0,y0,b", "mac -y0,y0,b", "macr -y0,y0,b", ! 306: "mpy +x1,x0,a", "mpyr +x1,x0,a", "mac +x1,x0,a", "macr +x1,x0,a", "mpy -x1,x0,a", "mpyr -x1,x0,a", "mac -x1,x0,a", "macr -x1,x0,a", ! 307: "mpy +x1,x0,b", "mpyr +x1,x0,b", "mac +x1,x0,b", "macr +x1,x0,b", "mpy -x1,x0,b", "mpyr -x1,x0,b", "mac -x1,x0,b", "macr -x1,x0,b", ! 308: "mpy +y1,y0,a", "mpyr +y1,y0,a", "mac +y1,y0,a", "macr +y1,y0,a", "mpy -y1,y0,a", "mpyr -y1,y0,a", "mac -y1,y0,a", "macr -y1,y0,a", ! 309: "mpy +y1,y0,b", "mpyr +y1,y0,b", "mac +y1,y0,b", "macr +y1,y0,b", "mpy -y1,y0,b", "mpyr -y1,y0,b", "mac -y1,y0,b", "macr -y1,y0,b", ! 310: ! 311: /* 0xc0 - 0xff */ ! 312: "mpy +x0,y1,a", "mpyr +x0,y1,a", "mac +x0,y1,a", "macr +x0,y1,a", "mpy -x0,y1,a", "mpyr -x0,y1,a", "mac -x0,y1,a", "macr -x0,y1,a", ! 313: "mpy +x0,y1,b", "mpyr +x0,y1,b", "mac +x0,y1,b", "macr +x0,y1,b", "mpy -x0,y1,b", "mpyr -x0,y1,b", "mac -x0,y1,b", "macr -x0,y1,b", ! 314: "mpy +y0,x0,a", "mpyr +y0,x0,a", "mac +y0,x0,a", "macr +y0,x0,a", "mpy -y0,x0,a", "mpyr -y0,x0,a", "mac -y0,x0,a", "macr -y0,x0,a", ! 315: "mpy +y0,x0,b", "mpyr +y0,x0,b", "mac +y0,x0,b", "macr +y0,x0,b", "mpy -y0,x0,b", "mpyr -y0,x0,b", "mac -y0,x0,b", "macr -y0,x0,b", ! 316: "mpy +x1,y0,a", "mpyr +x1,y0,a", "mac +x1,y0,a", "macr +x1,y0,a", "mpy -x1,y0,a", "mpyr -x1,y0,a", "mac -x1,y0,a", "macr -x1,y0,a", ! 317: "mpy +x1,y0,b", "mpyr +x1,y0,b", "mac +x1,y0,b", "macr +x1,y0,b", "mpy -x1,y0,b", "mpyr -x1,y0,b", "mac -x1,y0,b", "macr -x1,y0,b", ! 318: "mpy +y1,x1,a", "mpyr +y1,x1,a", "mac +y1,x1,a", "macr +y1,x1,a", "mpy -y1,x1,a", "mpyr -y1,x1,a", "mac -y1,x1,a", "macr -y1,x1,a", ! 319: "mpy +y1,x1,b", "mpyr +y1,x1,b", "mac +y1,x1,b", "macr +y1,x1,b", "mpy -y1,x1,b", "mpyr -y1,x1,b", "mac -y1,x1,b", "macr -y1,x1,b" ! 320: }; ! 321: ! 322: ! 323: ! 324: static const dsp_emul_t opcodes_parmove[16] = { ! 325: dsp_pm_0, ! 326: dsp_pm_1, ! 327: dsp_pm_2, ! 328: dsp_pm_2, ! 329: dsp_pm_4, ! 330: dsp_pm_4, ! 331: dsp_pm_4, ! 332: dsp_pm_4, ! 333: ! 334: dsp_pm_8, ! 335: dsp_pm_8, ! 336: dsp_pm_8, ! 337: dsp_pm_8, ! 338: dsp_pm_8, ! 339: dsp_pm_8, ! 340: dsp_pm_8, ! 341: dsp_pm_8 ! 342: }; ! 343: ! 344: static const int registers_tcc[16][2] = { ! 345: {DSP_REG_B,DSP_REG_A}, ! 346: {DSP_REG_A,DSP_REG_B}, ! 347: {DSP_REG_NULL,DSP_REG_NULL}, ! 348: {DSP_REG_NULL,DSP_REG_NULL}, ! 349: ! 350: {DSP_REG_NULL,DSP_REG_NULL}, ! 351: {DSP_REG_NULL,DSP_REG_NULL}, ! 352: {DSP_REG_NULL,DSP_REG_NULL}, ! 353: {DSP_REG_NULL,DSP_REG_NULL}, ! 354: ! 355: {DSP_REG_X0,DSP_REG_A}, ! 356: {DSP_REG_X0,DSP_REG_B}, ! 357: {DSP_REG_Y0,DSP_REG_A}, ! 358: {DSP_REG_Y0,DSP_REG_B}, ! 359: ! 360: {DSP_REG_X1,DSP_REG_A}, ! 361: {DSP_REG_X1,DSP_REG_B}, ! 362: {DSP_REG_Y1,DSP_REG_A}, ! 363: {DSP_REG_Y1,DSP_REG_B} ! 364: }; ! 365: ! 366: static const char *registers_lmove[8] = { ! 367: "a10", ! 368: "b10", ! 369: "x", ! 370: "y", ! 371: "a", ! 372: "b", ! 373: "ab", ! 374: "ba" ! 375: }; ! 376: ! 377: static const char *ea_names[9] = { ! 378: "(r%d)-n%d", /* 000xxx */ ! 379: "(r%d)+n%d", /* 001xxx */ ! 380: "(r%d)-", /* 010xxx */ ! 381: "(r%d)+", /* 011xxx */ ! 382: "(r%d)", /* 100xxx */ ! 383: "(r%d+n%d)", /* 101xxx */ ! 384: "$%04x", /* 110000 */ ! 385: "-(r%d)", /* 111xxx */ ! 386: "$%06x" /* 110100 */ ! 387: }; ! 388: ! 389: static const char *cc_name[16] = { ! 390: "cc", ! 391: "ge", ! 392: "ne", ! 393: "pl", ! 394: "nn", ! 395: "ec", ! 396: "lc", ! 397: "gt", ! 398: ! 399: "cs", ! 400: "lt", ! 401: "eq", ! 402: "mi", ! 403: "nr", ! 404: "es", ! 405: "ls", ! 406: "le" ! 407: }; ! 408: ! 409: void dsp56k_disasm_reg_save(void) ! 410: { ! 411: memcpy(registers_save, dsp_core.registers , sizeof(registers_save)); ! 412: #if DSP_DISASM_REG_PC ! 413: pc_save = dsp_core.pc; ! 414: #endif ! 415: } ! 416: ! 417: void dsp56k_disasm_reg_compare(void) ! 418: { ! 419: int i; ! 420: bool bRegA = false; ! 421: bool bRegB = false; ! 422: ! 423: for (i=4; i<64; i++) { ! 424: if (registers_save[i] == dsp_core.registers[i]) { ! 425: continue; ! 426: } ! 427: ! 428: switch(i) { ! 429: case DSP_REG_X0: ! 430: case DSP_REG_X1: ! 431: case DSP_REG_Y0: ! 432: case DSP_REG_Y1: ! 433: fprintf(stderr,"\tReg: %s $%06x -> $%06x\n", registers_name[i], registers_save[i], dsp_core.registers[i]); ! 434: break; ! 435: case DSP_REG_R0: ! 436: case DSP_REG_R1: ! 437: case DSP_REG_R2: ! 438: case DSP_REG_R3: ! 439: case DSP_REG_R4: ! 440: case DSP_REG_R5: ! 441: case DSP_REG_R6: ! 442: case DSP_REG_R7: ! 443: case DSP_REG_M0: ! 444: case DSP_REG_M1: ! 445: case DSP_REG_M2: ! 446: case DSP_REG_M3: ! 447: case DSP_REG_M4: ! 448: case DSP_REG_M5: ! 449: case DSP_REG_M6: ! 450: case DSP_REG_M7: ! 451: case DSP_REG_N0: ! 452: case DSP_REG_N1: ! 453: case DSP_REG_N2: ! 454: case DSP_REG_N3: ! 455: case DSP_REG_N4: ! 456: case DSP_REG_N5: ! 457: case DSP_REG_N6: ! 458: case DSP_REG_N7: ! 459: case DSP_REG_SR: ! 460: case DSP_REG_LA: ! 461: case DSP_REG_LC: ! 462: fprintf(stderr,"\tReg: %s $%04x -> $%04x\n", registers_name[i], registers_save[i], dsp_core.registers[i]); ! 463: break; ! 464: case DSP_REG_OMR: ! 465: case DSP_REG_SP: ! 466: case DSP_REG_SSH: ! 467: case DSP_REG_SSL: ! 468: fprintf(stderr,"\tReg: %s $%02x -> $%02x\n", registers_name[i], registers_save[i], dsp_core.registers[i]); ! 469: break; ! 470: case DSP_REG_A0: ! 471: case DSP_REG_A1: ! 472: case DSP_REG_A2: ! 473: if (bRegA == false) { ! 474: fprintf(stderr,"\tReg: a $%02x:%06x:%06x -> $%02x:%06x:%06x\n", ! 475: registers_save[DSP_REG_A2], registers_save[DSP_REG_A1], registers_save[DSP_REG_A0], ! 476: dsp_core.registers[DSP_REG_A2], dsp_core.registers[DSP_REG_A1], dsp_core.registers[DSP_REG_A0] ! 477: ); ! 478: bRegA = true; ! 479: } ! 480: break; ! 481: case DSP_REG_B0: ! 482: case DSP_REG_B1: ! 483: case DSP_REG_B2: ! 484: if (bRegB == false) { ! 485: fprintf(stderr,"\tReg: b $%02x:%06x:%06x -> $%02x:%06x:%06x\n", ! 486: registers_save[DSP_REG_B2], registers_save[DSP_REG_B1], registers_save[DSP_REG_B0], ! 487: dsp_core.registers[DSP_REG_B2], dsp_core.registers[DSP_REG_B1], dsp_core.registers[DSP_REG_B0] ! 488: ); ! 489: bRegB = true; ! 490: } ! 491: break; ! 492: } ! 493: } ! 494: ! 495: #if DSP_DISASM_REG_PC ! 496: if (pc_save != dsp_core.pc) { ! 497: fprintf(stderr,"\tReg: pc $%04x -> $%04x\n", pc_save, dsp_core.pc); ! 498: } ! 499: #endif ! 500: } ! 501: ! 502: Uint16 dsp56k_disasm(dsp_trace_disasm_t mode) ! 503: { ! 504: Uint32 value; ! 505: ! 506: if (mode == DSP_TRACE_MODE) { ! 507: isInDisasmMode = false; ! 508: if (prev_inst_pc == dsp_core.pc) { ! 509: if (!isLooping) { ! 510: fprintf(stderr, "Looping on DSP instruction at PC = $%04x\n", prev_inst_pc); ! 511: isLooping = true; ! 512: } ! 513: return 0; ! 514: } ! 515: } ! 516: else { ! 517: isInDisasmMode = true; ! 518: } ! 519: ! 520: prev_inst_pc = dsp_core.pc; ! 521: isLooping = false; ! 522: ! 523: cur_inst = read_memory(dsp_core.pc); ! 524: disasm_cur_inst_len = 1; ! 525: ! 526: strcpy(parallelmove_name, ""); ! 527: ! 528: if (cur_inst < 0x100000) { ! 529: value = (cur_inst >> 11) & (BITMASK(6) << 3); ! 530: value += (cur_inst >> 5) & BITMASK(3); ! 531: opcodes8h[value](); ! 532: } else { ! 533: dsp_pm(); ! 534: sprintf(str_instr, "%s %s", opcodes_alu[cur_inst & BITMASK(8)], parallelmove_name); ! 535: } ! 536: return disasm_cur_inst_len; ! 537: } ! 538: ! 539: /** ! 540: * dsp56k_getInstrText : return the disasembled instructions ! 541: */ ! 542: const char* dsp56k_getInstructionText(void) ! 543: { ! 544: const int len = sizeof(str_instr); ! 545: Uint64 count, cycles; ! 546: Uint16 cycle_diff; ! 547: float percentage; ! 548: int offset; ! 549: ! 550: if (isLooping) { ! 551: *str_instr2 = 0; ! 552: } ! 553: if (disasm_cur_inst_len == 1) { ! 554: offset = sprintf(str_instr2, "p:%04x %06x (%02d cyc) %-*s\n", prev_inst_pc, cur_inst, dsp_core.instr_cycle, len, str_instr); ! 555: } else { ! 556: offset = sprintf(str_instr2, "p:%04x %06x %06x (%02d cyc) %-*s\n", prev_inst_pc, cur_inst, read_memory(prev_inst_pc + 1), dsp_core.instr_cycle, len, str_instr); ! 557: } ! 558: if (offset > 2 && Profile_DspAddressData(prev_inst_pc, &percentage, &count/*, &cycles, &cycle_diff*/)) { ! 559: offset -= 2; ! 560: sprintf(str_instr2+offset, "%5.2f%% (%"PRId64", %"PRId64", %d)\n", ! 561: percentage, count, cycles, cycle_diff); ! 562: } ! 563: return str_instr2; ! 564: } ! 565: ! 566: static void dsp_pm_class2(void) { ! 567: dsp_pm(); ! 568: sprintf(str_instr, "%s %s", opcodes_alu[cur_inst & BITMASK(8)], parallelmove_name); ! 569: } ! 570: ! 571: static Uint32 read_memory(Uint32 currPc) ! 572: { ! 573: Uint32 value; ! 574: ! 575: if (currPc<0x200) { ! 576: value = dsp_core.ramint[DSP_SPACE_P][currPc]; ! 577: } else { ! 578: value = dsp_core.ramext[currPc & (DSP_RAMSIZE-1)]; ! 579: } ! 580: ! 581: return value & BITMASK(24); ! 582: } ! 583: ! 584: /********************************** ! 585: * Conditions code calculation ! 586: **********************************/ ! 587: ! 588: static void dsp_calc_cc(Uint32 cc_mode, char *dest) ! 589: { ! 590: strcpy(dest, cc_name[cc_mode & BITMASK(4)]); ! 591: } ! 592: ! 593: /********************************** ! 594: * Effective address calculation ! 595: **********************************/ ! 596: ! 597: static int dsp_calc_ea(Uint32 ea_mode, char *dest) ! 598: { ! 599: int value, retour, numreg; ! 600: ! 601: value = (ea_mode >> 3) & BITMASK(3); ! 602: numreg = ea_mode & BITMASK(3); ! 603: retour = 0; ! 604: switch (value) { ! 605: case 0: ! 606: /* (Rx)-Nx */ ! 607: sprintf(dest, ea_names[value], numreg, numreg); ! 608: break; ! 609: case 1: ! 610: /* (Rx)+Nx */ ! 611: sprintf(dest, ea_names[value], numreg, numreg); ! 612: break; ! 613: case 5: ! 614: /* (Rx+Nx) */ ! 615: sprintf(dest, ea_names[value], numreg, numreg); ! 616: break; ! 617: case 2: ! 618: /* (Rx)- */ ! 619: sprintf(dest, ea_names[value], numreg); ! 620: break; ! 621: case 3: ! 622: /* (Rx)+ */ ! 623: sprintf(dest, ea_names[value], numreg); ! 624: break; ! 625: case 4: ! 626: /* (Rx) */ ! 627: sprintf(dest, ea_names[value], numreg); ! 628: break; ! 629: case 7: ! 630: /* -(Rx) */ ! 631: sprintf(dest, ea_names[value], numreg); ! 632: break; ! 633: case 6: ! 634: disasm_cur_inst_len++; ! 635: switch ((ea_mode >> 2) & 1) { ! 636: case 0: ! 637: /* Absolute address */ ! 638: sprintf(dest, ea_names[value], read_memory(dsp_core.pc+1)); ! 639: break; ! 640: case 1: ! 641: /* Immediate value */ ! 642: sprintf(dest, ea_names[8], read_memory(dsp_core.pc+1)); ! 643: retour = 1; ! 644: break; ! 645: } ! 646: break; ! 647: } ! 648: return retour; ! 649: } ! 650: ! 651: static void opcode8h_0(void) ! 652: { ! 653: switch(cur_inst) { ! 654: case 0x000000: ! 655: dsp_nop(); ! 656: break; ! 657: case 0x000004: ! 658: dsp_rti(); ! 659: break; ! 660: case 0x000005: ! 661: dsp_illegal(); ! 662: break; ! 663: case 0x000006: ! 664: dsp_swi(); ! 665: break; ! 666: case 0x00000c: ! 667: dsp_rts(); ! 668: break; ! 669: case 0x000084: ! 670: dsp_reset(); ! 671: break; ! 672: case 0x000086: ! 673: dsp_wait(); ! 674: break; ! 675: case 0x000087: ! 676: dsp_stop(); ! 677: break; ! 678: case 0x00008c: ! 679: dsp_enddo(); ! 680: break; ! 681: default: ! 682: dsp_undefined(); ! 683: break; ! 684: } ! 685: } ! 686: ! 687: /********************************** ! 688: * Non-parallel moves instructions ! 689: **********************************/ ! 690: ! 691: static void dsp_undefined(void) ! 692: { ! 693: /* In Disasm mode, display dc instruction_opcode */ ! 694: if (isInDisasmMode) ! 695: sprintf(str_instr, "dc $%06x", cur_inst); ! 696: /* In trace mode, display unknown instruction */ ! 697: else ! 698: sprintf(str_instr, "$%06x unknown instruction", cur_inst); ! 699: } ! 700: ! 701: static void dsp_andi(void) ! 702: { ! 703: switch(cur_inst & BITMASK(2)) { ! 704: case 0: ! 705: sprintf(str_instr, "andi #$%02x,mr", (cur_inst>>8) & BITMASK(8)); ! 706: break; ! 707: case 1: ! 708: sprintf(str_instr, "andi #$%02x,ccr", (cur_inst>>8) & BITMASK(8)); ! 709: break; ! 710: case 2: ! 711: sprintf(str_instr, "andi #$%02x,omr", (cur_inst>>8) & BITMASK(8)); ! 712: break; ! 713: default: ! 714: break; ! 715: } ! 716: } ! 717: ! 718: static void dsp_bchg_aa(void) ! 719: { ! 720: /* bchg #n,x:aa */ ! 721: /* bchg #n,y:aa */ ! 722: char name[16]; ! 723: Uint32 memspace, value, numbit; ! 724: ! 725: memspace = (cur_inst>>6) & 1; ! 726: value = (cur_inst>>8) & BITMASK(6); ! 727: numbit = cur_inst & BITMASK(5); ! 728: ! 729: if (memspace) { ! 730: sprintf(name,"y:$%04x",value); ! 731: } else { ! 732: sprintf(name,"x:$%04x",value); ! 733: } ! 734: ! 735: sprintf(str_instr,"bchg #%d,%s", numbit, name); ! 736: } ! 737: ! 738: static void dsp_bchg_ea(void) ! 739: { ! 740: /* bchg #n,x:ea */ ! 741: /* bchg #n,y:ea */ ! 742: char name[16], addr_name[16]; ! 743: Uint32 memspace, value, numbit; ! 744: ! 745: memspace = (cur_inst>>6) & 1; ! 746: value = (cur_inst>>8) & BITMASK(6); ! 747: numbit = cur_inst & BITMASK(5); ! 748: ! 749: dsp_calc_ea(value, addr_name); ! 750: if (memspace) { ! 751: sprintf(name,"y:%s",addr_name); ! 752: } else { ! 753: sprintf(name,"x:%s",addr_name); ! 754: } ! 755: ! 756: sprintf(str_instr,"bchg #%d,%s", numbit, name); ! 757: } ! 758: ! 759: static void dsp_bchg_pp(void) ! 760: { ! 761: /* bchg #n,x:pp */ ! 762: /* bchg #n,y:pp */ ! 763: char name[16]; ! 764: Uint32 memspace, value, numbit; ! 765: ! 766: memspace = (cur_inst>>6) & 1; ! 767: value = (cur_inst>>8) & BITMASK(6); ! 768: numbit = cur_inst & BITMASK(5); ! 769: ! 770: if (memspace) { ! 771: sprintf(name,"y:$%04x",value+0xffc0); ! 772: } else { ! 773: sprintf(name,"x:$%04x",value+0xffc0); ! 774: } ! 775: ! 776: sprintf(str_instr,"bchg #%d,%s", numbit, name); ! 777: } ! 778: ! 779: static void dsp_bchg_reg(void) ! 780: { ! 781: /* bchg #n,R */ ! 782: Uint32 value, numbit; ! 783: ! 784: value = (cur_inst>>8) & BITMASK(6); ! 785: numbit = cur_inst & BITMASK(5); ! 786: ! 787: sprintf(str_instr,"bchg #%d,%s", numbit, registers_name[value]); ! 788: } ! 789: ! 790: static void dsp_bclr_aa(void) ! 791: { ! 792: /* bclr #n,x:aa */ ! 793: /* bclr #n,y:aa */ ! 794: char name[16]; ! 795: Uint32 memspace, value, numbit; ! 796: ! 797: memspace = (cur_inst>>6) & 1; ! 798: value = (cur_inst>>8) & BITMASK(6); ! 799: numbit = cur_inst & BITMASK(5); ! 800: ! 801: if (memspace) { ! 802: sprintf(name,"y:$%04x",value); ! 803: } else { ! 804: sprintf(name,"x:$%04x",value); ! 805: } ! 806: ! 807: sprintf(str_instr,"bclr #%d,%s", numbit, name); ! 808: } ! 809: ! 810: static void dsp_bclr_ea(void) ! 811: { ! 812: /* bclr #n,x:ea */ ! 813: /* bclr #n,y:ea */ ! 814: char name[16], addr_name[16]; ! 815: Uint32 memspace, value, numbit; ! 816: ! 817: memspace = (cur_inst>>6) & 1; ! 818: value = (cur_inst>>8) & BITMASK(6); ! 819: numbit = cur_inst & BITMASK(5); ! 820: ! 821: dsp_calc_ea(value, addr_name); ! 822: if (memspace) { ! 823: sprintf(name,"y:%s",addr_name); ! 824: } else { ! 825: sprintf(name,"x:%s",addr_name); ! 826: } ! 827: ! 828: sprintf(str_instr,"bclr #%d,%s", numbit, name); ! 829: } ! 830: ! 831: static void dsp_bclr_pp(void) ! 832: { ! 833: /* bclr #n,x:pp */ ! 834: /* bclr #n,y:pp */ ! 835: char name[16]; ! 836: Uint32 memspace, value, numbit; ! 837: ! 838: memspace = (cur_inst>>6) & 1; ! 839: value = (cur_inst>>8) & BITMASK(6); ! 840: numbit = cur_inst & BITMASK(5); ! 841: ! 842: if (memspace) { ! 843: sprintf(name,"y:$%04x",value+0xffc0); ! 844: } else { ! 845: sprintf(name,"x:$%04x",value+0xffc0); ! 846: } ! 847: ! 848: sprintf(str_instr,"bclr #%d,%s", numbit, name); ! 849: } ! 850: ! 851: static void dsp_bclr_reg(void) ! 852: { ! 853: /* bclr #n,R */ ! 854: Uint32 value, numbit; ! 855: ! 856: value = (cur_inst>>8) & BITMASK(6); ! 857: numbit = cur_inst & BITMASK(5); ! 858: ! 859: sprintf(str_instr,"bclr #%d,%s", numbit, registers_name[value]); ! 860: } ! 861: ! 862: static void dsp_bset_aa(void) ! 863: { ! 864: /* bset #n,x:aa */ ! 865: /* bset #n,y:aa */ ! 866: char name[16]; ! 867: Uint32 memspace, value, numbit; ! 868: ! 869: memspace = (cur_inst>>6) & 1; ! 870: value = (cur_inst>>8) & BITMASK(6); ! 871: numbit = cur_inst & BITMASK(5); ! 872: ! 873: if (memspace) { ! 874: sprintf(name,"y:$%04x",value); ! 875: } else { ! 876: sprintf(name,"x:$%04x",value); ! 877: } ! 878: ! 879: sprintf(str_instr,"bset #%d,%s", numbit, name); ! 880: } ! 881: ! 882: static void dsp_bset_ea(void) ! 883: { ! 884: /* bset #n,x:ea */ ! 885: /* bset #n,y:ea */ ! 886: char name[16], addr_name[16]; ! 887: Uint32 memspace, value, numbit; ! 888: ! 889: memspace = (cur_inst>>6) & 1; ! 890: value = (cur_inst>>8) & BITMASK(6); ! 891: numbit = cur_inst & BITMASK(5); ! 892: ! 893: dsp_calc_ea(value, addr_name); ! 894: if (memspace) { ! 895: sprintf(name,"y:%s",addr_name); ! 896: } else { ! 897: sprintf(name,"x:%s",addr_name); ! 898: } ! 899: ! 900: sprintf(str_instr,"bset #%d,%s", numbit, name); ! 901: } ! 902: ! 903: static void dsp_bset_pp(void) ! 904: { ! 905: /* bset #n,x:pp */ ! 906: /* bset #n,y:pp */ ! 907: char name[16]; ! 908: Uint32 memspace, value, numbit; ! 909: ! 910: memspace = (cur_inst>>6) & 1; ! 911: value = (cur_inst>>8) & BITMASK(6); ! 912: numbit = cur_inst & BITMASK(5); ! 913: ! 914: if (memspace) { ! 915: sprintf(name,"y:$%04x",value+0xffc0); ! 916: } else { ! 917: sprintf(name,"x:$%04x",value+0xffc0); ! 918: } ! 919: ! 920: sprintf(str_instr,"bset #%d,%s", numbit, name); ! 921: } ! 922: ! 923: static void dsp_bset_reg(void) ! 924: { ! 925: /* bset #n,R */ ! 926: Uint32 value, numbit; ! 927: ! 928: value = (cur_inst>>8) & BITMASK(6); ! 929: numbit = cur_inst & BITMASK(5); ! 930: ! 931: sprintf(str_instr,"bset #%d,%s", numbit, registers_name[value]); ! 932: } ! 933: ! 934: static void dsp_btst_aa(void) ! 935: { ! 936: /* btst #n,x:aa */ ! 937: /* btst #n,y:aa */ ! 938: char name[16]; ! 939: Uint32 memspace, value, numbit; ! 940: ! 941: memspace = (cur_inst>>6) & 1; ! 942: value = (cur_inst>>8) & BITMASK(6); ! 943: numbit = cur_inst & BITMASK(5); ! 944: ! 945: if (memspace) { ! 946: sprintf(name,"y:$%04x",value); ! 947: } else { ! 948: sprintf(name,"x:$%04x",value); ! 949: } ! 950: ! 951: sprintf(str_instr,"btst #%d,%s", numbit, name); ! 952: } ! 953: ! 954: static void dsp_btst_ea(void) ! 955: { ! 956: /* btst #n,x:ea */ ! 957: /* btst #n,y:ea */ ! 958: char name[16], addr_name[16]; ! 959: Uint32 memspace, value, numbit; ! 960: ! 961: memspace = (cur_inst>>6) & 1; ! 962: value = (cur_inst>>8) & BITMASK(6); ! 963: numbit = cur_inst & BITMASK(5); ! 964: ! 965: dsp_calc_ea(value, addr_name); ! 966: if (memspace) { ! 967: sprintf(name,"y:%s",addr_name); ! 968: } else { ! 969: sprintf(name,"x:%s",addr_name); ! 970: } ! 971: ! 972: sprintf(str_instr,"btst #%d,%s", numbit, name); ! 973: } ! 974: ! 975: static void dsp_btst_pp(void) ! 976: { ! 977: /* btst #n,x:pp */ ! 978: /* btst #n,y:pp */ ! 979: char name[16]; ! 980: Uint32 memspace, value, numbit; ! 981: ! 982: memspace = (cur_inst>>6) & 1; ! 983: value = (cur_inst>>8) & BITMASK(6); ! 984: numbit = cur_inst & BITMASK(5); ! 985: ! 986: if (memspace) { ! 987: sprintf(name,"y:$%04x",value+0xffc0); ! 988: } else { ! 989: sprintf(name,"x:$%04x",value+0xffc0); ! 990: } ! 991: ! 992: sprintf(str_instr,"btst #%d,%s", numbit, name); ! 993: } ! 994: ! 995: static void dsp_btst_reg(void) ! 996: { ! 997: /* btst #n,R */ ! 998: Uint32 value, numbit; ! 999: ! 1000: value = (cur_inst>>8) & BITMASK(6); ! 1001: numbit = cur_inst & BITMASK(5); ! 1002: ! 1003: sprintf(str_instr,"btst #%d,%s", numbit, registers_name[value]); ! 1004: } ! 1005: ! 1006: static void dsp_div(void) ! 1007: { ! 1008: Uint32 srcreg=DSP_REG_NULL, destreg; ! 1009: ! 1010: switch((cur_inst>>4) & BITMASK(2)) { ! 1011: case 0: ! 1012: srcreg = DSP_REG_X0; ! 1013: break; ! 1014: case 1: ! 1015: srcreg = DSP_REG_Y0; ! 1016: break; ! 1017: case 2: ! 1018: srcreg = DSP_REG_X1; ! 1019: break; ! 1020: case 3: ! 1021: srcreg = DSP_REG_Y1; ! 1022: break; ! 1023: } ! 1024: destreg = DSP_REG_A+((cur_inst>>3) & 1); ! 1025: ! 1026: sprintf(str_instr,"div %s,%s", registers_name[srcreg],registers_name[destreg]); ! 1027: } ! 1028: ! 1029: static void dsp_do_aa(void) ! 1030: { ! 1031: char name[16]; ! 1032: ! 1033: disasm_cur_inst_len++; ! 1034: ! 1035: if (cur_inst & (1<<6)) { ! 1036: sprintf(name, "y:$%04x", (cur_inst>>8) & BITMASK(6)); ! 1037: } else { ! 1038: sprintf(name, "x:$%04x", (cur_inst>>8) & BITMASK(6)); ! 1039: } ! 1040: ! 1041: sprintf(str_instr,"do %s,p:$%04x", ! 1042: name, ! 1043: read_memory(dsp_core.pc+1) ! 1044: ); ! 1045: } ! 1046: ! 1047: static void dsp_do_imm(void) ! 1048: { ! 1049: disasm_cur_inst_len++; ! 1050: ! 1051: sprintf(str_instr,"do #$%04x,p:$%04x", ! 1052: ((cur_inst>>8) & BITMASK(8))|((cur_inst & BITMASK(4))<<8), ! 1053: read_memory(dsp_core.pc+1) ! 1054: ); ! 1055: } ! 1056: ! 1057: static void dsp_do_ea(void) ! 1058: { ! 1059: char addr_name[16], name[16]; ! 1060: Uint32 ea_mode; ! 1061: ! 1062: disasm_cur_inst_len++; ! 1063: ! 1064: ea_mode = (cur_inst>>8) & BITMASK(6); ! 1065: dsp_calc_ea(ea_mode, addr_name); ! 1066: ! 1067: if (cur_inst & (1<<6)) { ! 1068: sprintf(name, "y:%s", addr_name); ! 1069: } else { ! 1070: sprintf(name, "x:%s", addr_name); ! 1071: } ! 1072: ! 1073: sprintf(str_instr,"do %s,p:$%04x", ! 1074: name, ! 1075: read_memory(dsp_core.pc+1) ! 1076: ); ! 1077: } ! 1078: ! 1079: static void dsp_do_reg(void) ! 1080: { ! 1081: disasm_cur_inst_len++; ! 1082: ! 1083: sprintf(str_instr,"do %s,p:$%04x", ! 1084: registers_name[(cur_inst>>8) & BITMASK(6)], ! 1085: read_memory(dsp_core.pc+1) ! 1086: ); ! 1087: } ! 1088: ! 1089: static void dsp_enddo(void) ! 1090: { ! 1091: sprintf(str_instr,"enddo"); ! 1092: } ! 1093: ! 1094: static void dsp_illegal(void) ! 1095: { ! 1096: sprintf(str_instr,"illegal"); ! 1097: } ! 1098: ! 1099: static void dsp_jcc_ea(void) ! 1100: { ! 1101: char cond_name[16], addr_name[16]; ! 1102: Uint32 cc_code=0; ! 1103: ! 1104: dsp_calc_ea((cur_inst >>8) & BITMASK(6), addr_name); ! 1105: cc_code=cur_inst & BITMASK(4); ! 1106: dsp_calc_cc(cc_code, cond_name); ! 1107: ! 1108: sprintf(str_instr,"j%s p:%s", cond_name, addr_name); ! 1109: } ! 1110: ! 1111: static void dsp_jcc_imm(void) ! 1112: { ! 1113: char cond_name[16], addr_name[16]; ! 1114: Uint32 cc_code=0; ! 1115: ! 1116: sprintf(addr_name, "$%04x", cur_inst & BITMASK(12)); ! 1117: cc_code=(cur_inst>>12) & BITMASK(4); ! 1118: dsp_calc_cc(cc_code, cond_name); ! 1119: ! 1120: sprintf(str_instr,"j%s p:%s", cond_name, addr_name); ! 1121: } ! 1122: ! 1123: static void dsp_jclr_aa(void) ! 1124: { ! 1125: /* jclr #n,x:aa,p:xx */ ! 1126: /* jclr #n,y:aa,p:xx */ ! 1127: char srcname[16]; ! 1128: Uint32 memspace, value, numbit; ! 1129: ! 1130: disasm_cur_inst_len++; ! 1131: ! 1132: memspace = (cur_inst>>6) & 1; ! 1133: value = (cur_inst>>8) & BITMASK(6); ! 1134: numbit = cur_inst & BITMASK(5); ! 1135: ! 1136: if (memspace) { ! 1137: sprintf(srcname, "y:$%04x", value); ! 1138: } else { ! 1139: sprintf(srcname, "x:$%04x", value); ! 1140: } ! 1141: ! 1142: sprintf(str_instr,"jclr #%d,%s,p:$%04x", ! 1143: numbit, ! 1144: srcname, ! 1145: read_memory(dsp_core.pc+1) ! 1146: ); ! 1147: } ! 1148: ! 1149: static void dsp_jclr_ea(void) ! 1150: { ! 1151: /* jclr #n,x:ea,p:xx */ ! 1152: /* jclr #n,y:ea,p:xx */ ! 1153: char srcname[16], addr_name[16]; ! 1154: Uint32 memspace, value, numbit; ! 1155: ! 1156: disasm_cur_inst_len++; ! 1157: ! 1158: memspace = (cur_inst>>6) & 1; ! 1159: value = (cur_inst>>8) & BITMASK(6); ! 1160: numbit = cur_inst & BITMASK(5); ! 1161: ! 1162: dsp_calc_ea(value, addr_name); ! 1163: if (memspace) { ! 1164: sprintf(srcname, "y:%s", addr_name); ! 1165: } else { ! 1166: sprintf(srcname, "x:%s", addr_name); ! 1167: } ! 1168: ! 1169: sprintf(str_instr,"jclr #%d,%s,p:$%04x", ! 1170: numbit, ! 1171: srcname, ! 1172: read_memory(dsp_core.pc+1) ! 1173: ); ! 1174: } ! 1175: ! 1176: static void dsp_jclr_pp(void) ! 1177: { ! 1178: /* jclr #n,x:pp,p:xx */ ! 1179: /* jclr #n,y:pp,p:xx */ ! 1180: char srcname[16]; ! 1181: Uint32 memspace, value, numbit; ! 1182: ! 1183: disasm_cur_inst_len++; ! 1184: ! 1185: memspace = (cur_inst>>6) & 1; ! 1186: value = (cur_inst>>8) & BITMASK(6); ! 1187: numbit = cur_inst & BITMASK(5); ! 1188: ! 1189: value += 0xffc0; ! 1190: if (memspace) { ! 1191: sprintf(srcname, "y:$%04x", value); ! 1192: } else { ! 1193: sprintf(srcname, "x:$%04x", value); ! 1194: } ! 1195: ! 1196: sprintf(str_instr,"jclr #%d,%s,p:$%04x", ! 1197: numbit, ! 1198: srcname, ! 1199: read_memory(dsp_core.pc+1) ! 1200: ); ! 1201: } ! 1202: ! 1203: static void dsp_jclr_reg(void) ! 1204: { ! 1205: /* jclr #n,R,p:xx */ ! 1206: Uint32 value, numbit; ! 1207: ! 1208: disasm_cur_inst_len++; ! 1209: ! 1210: value = (cur_inst>>8) & BITMASK(6); ! 1211: numbit = cur_inst & BITMASK(5); ! 1212: ! 1213: sprintf(str_instr,"jclr #%d,%s,p:$%04x", ! 1214: numbit, ! 1215: registers_name[value], ! 1216: read_memory(dsp_core.pc+1) ! 1217: ); ! 1218: } ! 1219: ! 1220: static void dsp_jmp_imm(void) ! 1221: { ! 1222: sprintf(str_instr,"jmp p:$%04x", cur_inst & BITMASK(12)); ! 1223: } ! 1224: ! 1225: static void dsp_jmp_ea(void) ! 1226: { ! 1227: char dstname[16]; ! 1228: ! 1229: dsp_calc_ea((cur_inst >>8) & BITMASK(6), dstname); ! 1230: ! 1231: sprintf(str_instr,"jmp p:%s", dstname); ! 1232: } ! 1233: ! 1234: static void dsp_jscc_ea(void) ! 1235: { ! 1236: char cond_name[16], addr_name[16]; ! 1237: Uint32 cc_code=0; ! 1238: ! 1239: dsp_calc_ea((cur_inst>>8) & BITMASK(6), addr_name); ! 1240: cc_code=cur_inst & BITMASK(4); ! 1241: dsp_calc_cc(cc_code, cond_name); ! 1242: ! 1243: sprintf(str_instr,"js%s p:%s", cond_name, addr_name); ! 1244: } ! 1245: ! 1246: static void dsp_jscc_imm(void) ! 1247: { ! 1248: char cond_name[16], addr_name[16]; ! 1249: Uint32 cc_code=0; ! 1250: ! 1251: sprintf(addr_name, "$%04x", cur_inst & BITMASK(12)); ! 1252: cc_code=(cur_inst>>12) & BITMASK(4); ! 1253: dsp_calc_cc(cc_code, cond_name); ! 1254: ! 1255: sprintf(str_instr,"js%s p:%s", cond_name, addr_name); ! 1256: } ! 1257: ! 1258: static void dsp_jsclr_aa(void) ! 1259: { ! 1260: /* jsclr #n,x:aa,p:xx */ ! 1261: /* jsclr #n,y:aa,p:xx */ ! 1262: char srcname[16]; ! 1263: Uint32 memspace, value, numbit; ! 1264: ! 1265: disasm_cur_inst_len++; ! 1266: ! 1267: memspace = (cur_inst>>6) & 1; ! 1268: value = (cur_inst>>8) & BITMASK(6); ! 1269: numbit = cur_inst & BITMASK(5); ! 1270: ! 1271: if (memspace) { ! 1272: sprintf(srcname, "y:$%04x", value); ! 1273: } else { ! 1274: sprintf(srcname, "x:$%04x", value); ! 1275: } ! 1276: ! 1277: sprintf(str_instr,"jsclr #%d,%s,p:$%04x", ! 1278: numbit, ! 1279: srcname, ! 1280: read_memory(dsp_core.pc+1) ! 1281: ); ! 1282: } ! 1283: ! 1284: static void dsp_jsclr_ea(void) ! 1285: { ! 1286: /* jsclr #n,x:ea,p:xx */ ! 1287: /* jsclr #n,y:ea,p:xx */ ! 1288: char srcname[16], addr_name[16]; ! 1289: Uint32 memspace, value, numbit; ! 1290: ! 1291: disasm_cur_inst_len++; ! 1292: ! 1293: memspace = (cur_inst>>6) & 1; ! 1294: value = (cur_inst>>8) & BITMASK(6); ! 1295: numbit = cur_inst & BITMASK(5); ! 1296: ! 1297: dsp_calc_ea(value, addr_name); ! 1298: if (memspace) { ! 1299: sprintf(srcname, "y:%s", addr_name); ! 1300: } else { ! 1301: sprintf(srcname, "x:%s", addr_name); ! 1302: } ! 1303: ! 1304: sprintf(str_instr,"jsclr #%d,%s,p:$%04x", ! 1305: numbit, ! 1306: srcname, ! 1307: read_memory(dsp_core.pc+1) ! 1308: ); ! 1309: } ! 1310: ! 1311: static void dsp_jsclr_pp(void) ! 1312: { ! 1313: /* jsclr #n,x:pp,p:xx */ ! 1314: /* jsclr #n,y:pp,p:xx */ ! 1315: char srcname[16]; ! 1316: Uint32 memspace, value, numbit; ! 1317: ! 1318: disasm_cur_inst_len++; ! 1319: ! 1320: memspace = (cur_inst>>6) & 1; ! 1321: value = (cur_inst>>8) & BITMASK(6); ! 1322: numbit = cur_inst & BITMASK(5); ! 1323: ! 1324: value += 0xffc0; ! 1325: if (memspace) { ! 1326: sprintf(srcname, "y:$%04x", value); ! 1327: } else { ! 1328: sprintf(srcname, "x:$%04x", value); ! 1329: } ! 1330: ! 1331: sprintf(str_instr,"jsclr #%d,%s,p:$%04x", ! 1332: numbit, ! 1333: srcname, ! 1334: read_memory(dsp_core.pc+1) ! 1335: ); ! 1336: } ! 1337: ! 1338: static void dsp_jsclr_reg(void) ! 1339: { ! 1340: /* jsclr #n,R,p:xx */ ! 1341: Uint32 value, numbit; ! 1342: ! 1343: disasm_cur_inst_len++; ! 1344: ! 1345: value = (cur_inst>>8) & BITMASK(6); ! 1346: numbit = cur_inst & BITMASK(5); ! 1347: ! 1348: sprintf(str_instr,"jsclr #%d,%s,p:$%04x", ! 1349: numbit, ! 1350: registers_name[value], ! 1351: read_memory(dsp_core.pc+1) ! 1352: ); ! 1353: } ! 1354: ! 1355: static void dsp_jset_aa(void) ! 1356: { ! 1357: /* jset #n,x:aa,p:xx */ ! 1358: /* jset #n,y:aa,p:xx */ ! 1359: char srcname[16]; ! 1360: Uint32 memspace, value, numbit; ! 1361: ! 1362: disasm_cur_inst_len++; ! 1363: ! 1364: memspace = (cur_inst>>6) & 1; ! 1365: value = (cur_inst>>8) & BITMASK(6); ! 1366: numbit = cur_inst & BITMASK(5); ! 1367: ! 1368: if (memspace) { ! 1369: sprintf(srcname, "y:$%04x", value); ! 1370: } else { ! 1371: sprintf(srcname, "x:$%04x", value); ! 1372: } ! 1373: ! 1374: sprintf(str_instr,"jset #%d,%s,p:$%04x", ! 1375: numbit, ! 1376: srcname, ! 1377: read_memory(dsp_core.pc+1) ! 1378: ); ! 1379: } ! 1380: ! 1381: static void dsp_jset_ea(void) ! 1382: { ! 1383: /* jset #n,x:ea,p:xx */ ! 1384: /* jset #n,y:ea,p:xx */ ! 1385: char srcname[16], addr_name[16]; ! 1386: Uint32 memspace, value, numbit; ! 1387: ! 1388: disasm_cur_inst_len++; ! 1389: ! 1390: memspace = (cur_inst>>6) & 1; ! 1391: value = (cur_inst>>8) & BITMASK(6); ! 1392: numbit = cur_inst & BITMASK(5); ! 1393: ! 1394: dsp_calc_ea(value, addr_name); ! 1395: if (memspace) { ! 1396: sprintf(srcname, "y:%s", addr_name); ! 1397: } else { ! 1398: sprintf(srcname, "x:%s", addr_name); ! 1399: } ! 1400: ! 1401: sprintf(str_instr,"jset #%d,%s,p:$%04x", ! 1402: numbit, ! 1403: srcname, ! 1404: read_memory(dsp_core.pc+1) ! 1405: ); ! 1406: } ! 1407: ! 1408: static void dsp_jset_pp(void) ! 1409: { ! 1410: /* jset #n,x:pp,p:xx */ ! 1411: /* jset #n,y:pp,p:xx */ ! 1412: char srcname[16]; ! 1413: Uint32 memspace, value, numbit; ! 1414: ! 1415: disasm_cur_inst_len++; ! 1416: ! 1417: memspace = (cur_inst>>6) & 1; ! 1418: value = (cur_inst>>8) & BITMASK(6); ! 1419: numbit = cur_inst & BITMASK(5); ! 1420: ! 1421: value += 0xffc0; ! 1422: if (memspace) { ! 1423: sprintf(srcname, "y:$%04x", value); ! 1424: } else { ! 1425: sprintf(srcname, "x:$%04x", value); ! 1426: } ! 1427: ! 1428: sprintf(str_instr,"jset #%d,%s,p:$%04x", ! 1429: numbit, ! 1430: srcname, ! 1431: read_memory(dsp_core.pc+1) ! 1432: ); ! 1433: } ! 1434: ! 1435: static void dsp_jset_reg(void) ! 1436: { ! 1437: /* jset #n,R,p:xx */ ! 1438: Uint32 value, numbit; ! 1439: ! 1440: disasm_cur_inst_len++; ! 1441: ! 1442: value = (cur_inst>>8) & BITMASK(6); ! 1443: numbit = cur_inst & BITMASK(5); ! 1444: ! 1445: sprintf(str_instr,"jset #%d,%s,p:$%04x", ! 1446: numbit, ! 1447: registers_name[value], ! 1448: read_memory(dsp_core.pc+1) ! 1449: ); ! 1450: } ! 1451: ! 1452: static void dsp_jsr_imm(void) ! 1453: { ! 1454: sprintf(str_instr,"jsr p:$%04x", cur_inst & BITMASK(12)); ! 1455: } ! 1456: ! 1457: static void dsp_jsr_ea(void) ! 1458: { ! 1459: char dstname[16]; ! 1460: ! 1461: dsp_calc_ea((cur_inst>>8) & BITMASK(6),dstname); ! 1462: ! 1463: sprintf(str_instr,"jsr p:%s", dstname); ! 1464: } ! 1465: ! 1466: static void dsp_jsset_aa(void) ! 1467: { ! 1468: /* jsset #n,x:aa,p:xx */ ! 1469: /* jsset #n,y:aa,p:xx */ ! 1470: char srcname[16]; ! 1471: Uint32 memspace, value, numbit; ! 1472: ! 1473: disasm_cur_inst_len++; ! 1474: ! 1475: memspace = (cur_inst>>6) & 1; ! 1476: value = (cur_inst>>8) & BITMASK(6); ! 1477: numbit = cur_inst & BITMASK(5); ! 1478: ! 1479: if (memspace) { ! 1480: sprintf(srcname, "y:$%04x", value); ! 1481: } else { ! 1482: sprintf(srcname, "x:$%04x", value); ! 1483: } ! 1484: ! 1485: sprintf(str_instr,"jsset #%d,%s,p:$%04x", ! 1486: numbit, ! 1487: srcname, ! 1488: read_memory(dsp_core.pc+1) ! 1489: ); ! 1490: } ! 1491: ! 1492: static void dsp_jsset_ea(void) ! 1493: { ! 1494: /* jsset #n,x:ea,p:xx */ ! 1495: /* jsset #n,y:ea,p:xx */ ! 1496: char srcname[16], addr_name[16]; ! 1497: Uint32 memspace, value, numbit; ! 1498: ! 1499: disasm_cur_inst_len++; ! 1500: ! 1501: memspace = (cur_inst>>6) & 1; ! 1502: value = (cur_inst>>8) & BITMASK(6); ! 1503: numbit = cur_inst & BITMASK(5); ! 1504: ! 1505: dsp_calc_ea(value, addr_name); ! 1506: if (memspace) { ! 1507: sprintf(srcname, "y:%s", addr_name); ! 1508: } else { ! 1509: sprintf(srcname, "x:%s", addr_name); ! 1510: } ! 1511: ! 1512: sprintf(str_instr,"jsset #%d,%s,p:$%04x", ! 1513: numbit, ! 1514: srcname, ! 1515: read_memory(dsp_core.pc+1) ! 1516: ); ! 1517: } ! 1518: ! 1519: static void dsp_jsset_pp(void) ! 1520: { ! 1521: /* jsset #n,x:pp,p:xx */ ! 1522: /* jsset #n,y:pp,p:xx */ ! 1523: char srcname[16]; ! 1524: Uint32 memspace, value, numbit; ! 1525: ! 1526: disasm_cur_inst_len++; ! 1527: ! 1528: memspace = (cur_inst>>6) & 1; ! 1529: value = (cur_inst>>8) & BITMASK(6); ! 1530: numbit = cur_inst & BITMASK(5); ! 1531: ! 1532: value += 0xffc0; ! 1533: if (memspace) { ! 1534: sprintf(srcname, "y:$%04x", value); ! 1535: } else { ! 1536: sprintf(srcname, "x:$%04x", value); ! 1537: } ! 1538: ! 1539: sprintf(str_instr,"jsset #%d,%s,p:$%04x", ! 1540: numbit, ! 1541: srcname, ! 1542: read_memory(dsp_core.pc+1) ! 1543: ); ! 1544: } ! 1545: ! 1546: static void dsp_jsset_reg(void) ! 1547: { ! 1548: /* jsset #n,r,p:xx */ ! 1549: Uint32 value, numbit; ! 1550: ! 1551: disasm_cur_inst_len++; ! 1552: ! 1553: value = (cur_inst>>8) & BITMASK(6); ! 1554: numbit = cur_inst & BITMASK(5); ! 1555: ! 1556: sprintf(str_instr,"jsset #%d,%s,p:$%04x", ! 1557: numbit, ! 1558: registers_name[value], ! 1559: read_memory(dsp_core.pc+1) ! 1560: ); ! 1561: } ! 1562: ! 1563: static void dsp_lua(void) ! 1564: { ! 1565: char addr_name[16], numreg; ! 1566: ! 1567: dsp_calc_ea((cur_inst>>8) & BITMASK(5), addr_name); ! 1568: numreg = cur_inst & BITMASK(3); ! 1569: ! 1570: if (cur_inst & (1<<3)) ! 1571: sprintf(str_instr,"lua %s,n%d", addr_name, numreg); ! 1572: else ! 1573: sprintf(str_instr,"lua %s,r%d", addr_name, numreg); ! 1574: } ! 1575: ! 1576: static void dsp_movec_reg(void) ! 1577: { ! 1578: Uint32 numreg1, numreg2; ! 1579: ! 1580: /* S1,D2 */ ! 1581: /* S2,D1 */ ! 1582: ! 1583: numreg2 = (cur_inst>>8) & BITMASK(6); ! 1584: numreg1 = cur_inst & BITMASK(6); ! 1585: ! 1586: if (cur_inst & (1<<15)) { ! 1587: /* Write D1 */ ! 1588: sprintf(str_instr,"movec %s,%s", registers_name[numreg2], registers_name[numreg1]); ! 1589: } else { ! 1590: /* Read S1 */ ! 1591: sprintf(str_instr,"movec %s,%s", registers_name[numreg1], registers_name[numreg2]); ! 1592: } ! 1593: } ! 1594: ! 1595: static void dsp_movec_aa(void) ! 1596: { ! 1597: const char *spacename; ! 1598: char srcname[16],dstname[16]; ! 1599: Uint32 numreg, addr; ! 1600: ! 1601: /* x:aa,D1 */ ! 1602: /* S1,x:aa */ ! 1603: /* y:aa,D1 */ ! 1604: /* S1,y:aa */ ! 1605: ! 1606: numreg = cur_inst & BITMASK(6); ! 1607: addr = (cur_inst>>8) & BITMASK(6); ! 1608: ! 1609: if (cur_inst & (1<<6)) { ! 1610: spacename="y"; ! 1611: } else { ! 1612: spacename="x"; ! 1613: } ! 1614: ! 1615: if (cur_inst & (1<<15)) { ! 1616: /* Write D1 */ ! 1617: sprintf(srcname, "%s:$%04x", spacename, addr); ! 1618: strcpy(dstname, registers_name[numreg]); ! 1619: } else { ! 1620: /* Read S1 */ ! 1621: strcpy(srcname, registers_name[numreg]); ! 1622: sprintf(dstname, "%s:$%04x", spacename, addr); ! 1623: } ! 1624: ! 1625: sprintf(str_instr,"movec %s,%s", srcname, dstname); ! 1626: } ! 1627: ! 1628: static void dsp_movec_imm(void) ! 1629: { ! 1630: Uint32 numreg; ! 1631: ! 1632: /* #xx,D1 */ ! 1633: ! 1634: numreg = cur_inst & BITMASK(6); ! 1635: ! 1636: sprintf(str_instr,"movec #$%02x,%s", (cur_inst>>8) & BITMASK(8), registers_name[numreg]); ! 1637: } ! 1638: ! 1639: static void dsp_movec_ea(void) ! 1640: { ! 1641: const char *spacename; ! 1642: char srcname[16], dstname[16], addr_name[16]; ! 1643: Uint32 numreg, ea_mode; ! 1644: int retour; ! 1645: ! 1646: /* x:ea,D1 */ ! 1647: /* S1,x:ea */ ! 1648: /* y:ea,D1 */ ! 1649: /* S1,y:ea */ ! 1650: /* #xxxx,D1 */ ! 1651: ! 1652: numreg = cur_inst & BITMASK(6); ! 1653: ea_mode = (cur_inst>>8) & BITMASK(6); ! 1654: retour = dsp_calc_ea(ea_mode, addr_name); ! 1655: ! 1656: if (cur_inst & (1<<6)) { ! 1657: spacename="y"; ! 1658: } else { ! 1659: spacename="x"; ! 1660: } ! 1661: ! 1662: if (cur_inst & (1<<15)) { ! 1663: /* Write D1 */ ! 1664: if (retour) { ! 1665: sprintf(srcname, "#%s", addr_name); ! 1666: } else { ! 1667: sprintf(srcname, "%s:%s", spacename, addr_name); ! 1668: } ! 1669: strcpy(dstname, registers_name[numreg]); ! 1670: } else { ! 1671: /* Read S1 */ ! 1672: strcpy(srcname, registers_name[numreg]); ! 1673: sprintf(dstname, "%s:%s", spacename, addr_name); ! 1674: } ! 1675: ! 1676: sprintf(str_instr,"movec %s,%s", srcname, dstname); ! 1677: } ! 1678: ! 1679: static void dsp_movem_aa(void) ! 1680: { ! 1681: /* S,p:aa */ ! 1682: /* p:aa,D */ ! 1683: char addr_name[16], srcname[16], dstname[16]; ! 1684: Uint32 numreg; ! 1685: ! 1686: sprintf(addr_name, "$%04x",(cur_inst>>8) & BITMASK(6)); ! 1687: numreg = cur_inst & BITMASK(6); ! 1688: if (cur_inst & (1<<15)) { ! 1689: /* Write D */ ! 1690: sprintf(srcname, "p:%s", addr_name); ! 1691: strcpy(dstname, registers_name[numreg]); ! 1692: } else { ! 1693: /* Read S */ ! 1694: strcpy(srcname, registers_name[numreg]); ! 1695: sprintf(dstname, "p:%s", addr_name); ! 1696: } ! 1697: ! 1698: sprintf(str_instr,"movem %s,%s", srcname, dstname); ! 1699: } ! 1700: ! 1701: static void dsp_movem_ea(void) ! 1702: { ! 1703: /* S,p:ea */ ! 1704: /* p:ea,D */ ! 1705: char addr_name[16], srcname[16], dstname[16]; ! 1706: Uint32 ea_mode, numreg; ! 1707: ! 1708: ea_mode = (cur_inst>>8) & BITMASK(6); ! 1709: dsp_calc_ea(ea_mode, addr_name); ! 1710: numreg = cur_inst & BITMASK(6); ! 1711: if (cur_inst & (1<<15)) { ! 1712: /* Write D */ ! 1713: sprintf(srcname, "p:%s", addr_name); ! 1714: strcpy(dstname, registers_name[numreg]); ! 1715: } else { ! 1716: /* Read S */ ! 1717: strcpy(srcname, registers_name[numreg]); ! 1718: sprintf(dstname, "p:%s", addr_name); ! 1719: } ! 1720: ! 1721: sprintf(str_instr,"movem %s,%s", srcname, dstname); ! 1722: } ! 1723: ! 1724: static void dsp_movep_0(void) ! 1725: { ! 1726: char srcname[16]="",dstname[16]=""; ! 1727: Uint32 addr, memspace, numreg; ! 1728: ! 1729: /* S,x:pp */ ! 1730: /* x:pp,D */ ! 1731: /* S,y:pp */ ! 1732: /* y:pp,D */ ! 1733: ! 1734: addr = 0xffc0 + (cur_inst & BITMASK(6)); ! 1735: memspace = (cur_inst>>16) & 1; ! 1736: numreg = (cur_inst>>8) & BITMASK(6); ! 1737: ! 1738: if (cur_inst & (1<<15)) { ! 1739: /* Write pp */ ! 1740: ! 1741: strcpy(srcname, registers_name[numreg]); ! 1742: ! 1743: if (memspace) { ! 1744: sprintf(dstname, "y:$%04x", addr); ! 1745: } else { ! 1746: sprintf(dstname, "x:$%04x", addr); ! 1747: } ! 1748: } else { ! 1749: /* Read pp */ ! 1750: ! 1751: if (memspace) { ! 1752: sprintf(srcname, "y:$%04x", addr); ! 1753: } else { ! 1754: sprintf(srcname, "x:$%04x", addr); ! 1755: } ! 1756: ! 1757: strcpy(dstname, registers_name[numreg]); ! 1758: } ! 1759: ! 1760: sprintf(str_instr,"movep %s,%s", srcname, dstname); ! 1761: } ! 1762: ! 1763: static void dsp_movep_1(void) ! 1764: { ! 1765: char srcname[16]="",dstname[16]="",name[16]=""; ! 1766: Uint32 addr, memspace; ! 1767: ! 1768: /* p:ea,x:pp */ ! 1769: /* x:pp,p:ea */ ! 1770: /* p:ea,y:pp */ ! 1771: /* y:pp,p:ea */ ! 1772: ! 1773: addr = 0xffc0 + (cur_inst & BITMASK(6)); ! 1774: dsp_calc_ea((cur_inst>>8) & BITMASK(6), name); ! 1775: memspace = (cur_inst>>16) & 1; ! 1776: ! 1777: if (cur_inst & (1<<15)) { ! 1778: /* Write pp */ ! 1779: ! 1780: sprintf(srcname, "p:%s", name); ! 1781: ! 1782: if (memspace) { ! 1783: sprintf(dstname, "y:$%04x", addr); ! 1784: } else { ! 1785: sprintf(dstname, "x:$%04x", addr); ! 1786: } ! 1787: } else { ! 1788: /* Read pp */ ! 1789: ! 1790: if (memspace) { ! 1791: sprintf(srcname, "y:$%04x", addr); ! 1792: } else { ! 1793: sprintf(srcname, "x:$%04x", addr); ! 1794: } ! 1795: ! 1796: sprintf(dstname, "p:%s", name); ! 1797: } ! 1798: ! 1799: sprintf(str_instr,"movep %s,%s", srcname, dstname); ! 1800: } ! 1801: ! 1802: static void dsp_movep_23(void) ! 1803: { ! 1804: char srcname[16]="",dstname[16]="",name[16]=""; ! 1805: Uint32 addr, memspace, easpace, retour; ! 1806: ! 1807: /* x:ea,x:pp */ ! 1808: /* y:ea,x:pp */ ! 1809: /* #xxxxxx,x:pp */ ! 1810: /* x:pp,x:ea */ ! 1811: /* x:pp,y:ea */ ! 1812: ! 1813: /* x:ea,y:pp */ ! 1814: /* y:ea,y:pp */ ! 1815: /* #xxxxxx,y:pp */ ! 1816: /* y:pp,y:ea */ ! 1817: /* y:pp,x:ea */ ! 1818: ! 1819: addr = 0xffc0 + (cur_inst & BITMASK(6)); ! 1820: retour = dsp_calc_ea((cur_inst>>8) & BITMASK(6), name); ! 1821: memspace = (cur_inst>>16) & 1; ! 1822: easpace = (cur_inst>>6) & 1; ! 1823: ! 1824: if (cur_inst & (1<<15)) { ! 1825: /* Write pp */ ! 1826: ! 1827: if (retour) { ! 1828: sprintf(srcname, "#%s", name); ! 1829: } else { ! 1830: if (easpace) { ! 1831: sprintf(srcname, "y:%s", name); ! 1832: } else { ! 1833: sprintf(srcname, "x:%s", name); ! 1834: } ! 1835: } ! 1836: ! 1837: if (memspace) { ! 1838: sprintf(dstname, "y:$%04x", addr); ! 1839: } else { ! 1840: sprintf(dstname, "x:$%04x", addr); ! 1841: } ! 1842: } else { ! 1843: /* Read pp */ ! 1844: ! 1845: if (memspace) { ! 1846: sprintf(srcname, "y:$%04x", addr); ! 1847: } else { ! 1848: sprintf(srcname, "x:$%04x", addr); ! 1849: } ! 1850: ! 1851: if (easpace) { ! 1852: sprintf(dstname, "y:%s", name); ! 1853: } else { ! 1854: sprintf(dstname, "x:%s", name); ! 1855: } ! 1856: } ! 1857: ! 1858: sprintf(str_instr,"movep %s,%s", srcname, dstname); ! 1859: } ! 1860: ! 1861: static void dsp_nop(void) ! 1862: { ! 1863: sprintf(str_instr,"nop"); ! 1864: } ! 1865: ! 1866: static void dsp_norm(void) ! 1867: { ! 1868: Uint32 srcreg, destreg; ! 1869: ! 1870: srcreg = DSP_REG_R0+((cur_inst>>8) & BITMASK(3)); ! 1871: destreg = DSP_REG_A+((cur_inst>>3) & 1); ! 1872: ! 1873: sprintf(str_instr,"norm %s,%s", registers_name[srcreg], registers_name[destreg]); ! 1874: } ! 1875: ! 1876: static void dsp_ori(void) ! 1877: { ! 1878: switch(cur_inst & BITMASK(2)) { ! 1879: case 0: ! 1880: sprintf(str_instr,"ori #$%02x,mr", (cur_inst>>8) & BITMASK(8)); ! 1881: break; ! 1882: case 1: ! 1883: sprintf(str_instr,"ori #$%02x,ccr", (cur_inst>>8) & BITMASK(8)); ! 1884: break; ! 1885: case 2: ! 1886: sprintf(str_instr,"ori #$%02x,omr", (cur_inst>>8) & BITMASK(8)); ! 1887: break; ! 1888: default: ! 1889: break; ! 1890: } ! 1891: ! 1892: } ! 1893: ! 1894: static void dsp_rep_aa(void) ! 1895: { ! 1896: char name[16]; ! 1897: ! 1898: /* x:aa */ ! 1899: /* y:aa */ ! 1900: ! 1901: if (cur_inst & (1<<6)) { ! 1902: sprintf(name, "y:$%04x",(cur_inst>>8) & BITMASK(6)); ! 1903: } else { ! 1904: sprintf(name, "x:$%04x",(cur_inst>>8) & BITMASK(6)); ! 1905: } ! 1906: ! 1907: sprintf(str_instr,"rep %s", name); ! 1908: } ! 1909: ! 1910: static void dsp_rep_imm(void) ! 1911: { ! 1912: /* #xxx */ ! 1913: sprintf(str_instr,"rep #$%02x", ((cur_inst>>8) & BITMASK(8)) ! 1914: + ((cur_inst & BITMASK(4))<<8)); ! 1915: } ! 1916: ! 1917: static void dsp_rep_ea(void) ! 1918: { ! 1919: char name[16],addr_name[16]; ! 1920: ! 1921: /* x:ea */ ! 1922: /* y:ea */ ! 1923: ! 1924: dsp_calc_ea((cur_inst>>8) & BITMASK(6), addr_name); ! 1925: if (cur_inst & (1<<6)) { ! 1926: sprintf(name, "y:%s",addr_name); ! 1927: } else { ! 1928: sprintf(name, "x:%s",addr_name); ! 1929: } ! 1930: ! 1931: sprintf(str_instr,"rep %s", name); ! 1932: } ! 1933: ! 1934: static void dsp_rep_reg(void) ! 1935: { ! 1936: /* R */ ! 1937: ! 1938: sprintf(str_instr,"rep %s", registers_name[(cur_inst>>8) & BITMASK(6)]); ! 1939: } ! 1940: ! 1941: static void dsp_reset(void) ! 1942: { ! 1943: sprintf(str_instr,"reset"); ! 1944: } ! 1945: ! 1946: static void dsp_rti(void) ! 1947: { ! 1948: sprintf(str_instr,"rti"); ! 1949: } ! 1950: ! 1951: static void dsp_rts(void) ! 1952: { ! 1953: sprintf(str_instr,"rts"); ! 1954: } ! 1955: ! 1956: static void dsp_stop(void) ! 1957: { ! 1958: sprintf(str_instr,"stop"); ! 1959: } ! 1960: ! 1961: static void dsp_swi(void) ! 1962: { ! 1963: sprintf(str_instr,"swi"); ! 1964: } ! 1965: ! 1966: static void dsp_tcc(void) ! 1967: { ! 1968: char ccname[16]; ! 1969: Uint32 src1reg, dst1reg, src2reg, dst2reg; ! 1970: ! 1971: dsp_calc_cc((cur_inst>>12) & BITMASK(4), ccname); ! 1972: src1reg = registers_tcc[(cur_inst>>3) & BITMASK(4)][0]; ! 1973: dst1reg = registers_tcc[(cur_inst>>3) & BITMASK(4)][1]; ! 1974: ! 1975: if (cur_inst & (1<<16)) { ! 1976: src2reg = DSP_REG_R0+((cur_inst>>8) & BITMASK(3)); ! 1977: dst2reg = DSP_REG_R0+(cur_inst & BITMASK(3)); ! 1978: ! 1979: sprintf(str_instr,"t%s %s,%s %s,%s", ! 1980: ccname, ! 1981: registers_name[src1reg], ! 1982: registers_name[dst1reg], ! 1983: registers_name[src2reg], ! 1984: registers_name[dst2reg] ! 1985: ); ! 1986: } else { ! 1987: sprintf(str_instr,"t%s %s,%s", ! 1988: ccname, ! 1989: registers_name[src1reg], ! 1990: registers_name[dst1reg] ! 1991: ); ! 1992: } ! 1993: } ! 1994: ! 1995: static void dsp_wait(void) ! 1996: { ! 1997: sprintf(str_instr,"wait"); ! 1998: } ! 1999: ! 2000: /********************************** ! 2001: * Parallel moves ! 2002: **********************************/ ! 2003: ! 2004: static void dsp_pm(void) ! 2005: { ! 2006: Uint32 value; ! 2007: ! 2008: value = (cur_inst >> 20) & BITMASK(4); ! 2009: opcodes_parmove[value](); ! 2010: } ! 2011: ! 2012: static void dsp_pm_0(void) ! 2013: { ! 2014: char space_name[16], addr_name[16]; ! 2015: Uint32 memspace, numreg1, numreg2; ! 2016: /* ! 2017: 0000 100d 00mm mrrr S,x:ea x0,D ! 2018: 0000 100d 10mm mrrr S,y:ea y0,D ! 2019: */ ! 2020: memspace = (cur_inst>>15) & 1; ! 2021: numreg1 = DSP_REG_A+((cur_inst>>16) & 1); ! 2022: dsp_calc_ea((cur_inst>>8) & BITMASK(6), addr_name); ! 2023: ! 2024: if (memspace) { ! 2025: strcpy(space_name,"y"); ! 2026: numreg2 = DSP_REG_Y0; ! 2027: } else { ! 2028: strcpy(space_name,"x"); ! 2029: numreg2 = DSP_REG_X0; ! 2030: } ! 2031: ! 2032: sprintf(parallelmove_name, ! 2033: "%s,%s:%s %s,%s", ! 2034: registers_name[numreg1], ! 2035: space_name, ! 2036: addr_name, ! 2037: registers_name[numreg2], ! 2038: registers_name[numreg1] ! 2039: ); ! 2040: } ! 2041: ! 2042: static void dsp_pm_1(void) ! 2043: { ! 2044: /* ! 2045: 0001 ffdf w0mm mrrr x:ea,D1 S2,D2 ! 2046: S1,x:ea S2,D2 ! 2047: #xxxxxx,D1 S2,D2 ! 2048: 0001 deff w1mm mrrr S1,D1 y:ea,D2 ! 2049: S1,D1 S2,y:ea ! 2050: S1,D1 #xxxxxx,D2 ! 2051: */ ! 2052: ! 2053: char addr_name[16]; ! 2054: Uint32 memspace, write_flag, retour, s1reg, s2reg, d1reg, d2reg; ! 2055: ! 2056: memspace = (cur_inst>>14) & 1; ! 2057: write_flag = (cur_inst>>15) & 1; ! 2058: retour = dsp_calc_ea((cur_inst>>8) & BITMASK(6), addr_name); ! 2059: ! 2060: if (memspace==DSP_SPACE_Y) { ! 2061: s2reg = d2reg = DSP_REG_Y0; ! 2062: switch((cur_inst>>16) & BITMASK(2)) { ! 2063: case 0: s2reg = d2reg = DSP_REG_Y0; break; ! 2064: case 1: s2reg = d2reg = DSP_REG_Y1; break; ! 2065: case 2: s2reg = d2reg = DSP_REG_A; break; ! 2066: case 3: s2reg = d2reg = DSP_REG_B; break; ! 2067: } ! 2068: ! 2069: s1reg = DSP_REG_A+((cur_inst>>19) & 1); ! 2070: d1reg = DSP_REG_X0+((cur_inst>>18) & 1); ! 2071: ! 2072: if (write_flag) { ! 2073: /* Write D2 */ ! 2074: ! 2075: if (retour) { ! 2076: sprintf(parallelmove_name,"%s,%s #%s,%s", ! 2077: registers_name[s1reg], ! 2078: registers_name[d1reg], ! 2079: addr_name, ! 2080: registers_name[d2reg] ! 2081: ); ! 2082: } else { ! 2083: sprintf(parallelmove_name,"%s,%s y:%s,%s", ! 2084: registers_name[s1reg], ! 2085: registers_name[d1reg], ! 2086: addr_name, ! 2087: registers_name[d2reg] ! 2088: ); ! 2089: } ! 2090: } else { ! 2091: /* Read S2 */ ! 2092: sprintf(parallelmove_name,"%s,%s %s,y:%s", ! 2093: registers_name[s1reg], ! 2094: registers_name[d1reg], ! 2095: registers_name[s2reg], ! 2096: addr_name ! 2097: ); ! 2098: } ! 2099: ! 2100: } else { ! 2101: s1reg = d1reg = DSP_REG_X0; ! 2102: switch((cur_inst>>18) & BITMASK(2)) { ! 2103: case 0: s1reg = d1reg = DSP_REG_X0; break; ! 2104: case 1: s1reg = d1reg = DSP_REG_X1; break; ! 2105: case 2: s1reg = d1reg = DSP_REG_A; break; ! 2106: case 3: s1reg = d1reg = DSP_REG_B; break; ! 2107: } ! 2108: ! 2109: s2reg = DSP_REG_A+((cur_inst>>17) & 1); ! 2110: d2reg = DSP_REG_Y0+((cur_inst>>16) & 1); ! 2111: ! 2112: if (write_flag) { ! 2113: /* Write D1 */ ! 2114: ! 2115: if (retour) { ! 2116: sprintf(parallelmove_name,"#%s,%s %s,%s", ! 2117: addr_name, ! 2118: registers_name[d1reg], ! 2119: registers_name[s2reg], ! 2120: registers_name[d2reg] ! 2121: ); ! 2122: } else { ! 2123: sprintf(parallelmove_name,"x:%s,%s %s,%s", ! 2124: addr_name, ! 2125: registers_name[d1reg], ! 2126: registers_name[s2reg], ! 2127: registers_name[d2reg] ! 2128: ); ! 2129: } ! 2130: } else { ! 2131: /* Read S1 */ ! 2132: sprintf(parallelmove_name,"%s,x:%s %s,%s", ! 2133: registers_name[s1reg], ! 2134: addr_name, ! 2135: registers_name[s2reg], ! 2136: registers_name[d2reg] ! 2137: ); ! 2138: } ! 2139: ! 2140: } ! 2141: } ! 2142: ! 2143: static void dsp_pm_2(void) ! 2144: { ! 2145: char addr_name[16]; ! 2146: Uint32 numreg1, numreg2; ! 2147: /* ! 2148: 0010 0000 0000 0000 nop ! 2149: 0010 0000 010m mrrr R update ! 2150: 0010 00ee eeed dddd S,D ! 2151: 001d dddd iiii iiii #xx,D ! 2152: */ ! 2153: if (((cur_inst >> 8) & 0xffff) == 0x2000) { ! 2154: return; ! 2155: } ! 2156: ! 2157: if (((cur_inst >> 8) & 0xffe0) == 0x2040) { ! 2158: dsp_calc_ea((cur_inst>>8) & BITMASK(5), addr_name); ! 2159: sprintf(parallelmove_name, "%s,r%d",addr_name, (cur_inst>>8) & BITMASK(3)); ! 2160: return; ! 2161: } ! 2162: ! 2163: if (((cur_inst >> 8) & 0xfc00) == 0x2000) { ! 2164: numreg1 = (cur_inst>>13) & BITMASK(5); ! 2165: numreg2 = (cur_inst>>8) & BITMASK(5); ! 2166: sprintf(parallelmove_name, "%s,%s", registers_name[numreg1], registers_name[numreg2]); ! 2167: return; ! 2168: } ! 2169: ! 2170: numreg1 = (cur_inst>>16) & BITMASK(5); ! 2171: sprintf(parallelmove_name, "#$%02x,%s", (cur_inst >> 8) & BITMASK(8), registers_name[numreg1]); ! 2172: } ! 2173: ! 2174: static void dsp_pm_4(void) ! 2175: { ! 2176: char addr_name[16]; ! 2177: Uint32 value, retour, ea_mode, memspace; ! 2178: /* ! 2179: 0100 l0ll w0aa aaaa l:aa,D ! 2180: S,l:aa ! 2181: 0100 l0ll w1mm mrrr l:ea,D ! 2182: S,l:ea ! 2183: 01dd 0ddd w0aa aaaa x:aa,D ! 2184: S,x:aa ! 2185: 01dd 0ddd w1mm mrrr x:ea,D ! 2186: S,x:ea ! 2187: #xxxxxx,D ! 2188: 01dd 1ddd w0aa aaaa y:aa,D ! 2189: S,y:aa ! 2190: 01dd 1ddd w1mm mrrr y:ea,D ! 2191: S,y:ea ! 2192: #xxxxxx,D ! 2193: */ ! 2194: value = (cur_inst>>16) & BITMASK(3); ! 2195: value |= (cur_inst>>17) & (BITMASK(2)<<3); ! 2196: ! 2197: ea_mode = (cur_inst>>8) & BITMASK(6); ! 2198: ! 2199: if ((value>>2)==0) { ! 2200: /* L: memory move */ ! 2201: if (cur_inst & (1<<14)) { ! 2202: retour = dsp_calc_ea(ea_mode, addr_name); ! 2203: } else { ! 2204: sprintf(addr_name,"$%04x", ea_mode); ! 2205: retour = 0; ! 2206: } ! 2207: ! 2208: value = (cur_inst>>16) & BITMASK(2); ! 2209: value |= (cur_inst>>17) & (1<<2); ! 2210: ! 2211: if (cur_inst & (1<<15)) { ! 2212: /* Write D */ ! 2213: ! 2214: if (retour) { ! 2215: sprintf(parallelmove_name, "#%s,%s", addr_name, registers_lmove[value]); ! 2216: } else { ! 2217: sprintf(parallelmove_name, "l:%s,%s", addr_name, registers_lmove[value]); ! 2218: } ! 2219: } else { ! 2220: /* Read S */ ! 2221: sprintf(parallelmove_name, "%s,l:%s", registers_lmove[value], addr_name); ! 2222: } ! 2223: ! 2224: return; ! 2225: } ! 2226: ! 2227: memspace = (cur_inst>>19) & 1; ! 2228: if (cur_inst & (1<<14)) { ! 2229: retour = dsp_calc_ea(ea_mode, addr_name); ! 2230: } else { ! 2231: sprintf(addr_name,"$%04x", ea_mode); ! 2232: retour = 0; ! 2233: } ! 2234: ! 2235: if (memspace) { ! 2236: /* Y: */ ! 2237: ! 2238: if (cur_inst & (1<<15)) { ! 2239: /* Write D */ ! 2240: ! 2241: if (retour) { ! 2242: sprintf(parallelmove_name, "#%s,%s", addr_name, registers_name[value]); ! 2243: } else { ! 2244: sprintf(parallelmove_name, "y:%s,%s", addr_name, registers_name[value]); ! 2245: } ! 2246: ! 2247: } else { ! 2248: /* Read S */ ! 2249: sprintf(parallelmove_name, "%s,y:%s", registers_name[value], addr_name); ! 2250: } ! 2251: } else { ! 2252: /* X: */ ! 2253: ! 2254: if (cur_inst & (1<<15)) { ! 2255: /* Write D */ ! 2256: ! 2257: if (retour) { ! 2258: sprintf(parallelmove_name, "#%s,%s", addr_name, registers_name[value]); ! 2259: } else { ! 2260: sprintf(parallelmove_name, "x:%s,%s", addr_name, registers_name[value]); ! 2261: } ! 2262: } else { ! 2263: /* Read S */ ! 2264: sprintf(parallelmove_name, "%s,x:%s", registers_name[value], addr_name); ! 2265: } ! 2266: } ! 2267: } ! 2268: ! 2269: static void dsp_pm_8(void) ! 2270: { ! 2271: char addr1_name[16], addr2_name[16]; ! 2272: Uint32 ea_mode1, ea_mode2, numreg1, numreg2; ! 2273: /* ! 2274: 1wmm eeff WrrM MRRR x:ea,D1 y:ea,D2 ! 2275: x:ea,D1 S2,y:ea ! 2276: S1,x:ea y:ea,D2 ! 2277: S1,x:ea S2,y:ea ! 2278: */ ! 2279: numreg1 = DSP_REG_X0; ! 2280: switch((cur_inst>>18) & BITMASK(2)) { ! 2281: case 0: numreg1 = DSP_REG_X0; break; ! 2282: case 1: numreg1 = DSP_REG_X1; break; ! 2283: case 2: numreg1 = DSP_REG_A; break; ! 2284: case 3: numreg1 = DSP_REG_B; break; ! 2285: } ! 2286: ! 2287: numreg2 = DSP_REG_Y0; ! 2288: switch((cur_inst>>16) & BITMASK(2)) { ! 2289: case 0: numreg2 = DSP_REG_Y0; break; ! 2290: case 1: numreg2 = DSP_REG_Y1; break; ! 2291: case 2: numreg2 = DSP_REG_A; break; ! 2292: case 3: numreg2 = DSP_REG_B; break; ! 2293: } ! 2294: ! 2295: ea_mode1 = (cur_inst>>8) & BITMASK(5); ! 2296: if ((ea_mode1>>3) == 0) { ! 2297: ea_mode1 |= (1<<5); ! 2298: } ! 2299: ea_mode2 = (cur_inst>>13) & BITMASK(2); ! 2300: ea_mode2 |= ((cur_inst>>20) & BITMASK(2))<<3; ! 2301: if ((ea_mode1 & (1<<2))==0) { ! 2302: ea_mode2 |= 1<<2; ! 2303: } ! 2304: if ((ea_mode2>>3) == 0) { ! 2305: ea_mode2 |= (1<<5); ! 2306: } ! 2307: ! 2308: dsp_calc_ea(ea_mode1, addr1_name); ! 2309: dsp_calc_ea(ea_mode2, addr2_name); ! 2310: ! 2311: if (cur_inst & (1<<15)) { ! 2312: if (cur_inst & (1<<22)) { ! 2313: sprintf(parallelmove_name, "x:%s,%s y:%s,%s", ! 2314: addr1_name, ! 2315: registers_name[numreg1], ! 2316: addr2_name, ! 2317: registers_name[numreg2] ! 2318: ); ! 2319: } else { ! 2320: sprintf(parallelmove_name, "x:%s,%s %s,y:%s", ! 2321: addr1_name, ! 2322: registers_name[numreg1], ! 2323: registers_name[numreg2], ! 2324: addr2_name ! 2325: ); ! 2326: } ! 2327: } else { ! 2328: if (cur_inst & (1<<22)) { ! 2329: sprintf(parallelmove_name, "%s,x:%s y:%s,%s", ! 2330: registers_name[numreg1], ! 2331: addr1_name, ! 2332: addr2_name, ! 2333: registers_name[numreg2] ! 2334: ); ! 2335: } else { ! 2336: sprintf(parallelmove_name, "%s,x:%s %s,y:%s", ! 2337: registers_name[numreg1], ! 2338: addr1_name, ! 2339: registers_name[numreg2], ! 2340: addr2_name ! 2341: ); ! 2342: } ! 2343: } ! 2344: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.