示例#1
0
 public void AddInstruction(Instruction instruction)
 {
     instructions.Add(instruction);
 }
示例#2
0
        private Instruction GetZeroPageAlternative(Instruction instruction)
        {
            Instruction zeroPageAlternative = null;

            if ((operandValue & 0xFF00) == 0)
            {
                switch (instruction.OperandKind)
                {
                    case OperandKind.Absolute:
                        Instruction.TryFind(instruction.Mnemonic, OperandKind.ZeroPage, out zeroPageAlternative);
                        break;
                    case OperandKind.AbsoluteX:
                        Instruction.TryFind(instruction.Mnemonic, OperandKind.ZeroPageX, out zeroPageAlternative);
                        break;
                    case OperandKind.AbsoluteY:
                        Instruction.TryFind(instruction.Mnemonic, OperandKind.ZeroPageY, out zeroPageAlternative);
                        break;
                }
            }

            return zeroPageAlternative;
        }
示例#3
0
 public static bool TryFind(string mnemonic, OperandKind operandKind, out Instruction instruction)
 {
     return SupportedInstructions.TryGetValue(GetKey(mnemonic, operandKind), out instruction);
 }
示例#4
0
        private void OnInstructionResolved(Instruction instruction)
        {
            instruction = GetZeroPageAlternative(instruction) ?? instruction;

            var operandLo = (byte) (operandValue & 0xFF);
            var operandHi = (byte) ((operandValue & 0xFF00) >> 8);
            AddOpCode(instruction.OpCode);
            switch (instruction.Length)
            {
                case 1:
                    break;
                case 2:
                    AddOpCode(operandLo);
                    break;
                case 3:
                    AddOpCode(operandLo);
                    AddOpCode(operandHi);
                    break;
            }
        }
示例#5
0
 private static void AddInstruction(Instruction instruction)
 {
     SupportedInstructions.Add(GetKey(instruction.Mnemonic, instruction.OperandKind), instruction);
 }