1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2 * Mupen64plus - gbc.c *
3 * Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
4 * Copyright (C) 2002 Hacktarux *
6 * This program is free software; you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by *
8 * the Free Software Foundation; either version 2 of the License, or *
9 * (at your option) any later version. *
11 * This program is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU General Public License for more details. *
16 * You should have received a copy of the GNU General Public License *
17 * along with this program; if not, write to the *
18 * Free Software Foundation, Inc., *
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
20 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
25 #include "interpret.h"
27 #include "r4300/recomph.h"
28 #include "r4300/r4300.h"
29 #include "r4300/ops.h"
31 static void genbc1f_test(void)
33 test_m32_imm32((unsigned int*)&FCR31, 0x800000);
35 mov_m32_imm32((unsigned int*)(&branch_taken), 1); // 10
36 jmp_imm_short(10); // 2
37 mov_m32_imm32((unsigned int*)(&branch_taken), 0); // 10
43 gencallinterp((unsigned int)cached_interpreter_table.BC1F, 1);
45 if (((dst->addr & 0xFFF) == 0xFFC &&
46 (dst->addr < 0x80000000 || dst->addr >= 0xC0000000))||no_compiled_jump)
48 gencallinterp((unsigned int)cached_interpreter_table.BC1F, 1);
52 gencheck_cop1_unusable();
59 void genbc1f_out(void)
61 #ifdef INTERPRET_BC1F_OUT
62 gencallinterp((unsigned int)cached_interpreter_table.BC1F_OUT, 1);
64 if (((dst->addr & 0xFFF) == 0xFFC &&
65 (dst->addr < 0x80000000 || dst->addr >= 0xC0000000))||no_compiled_jump)
67 gencallinterp((unsigned int)cached_interpreter_table.BC1F_OUT, 1);
71 gencheck_cop1_unusable();
78 void genbc1f_idle(void)
80 #ifdef INTERPRET_BC1F_IDLE
81 gencallinterp((unsigned int)cached_interpreter_table.BC1F_IDLE, 1);
83 if (((dst->addr & 0xFFF) == 0xFFC &&
84 (dst->addr < 0x80000000 || dst->addr >= 0xC0000000))||no_compiled_jump)
86 gencallinterp((unsigned int)cached_interpreter_table.BC1F_IDLE, 1);
90 gencheck_cop1_unusable();
97 static void genbc1t_test(void)
99 test_m32_imm32((unsigned int*)&FCR31, 0x800000);
101 mov_m32_imm32((unsigned int*)(&branch_taken), 1); // 10
102 jmp_imm_short(10); // 2
103 mov_m32_imm32((unsigned int*)(&branch_taken), 0); // 10
108 #ifdef INTERPRET_BC1T
109 gencallinterp((unsigned int)cached_interpreter_table.BC1T, 1);
111 if (((dst->addr & 0xFFF) == 0xFFC &&
112 (dst->addr < 0x80000000 || dst->addr >= 0xC0000000))||no_compiled_jump)
114 gencallinterp((unsigned int)cached_interpreter_table.BC1T, 1);
118 gencheck_cop1_unusable();
125 void genbc1t_out(void)
127 #ifdef INTERPRET_BC1T_OUT
128 gencallinterp((unsigned int)cached_interpreter_table.BC1T_OUT, 1);
130 if (((dst->addr & 0xFFF) == 0xFFC &&
131 (dst->addr < 0x80000000 || dst->addr >= 0xC0000000))||no_compiled_jump)
133 gencallinterp((unsigned int)cached_interpreter_table.BC1T_OUT, 1);
137 gencheck_cop1_unusable();
144 void genbc1t_idle(void)
146 #ifdef INTERPRET_BC1T_IDLE
147 gencallinterp((unsigned int)cached_interpreter_table.BC1T_IDLE, 1);
149 if (((dst->addr & 0xFFF) == 0xFFC &&
150 (dst->addr < 0x80000000 || dst->addr >= 0xC0000000))||no_compiled_jump)
152 gencallinterp((unsigned int)cached_interpreter_table.BC1T_IDLE, 1);
156 gencheck_cop1_unusable();
165 #ifdef INTERPRET_BC1FL
166 gencallinterp((unsigned int)cached_interpreter_table.BC1FL, 1);
168 if (((dst->addr & 0xFFF) == 0xFFC &&
169 (dst->addr < 0x80000000 || dst->addr >= 0xC0000000))||no_compiled_jump)
171 gencallinterp((unsigned int)cached_interpreter_table.BC1FL, 1);
175 gencheck_cop1_unusable();
177 free_all_registers();
182 void genbc1fl_out(void)
184 #ifdef INTERPRET_BC1FL_OUT
185 gencallinterp((unsigned int)cached_interpreter_table.BC1FL_OUT, 1);
187 if (((dst->addr & 0xFFF) == 0xFFC &&
188 (dst->addr < 0x80000000 || dst->addr >= 0xC0000000))||no_compiled_jump)
190 gencallinterp((unsigned int)cached_interpreter_table.BC1FL_OUT, 1);
194 gencheck_cop1_unusable();
196 free_all_registers();
201 void genbc1fl_idle(void)
203 #ifdef INTERPRET_BC1FL_IDLE
204 gencallinterp((unsigned int)cached_interpreter_table.BC1FL_IDLE, 1);
206 if (((dst->addr & 0xFFF) == 0xFFC &&
207 (dst->addr < 0x80000000 || dst->addr >= 0xC0000000))||no_compiled_jump)
209 gencallinterp((unsigned int)cached_interpreter_table.BC1FL_IDLE, 1);
213 gencheck_cop1_unusable();
222 #ifdef INTERPRET_BC1TL
223 gencallinterp((unsigned int)cached_interpreter_table.BC1TL, 1);
225 if (((dst->addr & 0xFFF) == 0xFFC &&
226 (dst->addr < 0x80000000 || dst->addr >= 0xC0000000))||no_compiled_jump)
228 gencallinterp((unsigned int)cached_interpreter_table.BC1TL, 1);
232 gencheck_cop1_unusable();
234 free_all_registers();
239 void genbc1tl_out(void)
241 #ifdef INTERPRET_BC1TL_OUT
242 gencallinterp((unsigned int)cached_interpreter_table.BC1TL_OUT, 1);
244 if (((dst->addr & 0xFFF) == 0xFFC &&
245 (dst->addr < 0x80000000 || dst->addr >= 0xC0000000))||no_compiled_jump)
247 gencallinterp((unsigned int)cached_interpreter_table.BC1TL_OUT, 1);
251 gencheck_cop1_unusable();
253 free_all_registers();
258 void genbc1tl_idle(void)
260 #ifdef INTERPRET_BC1TL_IDLE
261 gencallinterp((unsigned int)cached_interpreter_table.BC1TL_IDLE, 1);
263 if (((dst->addr & 0xFFF) == 0xFFC &&
264 (dst->addr < 0x80000000 || dst->addr >= 0xC0000000))||no_compiled_jump)
266 gencallinterp((unsigned int)cached_interpreter_table.BC1TL_IDLE, 1);
270 gencheck_cop1_unusable();