From 358f01881591e0ee22db8fcb7e382f5dbfe19dd0 Mon Sep 17 00:00:00 2001 From: Maxim Poliakovski Date: Fri, 8 Jan 2021 21:58:57 +0100 Subject: [PATCH] ppcopcodes: fix mcrf. --- cpu/ppc/ppcopcodes.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/cpu/ppc/ppcopcodes.cpp b/cpu/ppc/ppcopcodes.cpp index 6404722..b5328b7 100644 --- a/cpu/ppc/ppcopcodes.cpp +++ b/cpu/ppc/ppcopcodes.cpp @@ -1201,12 +1201,11 @@ void dppc_interpreter::ppc_cmpli() { // Condition Register Changes void dppc_interpreter::ppc_mcrf() { - crf_d = (ppc_cur_instruction >> 23) & 7; - crf_d = crf_d << 2; - crf_s = (ppc_cur_instruction >> 18) & 7; - crf_s = crf_d << 2; + int crf_d = (ppc_cur_instruction >> 21) & 0x1C; + int crf_s = (ppc_cur_instruction >> 16) & 0x1C; uint32_t grab_s = ppc_state.cr & (0xf0000000UL >> crf_s); - ppc_state.cr = (ppc_state.cr & ~(0xf0000000UL >> crf_d) | (grab_s << crf_d)); + + ppc_state.cr = (ppc_state.cr & ~(0xf0000000UL >> crf_d) | (grab_s >> crf_d)); } void dppc_interpreter::ppc_crand() {