コード例 #1
0
        public static String GetOpcodeCB(OpcodeCB opcode, ref UInt16 address)
        {
            String str_op = "nop";

            switch (opcode)
            {
            case OpcodeCB.OPCODE_CB_SWAP_A:
                str_op   = "[CB] SWAP A";
                address += 2;
                break;

            case OpcodeCB.OPCODE_CB_BIT_7_H:
                str_op   = "[CB] BIT 7 H";
                address += 1;
                break;

            case OpcodeCB.OPCODE_CB_RL_C_CF:
                str_op   = "[CB] RL C (CF)";
                address += 1;
                break;

            case OpcodeCB.OPCODE_CB_RES_B_A:
                str_op   = "[CB] RES A, 0";
                address += 1;
                break;

            default:
                str_op   = "[CB] UNKNOWN";
                address += 1;
                break;
            }
            return(str_op);
        }
コード例 #2
0
        public override string ToString()
        {
            var operand =
                OperandType == OperandType.Byte ? string.Format(" 0x{0:x2}", Immediate) :
                OperandType == OperandType.Word ? string.Format(" 0x{0:x4}", Immediate) :
                "";

            string opcodeStr;

            switch (Opcode)
            {
            case Z80Opcode.PrefixCB:
                opcodeStr = OpcodeCB.ToString();
                break;

            case Z80Opcode.PrefixDD:
                switch (OpcodeDD)
                {
                case Z80OpcodeDD.PrefixDDCB:
                    opcodeStr = OpcodeDDCB.ToString();
                    break;

                default:
                    opcodeStr = OpcodeDD.ToString();
                    break;
                }
                break;

            case Z80Opcode.PrefixED:
                opcodeStr = OpcodeED.ToString();
                break;

            case Z80Opcode.PrefixFD:
                switch (OpcodeFD)
                {
                case Z80OpcodeFD.PrefixFDCB:
                    opcodeStr = OpcodeFDCB.ToString();
                    break;

                default:
                    opcodeStr = OpcodeFD.ToString();
                    break;
                }
                break;

            default:
                opcodeStr = Opcode.ToString();
                break;
            }

            return(string.Format(
                       "{0}{1}",
                       opcodeStr,
                       operand));
        }
コード例 #3
0
 public static void ExecuteOpcodeCB(OpcodeCB opcode)
 {
     if (opcodesCB[opcode] != null)
     {
         opcodesCB[opcode].Invoke();
     }
     else
     {
         UInt16 address = cpu.get_reg_pc();
         cpu.set_reg_pc((UInt16)(address + 1));
         Logger.AppendLog(Logger.LOG_LEVEL.LOG_LEVEL_DEBUG, "Trying to execute not implemented opcode: CB " + opcode.ToString());
     }
 }