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));
        }
Beispiel #2
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());
     }
 }