1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2 * Mupen64plus - gbc.c *
3 * Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
4 * Copyright (C) 2007 Richard Goedeken (Richard42) *
5 * Copyright (C) 2002 Hacktarux *
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. *
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. *
17 * You should have received a copy of the GNU General Public License *
18 * along with this program; if not, write to the *
19 * Free Software Foundation, Inc., *
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
21 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
26 #include "interpret.h"
28 #include "r4300/recomph.h"
29 #include "r4300/r4300.h"
30 #include "r4300/ops.h"
32 static void genbc1f_test(void)
34 test_m32rel_imm32((unsigned int*)&FCR31, 0x800000);
35 sete_m8rel((unsigned char *) &branch_taken);
40 #if defined(COUNT_INSTR)
41 inc_m32rel(&instr_count[100]);
44 gencallinterp((unsigned long long)cached_interpreter_table.BC1F, 1);
46 if (((dst->addr & 0xFFF) == 0xFFC &&
47 (dst->addr < 0x80000000 || dst->addr >= 0xC0000000))||no_compiled_jump)
49 gencallinterp((unsigned long long)cached_interpreter_table.BC1F, 1);
53 gencheck_cop1_unusable();
60 void genbc1f_out(void)
62 #if defined(COUNT_INSTR)
63 inc_m32rel(&instr_count[100]);
65 #ifdef INTERPRET_BC1F_OUT
66 gencallinterp((unsigned long long)cached_interpreter_table.BC1F_OUT, 1);
68 if (((dst->addr & 0xFFF) == 0xFFC &&
69 (dst->addr < 0x80000000 || dst->addr >= 0xC0000000))||no_compiled_jump)
71 gencallinterp((unsigned long long)cached_interpreter_table.BC1F_OUT, 1);
75 gencheck_cop1_unusable();
82 void genbc1f_idle(void)
84 #ifdef INTERPRET_BC1F_IDLE
85 gencallinterp((unsigned long long)cached_interpreter_table.BC1F_IDLE, 1);
87 if (((dst->addr & 0xFFF) == 0xFFC &&
88 (dst->addr < 0x80000000 || dst->addr >= 0xC0000000))||no_compiled_jump)
90 gencallinterp((unsigned long long)cached_interpreter_table.BC1F_IDLE, 1);
94 gencheck_cop1_unusable();
101 static void genbc1t_test(void)
103 test_m32rel_imm32((unsigned int*)&FCR31, 0x800000);
104 setne_m8rel((unsigned char *) &branch_taken);
109 #if defined(COUNT_INSTR)
110 inc_m32rel(&instr_count[101]);
112 #ifdef INTERPRET_BC1T
113 gencallinterp((unsigned long long)cached_interpreter_table.BC1T, 1);
115 if (((dst->addr & 0xFFF) == 0xFFC &&
116 (dst->addr < 0x80000000 || dst->addr >= 0xC0000000))||no_compiled_jump)
118 gencallinterp((unsigned long long)cached_interpreter_table.BC1T, 1);
122 gencheck_cop1_unusable();
129 void genbc1t_out(void)
131 #if defined(COUNT_INSTR)
132 inc_m32rel(&instr_count[101]);
134 #ifdef INTERPRET_BC1T_OUT
135 gencallinterp((unsigned long long)cached_interpreter_table.BC1T_OUT, 1);
137 if (((dst->addr & 0xFFF) == 0xFFC &&
138 (dst->addr < 0x80000000 || dst->addr >= 0xC0000000))||no_compiled_jump)
140 gencallinterp((unsigned long long)cached_interpreter_table.BC1T_OUT, 1);
144 gencheck_cop1_unusable();
151 void genbc1t_idle(void)
153 #ifdef INTERPRET_BC1T_IDLE
154 gencallinterp((unsigned long long)cached_interpreter_table.BC1T_IDLE, 1);
156 if (((dst->addr & 0xFFF) == 0xFFC &&
157 (dst->addr < 0x80000000 || dst->addr >= 0xC0000000))||no_compiled_jump)
159 gencallinterp((unsigned long long)cached_interpreter_table.BC1T_IDLE, 1);
163 gencheck_cop1_unusable();
172 #if defined(COUNT_INSTR)
173 inc_m32rel(&instr_count[102]);
175 #ifdef INTERPRET_BC1FL
176 gencallinterp((unsigned long long)cached_interpreter_table.BC1FL, 1);
178 if (((dst->addr & 0xFFF) == 0xFFC &&
179 (dst->addr < 0x80000000 || dst->addr >= 0xC0000000))||no_compiled_jump)
181 gencallinterp((unsigned long long)cached_interpreter_table.BC1FL, 1);
185 gencheck_cop1_unusable();
187 free_all_registers();
192 void genbc1fl_out(void)
194 #if defined(COUNT_INSTR)
195 inc_m32rel(&instr_count[102]);
197 #ifdef INTERPRET_BC1FL_OUT
198 gencallinterp((unsigned long long)cached_interpreter_table.BC1FL_OUT, 1);
200 if (((dst->addr & 0xFFF) == 0xFFC &&
201 (dst->addr < 0x80000000 || dst->addr >= 0xC0000000))||no_compiled_jump)
203 gencallinterp((unsigned long long)cached_interpreter_table.BC1FL_OUT, 1);
207 gencheck_cop1_unusable();
209 free_all_registers();
214 void genbc1fl_idle(void)
216 #ifdef INTERPRET_BC1FL_IDLE
217 gencallinterp((unsigned long long)cached_interpreter_table.BC1FL_IDLE, 1);
219 if (((dst->addr & 0xFFF) == 0xFFC &&
220 (dst->addr < 0x80000000 || dst->addr >= 0xC0000000))||no_compiled_jump)
222 gencallinterp((unsigned long long)cached_interpreter_table.BC1FL_IDLE, 1);
226 gencheck_cop1_unusable();
235 #if defined(COUNT_INSTR)
236 inc_m32rel(&instr_count[103]);
238 #ifdef INTERPRET_BC1TL
239 gencallinterp((unsigned long long)cached_interpreter_table.BC1TL, 1);
241 if (((dst->addr & 0xFFF) == 0xFFC &&
242 (dst->addr < 0x80000000 || dst->addr >= 0xC0000000))||no_compiled_jump)
244 gencallinterp((unsigned long long)cached_interpreter_table.BC1TL, 1);
248 gencheck_cop1_unusable();
250 free_all_registers();
255 void genbc1tl_out(void)
257 #if defined(COUNT_INSTR)
258 inc_m32rel(&instr_count[103]);
260 #ifdef INTERPRET_BC1TL_OUT
261 gencallinterp((unsigned long long)cached_interpreter_table.BC1TL_OUT, 1);
263 if (((dst->addr & 0xFFF) == 0xFFC &&
264 (dst->addr < 0x80000000 || dst->addr >= 0xC0000000))||no_compiled_jump)
266 gencallinterp((unsigned long long)cached_interpreter_table.BC1TL_OUT, 1);
270 gencheck_cop1_unusable();
272 free_all_registers();
277 void genbc1tl_idle(void)
279 #ifdef INTERPRET_BC1TL_IDLE
280 gencallinterp((unsigned long long)cached_interpreter_table.BC1TL_IDLE, 1);
282 if (((dst->addr & 0xFFF) == 0xFFC &&
283 (dst->addr < 0x80000000 || dst->addr >= 0xC0000000))||no_compiled_jump)
285 gencallinterp((unsigned long long)cached_interpreter_table.BC1TL_IDLE, 1);
289 gencheck_cop1_unusable();