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