PSP-EMU rev 57
Un emulador en c++ para SONY PSP
|
00001 00009 #ifndef CALLEGREXDEFS_H_ 00010 #define CALLEGREXDEFS_H_ 00011 00012 #include <inttypes.h> 00013 #include "general_emu.h" 00014 00015 /* REGISTROS */ 00016 00020 typedef uint32_t tRegistro; 00021 00022 00023 union tRegistroInst 00024 { 00025 uint32_t valor; 00026 00027 struct 00028 { 00029 unsigned : 26; 00030 unsigned opcode : 6; 00031 } generico; 00032 00033 struct 00034 { 00035 unsigned func : 6; 00036 unsigned sa : 5; 00037 unsigned rD : 5; 00038 unsigned rT : 5; 00039 unsigned rS : 5; 00040 unsigned : 6; 00041 } tipoR; 00042 00043 struct 00044 { 00045 unsigned imm :16; 00046 unsigned rT : 5; 00047 unsigned rS : 5; 00048 unsigned : 6; 00049 } tipoI; 00050 00051 struct 00052 { 00053 unsigned off :26; 00054 unsigned tipo : 1; 00055 unsigned : 5; 00056 } tipoJ; 00057 00058 struct 00059 { 00060 unsigned func : 6; 00061 unsigned rD : 5; 00062 unsigned rS : 5; 00063 unsigned rT : 5; 00064 unsigned fmt : 5; 00065 unsigned cpN : 2; 00066 unsigned : 4; 00067 } tipoCP; 00068 }; 00069 00070 union tRegistroDoble 00071 { 00072 uint64_t valor; 00073 struct 00074 { 00075 uint32_t lo; 00076 uint32_t hi; 00077 }; 00078 }; 00079 00083 #define NUM_REG_GENERICOS 32 00084 00085 00086 #define REG_ZR 0 00087 #define REG_AT 1 00088 #define REG_V0 2 00089 #define REG_V1 3 00090 #define REG_A0 4 00091 #define REG_A1 5 00092 #define REG_A2 6 00093 #define REG_A3 7 00094 #define REG_T0 8 00095 #define REG_T1 9 00096 #define REG_T2 10 00097 #define REG_T3 11 00098 #define REG_T4 12 00099 #define REG_T5 13 00100 #define REG_T6 14 00101 #define REG_T7 15 00102 #define REG_S0 16 00103 #define REG_S1 17 00104 #define REG_S2 18 00105 #define REG_S3 19 00106 #define REG_S4 20 00107 #define REG_S5 21 00108 #define REG_S6 22 00109 #define REG_S7 23 00110 #define REG_T8 24 00111 #define REG_T9 25 00112 #define REG_K0 26 00113 #define REG_K1 27 00114 #define REG_GP 28 00115 #define REG_SP 29 00116 #define REG_FP 30 00117 #define REG_RA 31 00118 00119 // Valores de registros 00120 #define REG_VALOR_DEFECTO 0 00121 #define REG_VALOR_INICIAL_PC 0xBFC00000 00122 #define REG_VALOR_INICIAL_SP 0x7FFFEFFC 00123 00124 /* PIPELINE */ 00125 00129 #define TAM_PIPLINE 2 00130 00131 /* INSTRUCCIONES */ 00132 00136 #define TAM_INSTRUCCION sizeof(tWord) // En bytes 00137 00141 #define NUM_OPCODES 64 00142 00143 #define INST_NOP 0x00000000 00144 00145 // Tipo R (campo func. de la instr. tipo R) 00146 #define INST_SLL 0x00 00147 #define INST_SRL 0x02 00148 #define INST_SRA 0x03 00149 #define INST_SLLV 0x04 00150 #define INST_SRLV 0x06 00151 #define INST_SRAV 0x07 00152 00153 #define INST_JR 0x08 00154 #define INST_JALR 0x09 00155 #define INST_MOVZ 0x0A 00156 #define INST_MOVNZ 0x0B 00157 #define INST_SYSCALL 0x0C 00158 #define INST_BREAK 0x0D 00159 #define INST_SYNC 0x0F 00160 00161 #define INST_MFHI 0x10 00162 #define INST_MTHI 0x11 00163 #define INST_MFLO 0x12 00164 #define INST_MTLO 0x13 00165 00166 #define INST_MULT 0x18 00167 #define INST_MULTU 0x19 00168 #define INST_DIV 0x1A 00169 #define INST_DIVU 0x1B 00170 00171 #define INST_ADD 0x20 00172 #define INST_ADDU 0x21 00173 #define INST_SUB 0x22 00174 #define INST_SUBU 0x23 00175 #define INST_AND 0x24 00176 #define INST_OR 0x25 00177 #define INST_XOR 0x26 00178 #define INST_NOR 0x27 00179 00180 #define INST_SLT 0x2A 00181 #define INST_SLTU 0x2B 00182 00183 #define INST_TGE 0x30 00184 #define INST_TGEU 0x31 00185 #define INST_TLT 0x32 00186 #define INST_TLTU 0x33 00187 #define INST_TEQ 0x34 00188 #define INST_TNE 0x36 00189 00190 00191 // Tipo REGIMM 00192 #define INST_RIMM_BLTZ 0x00 00193 #define INST_RIMM_BGEZ 0x01 00194 #define INST_RIMM_BLTZL 0x02 00195 #define INST_RIMM_BGEZL 0x03 00196 00197 #define INST_RIMM_TGEI 0x08 00198 #define INST_RIMM_TGEIU 0x09 00199 #define INST_RIMM_TLTI 0x0A 00200 #define INST_RIMM_TLTIU 0x0B 00201 #define INST_RIMM_TEQI 0x0C 00202 #define INST_RIMM_TNEI 0x0E 00203 00204 #define INST_RIMM_BLTZAL 0x10 00205 #define INST_RIMM_BGEZAL 0x11 00206 #define INST_RIMM_BLTZALL 0x12 00207 #define INST_RIMM_BGEZALL 0x13 00208 00212 #define INST_MASC_J 0xC0000000 00213 00214 00215 #endif /* CALLEGREXINFO_H_ */