MCPcopy Create free account
hub / github.com/aldelaro5/dolphin-memory-engine / Opcode18Handler

Method Opcode18Handler

Source/Common/PPC/PowerPCDisassembler.cpp:699–739  ·  view source on GitHub ↗

handles all for opcode 18

Source from the content-addressed store, hash-verified

697
698// handles all for opcode 18
699std::string PowerPCDisassembler::Opcode18Handler(const u32 binary,
700 const u32 current_instruction_address)
701{
702 u32 amt = ValueAtBits(binary, 6, 24) << 2;
703 u32 aa = ValueAtBits(binary, 30, 1);
704 u32 lk = ValueAtBits(binary, 31, 1);
705 bool is_negative = false;
706
707 if (amt >= 0x2000000)
708 {
709 is_negative = true;
710 }
711
712 std::string mnemonic = "b";
713 if (lk)
714 mnemonic += "l";
715 if (aa)
716 mnemonic += "a";
717
718 if (aa)
719 {
720 if (is_negative)
721 amt += 0xFC000000;
722 return mnemonic + " ->0x" + TS(amt, 16, 8);
723 }
724 else
725 {
726 if (current_instruction_address == 0)
727 {
728 if (!is_negative)
729 return mnemonic + " 0x" + TS(amt, 16);
730 return mnemonic + " -0x" + TS(0x2000000 - (amt - 0x2000000), 16);
731 }
732 else
733 {
734 if (is_negative)
735 amt += 0xFC000000;
736 return mnemonic + " ->0x" + TS(current_instruction_address + amt, 16, 8);
737 }
738 }
739}
740
741// handles all for opcode 18 extended opcode 16 and extended opcode 528
742std::string PowerPCDisassembler::Opcode19HandlerExt16(const u32 binary, const std::string& toAdd)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected