mirror of
https://github.com/dingusdev/dingusppc.git
synced 2025-01-10 13:29:38 +00:00
Templating bclr to match with bcctr
This commit is contained in:
parent
04526012f9
commit
eb07a3c2f1
@ -417,8 +417,7 @@ extern void do_ctx_sync(void);
|
||||
// The functions used by the PowerPC processor
|
||||
namespace dppc_interpreter {
|
||||
template <bool l, bool for601> extern void ppc_bcctr();
|
||||
extern void ppc_bclr();
|
||||
extern void ppc_bclrl();
|
||||
template <bool l> extern void ppc_bclr();
|
||||
extern void ppc_crand();
|
||||
extern void ppc_crandc();
|
||||
extern void ppc_creqv();
|
||||
|
@ -212,10 +212,10 @@ void ppc_opcode19() {
|
||||
ppc_mcrf();
|
||||
break;
|
||||
case 32:
|
||||
ppc_bclr();
|
||||
ppc_bclr<false>();
|
||||
break;
|
||||
case 33:
|
||||
ppc_bclrl();
|
||||
ppc_bclr<true>();
|
||||
break;
|
||||
case 66:
|
||||
ppc_crnor();
|
||||
|
@ -1255,6 +1255,7 @@ template void dppc_interpreter::ppc_bcctr<false, true>();
|
||||
template void dppc_interpreter::ppc_bcctr<true, false>();
|
||||
template void dppc_interpreter::ppc_bcctr<true, true>();
|
||||
|
||||
template <bool l>
|
||||
void dppc_interpreter::ppc_bclr() {
|
||||
uint32_t br_bo = (ppc_cur_instruction >> 21) & 31;
|
||||
uint32_t br_bi = (ppc_cur_instruction >> 16) & 31;
|
||||
@ -1271,26 +1272,14 @@ void dppc_interpreter::ppc_bclr() {
|
||||
ppc_next_instruction_address = (ppc_state.spr[SPR::LR] & ~3UL);
|
||||
exec_flags = EXEF_BRANCH;
|
||||
}
|
||||
|
||||
if (l)
|
||||
ppc_state.spr[SPR::LR] = ppc_state.pc + 4;
|
||||
}
|
||||
|
||||
void dppc_interpreter::ppc_bclrl() {
|
||||
uint32_t br_bo = (ppc_cur_instruction >> 21) & 31;
|
||||
uint32_t br_bi = (ppc_cur_instruction >> 16) & 31;
|
||||
uint32_t ctr_ok;
|
||||
uint32_t cnd_ok;
|
||||
template void dppc_interpreter::ppc_bclr<false>();
|
||||
template void dppc_interpreter::ppc_bclr<true>();
|
||||
|
||||
if (!(br_bo & 0x04)) {
|
||||
(ppc_state.spr[SPR::CTR])--; /* decrement CTR */
|
||||
}
|
||||
ctr_ok = (br_bo & 0x04) | ((ppc_state.spr[SPR::CTR] != 0) == !(br_bo & 0x02));
|
||||
cnd_ok = (br_bo & 0x10) | (!(ppc_state.cr & (0x80000000UL >> br_bi)) == !(br_bo & 0x08));
|
||||
|
||||
if (ctr_ok && cnd_ok) {
|
||||
ppc_next_instruction_address = (ppc_state.spr[SPR::LR] & ~3UL);
|
||||
exec_flags = EXEF_BRANCH;
|
||||
}
|
||||
ppc_state.spr[SPR::LR] = ppc_state.pc + 4;
|
||||
}
|
||||
// Compare Instructions
|
||||
|
||||
void dppc_interpreter::ppc_cmp() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user