From 1b4de3b64eba97694813476aa23f9313ec343379 Mon Sep 17 00:00:00 2001 From: Mihai Parparita Date: Fri, 1 Dec 2023 01:30:03 -0800 Subject: [PATCH] Fix emulation of doz, dozi, and nabs POWER instructions doz and dozi were storing the result into the wrong register. nabs was not taking into account two's complement storage of numbers and was just setting the signed bit. These two instructions are used in the implementation of text measurement in native QuickDraw on 7.1.2/the PDM ROM, and the incorrect values were resulting in nothing being rendered. With the fix text appears when booting from the 7.1.2 CD. --- cpu/ppc/poweropcodes.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cpu/ppc/poweropcodes.cpp b/cpu/ppc/poweropcodes.cpp index 9721b6e..92d1cd6 100644 --- a/cpu/ppc/poweropcodes.cpp +++ b/cpu/ppc/poweropcodes.cpp @@ -115,7 +115,7 @@ void dppc_interpreter::power_doz() { if (oe_flag) power_setsoov(ppc_result_a, ppc_result_b, ppc_result_d); - ppc_store_result_rega(); + ppc_store_result_regd(); } void dppc_interpreter::power_dozi() { @@ -125,7 +125,7 @@ void dppc_interpreter::power_dozi() { } else { ppc_result_d = simm - ppc_result_a; } - ppc_store_result_rega(); + ppc_store_result_regd(); } void dppc_interpreter::power_lscbx() { @@ -223,7 +223,7 @@ void dppc_interpreter::power_mul() { void dppc_interpreter::power_nabs() { ppc_grab_regsda(); - ppc_result_d = (0x80000000 | ppc_result_a); + ppc_result_d = ppc_result_a & 0x80000000 ? ppc_result_a : -ppc_result_a; if (rc_flag) ppc_changecrf0(ppc_result_d);