示例#1
0
 public override M6809Instruction Decode(uint wInstr, M6809Disassembler dasm)
 {
     if (!dasm.rdr.TryReadByte(out byte opcode))
     {
         return(dasm.CreateInvalidInstruction());
     }
     return(subDecoders[opcode].Decode(opcode, dasm));
 }
示例#2
0
 private static bool Iw(uint wInstr, M6809Disassembler dasm)
 {
     if (!dasm.rdr.TryReadBeUInt16(out ushort u))
     {
         return(false);
     }
     dasm.ops.Add(ImmediateOperand.Word16(u));
     return(true);
 }
示例#3
0
 private static bool Ib(uint wInstr, M6809Disassembler dasm)
 {
     if (!dasm.rdr.TryReadByte(out byte b))
     {
         return(false);
     }
     dasm.ops.Add(ImmediateOperand.Byte(b));
     return(true);
 }
示例#4
0
        private static bool PCw(uint wInstr, M6809Disassembler dasm)
        {
            if (!dasm.rdr.TryReadBeInt16(out short d))
            {
                return(false);
            }
            var addr = dasm.rdr.Address + d;

            dasm.ops.Add(AddressOperand.Create(addr));
            return(true);
        }
示例#5
0
        private static bool PCb(uint wInstr, M6809Disassembler dasm)
        {
            if (!dasm.rdr.TryReadByte(out byte b))
            {
                return(false);
            }
            var addr = dasm.rdr.Address + (sbyte)b;

            dasm.ops.Add(AddressOperand.Create(addr));
            return(true);
        }
示例#6
0
        private static bool Exg(uint wInstr, M6809Disassembler dasm)
        {
            if (!dasm.rdr.TryReadByte(out byte b))
            {
                return(false);
            }
            var r0 = exgRegs[(uint)b >> 4];
            var r1 = exgRegs[b & 0xF];

            if (r0 == null || r1 == null)
            {
                return(false);
            }
            dasm.ops.Add(new RegisterOperand(r0));
            dasm.ops.Add(new RegisterOperand(r1));
            return(true);
        }
示例#7
0
            public override M6809Instruction Decode(uint wInstr, M6809Disassembler dasm)
            {
                foreach (var m in mutators)
                {
                    if (!m(wInstr, dasm))
                    {
                        return(dasm.CreateInvalidInstruction());
                    }
                }
                var instr = new M6809Instruction
                {
                    InstructionClass = iclass,
                    Mnemonic         = mnemonic,
                    Operands         = dasm.ops.ToArray()
                };

                return(instr);
            }
示例#8
0
 private static bool B(uint wInstr, M6809Disassembler dasm)
 {
     dasm.ops.Add(new RegisterOperand(Registers.B));
     return(true);
 }