1 /* 2 DSP M56001 emulation 3 Instructions interpreter, execution thread 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 Foundation, 19 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA 20 */ 21 22 #ifndef DSP_CPU_H 23 #define DSP_CPU_H 24 25 #ifdef __cplusplus 26 extern "C" { 27 #endif 28 29 /* Defines */ 30 #define BITMASK(x) ((1<<(x))-1) 31 32 #define DSP_OMR_MA 0x00 33 #define DSP_OMR_MB 0x01 34 #define DSP_OMR_DE 0x02 35 #define DSP_OMR_SD 0x06 36 #define DSP_OMR_EA 0x07 37 38 #define DSP_SR_C 0x00 39 #define DSP_SR_V 0x01 40 #define DSP_SR_Z 0x02 41 #define DSP_SR_N 0x03 42 #define DSP_SR_U 0x04 43 #define DSP_SR_E 0x05 44 #define DSP_SR_L 0x06 45 46 #define DSP_SR_I0 0x08 47 #define DSP_SR_I1 0x09 48 #define DSP_SR_S0 0x0a 49 #define DSP_SR_S1 0x0b 50 #define DSP_SR_T 0x0d 51 #define DSP_SR_LF 0x0f 52 53 #define DSP_SP_SE 0x04 54 #define DSP_SP_UF 0x05 55 56 /* Registers numbers in dsp.registers[] */ 57 #define DSP_REG_X0 0x04 58 #define DSP_REG_X1 0x05 59 #define DSP_REG_Y0 0x06 60 #define DSP_REG_Y1 0x07 61 #define DSP_REG_A0 0x08 62 #define DSP_REG_B0 0x09 63 #define DSP_REG_A2 0x0a 64 #define DSP_REG_B2 0x0b 65 #define DSP_REG_A1 0x0c 66 #define DSP_REG_B1 0x0d 67 #define DSP_REG_A 0x0e 68 #define DSP_REG_B 0x0f 69 70 #define DSP_REG_R0 0x10 71 #define DSP_REG_R1 0x11 72 #define DSP_REG_R2 0x12 73 #define DSP_REG_R3 0x13 74 #define DSP_REG_R4 0x14 75 #define DSP_REG_R5 0x15 76 #define DSP_REG_R6 0x16 77 #define DSP_REG_R7 0x17 78 79 #define DSP_REG_N0 0x18 80 #define DSP_REG_N1 0x19 81 #define DSP_REG_N2 0x1a 82 #define DSP_REG_N3 0x1b 83 #define DSP_REG_N4 0x1c 84 #define DSP_REG_N5 0x1d 85 #define DSP_REG_N6 0x1e 86 #define DSP_REG_N7 0x1f 87 88 #define DSP_REG_M0 0x20 89 #define DSP_REG_M1 0x21 90 #define DSP_REG_M2 0x22 91 #define DSP_REG_M3 0x23 92 #define DSP_REG_M4 0x24 93 #define DSP_REG_M5 0x25 94 #define DSP_REG_M6 0x26 95 #define DSP_REG_M7 0x27 96 97 #define DSP_REG_SR 0x39 98 #define DSP_REG_OMR 0x3a 99 #define DSP_REG_SP 0x3b 100 #define DSP_REG_SSH 0x3c 101 #define DSP_REG_SSL 0x3d 102 #define DSP_REG_LA 0x3e 103 #define DSP_REG_LC 0x3f 104 105 #define DSP_REG_NULL 0x00 106 #define DSP_REG_LCSAVE 0x30 107 108 /* Memory spaces for dsp.ram[], dsp.rom[] */ 109 #define DSP_SPACE_X 0x00 110 #define DSP_SPACE_Y 0x01 111 #define DSP_SPACE_P 0x02 112 113 /* Functions */ 114 extern void dsp56k_init_cpu(void); /* Set dsp_core to use */ 115 extern void dsp56k_execute_instruction(void); /* Execute 1 instruction */ 116 extern Uint16 dsp56k_execute_one_disasm_instruction(FILE *out, Uint16 pc); /* Execute 1 instruction in disasm mode */ 117 118 /* Interrupt relative functions */ 119 void dsp_add_interrupt(Uint16 inter); 120 121 #ifdef __cplusplus 122 } 123 #endif 124 125 #endif /* DSP_CPU_H */ 126