Add 5106, 5146, 5186 codes for indirect reads from a register code

This commit is contained in:
Silent
2022-04-15 19:04:02 +02:00
parent 8777bb17be
commit 506796a335
2 changed files with 27 additions and 7 deletions

View File

@ -1492,6 +1492,10 @@ void CheatCode::Apply() const
case 0x05: // Write the u8 poke value to cht_register[cht_reg_no1]
cht_register[cht_reg_no1] = Truncate8(poke_value & 0xFFu);
break;
case 0x06: // Read the u8 value from the address (cht_register[cht_reg_no2] + poke_value) to
// cht_register[cht_reg_no1]
cht_register[cht_reg_no1] = DoMemoryRead<u8>(cht_register[cht_reg_no2] + poke_value);
break;
case 0x40: // Write the u16 from cht_register[cht_reg_no1] to address
DoMemoryWrite<u16>(inst.value32, Truncate16(cht_register[cht_reg_no1] & 0xFFFFu));
@ -1515,6 +1519,10 @@ void CheatCode::Apply() const
case 0x45: // Write the u16 poke value to cht_register[cht_reg_no1]
cht_register[cht_reg_no1] = Truncate16(poke_value & 0xFFFFu);
break;
case 0x46: // Read the u16 value from the address (cht_register[cht_reg_no2] + poke_value) to
// cht_register[cht_reg_no1]
cht_register[cht_reg_no1] = DoMemoryRead<u16>(cht_register[cht_reg_no2] + poke_value);
break;
case 0x80: // Write the u32 from cht_register[cht_reg_no1] to address
DoMemoryWrite<u32>(inst.value32, cht_register[cht_reg_no1]);
@ -1536,6 +1544,10 @@ void CheatCode::Apply() const
case 0x85: // Write the u32 poke value to cht_register[cht_reg_no1]
cht_register[cht_reg_no1] = poke_value;
break;
case 0x86: // Read the u32 value from the address (cht_register[cht_reg_no2] + poke_value) to
// cht_register[cht_reg_no1]
cht_register[cht_reg_no1] = DoMemoryRead<u32>(cht_register[cht_reg_no2] + poke_value);
break;
case 0xC0: // Reg3 = Reg2 + Reg1
cht_register[cht_reg_no3] = cht_register[cht_reg_no2] + cht_register[cht_reg_no1];