Example #1
0
 private static bool imm(uint wInstr, Mos65816Disassembler dasm)
 {
     if (!dasm.rdr.TryReadByte(out byte imm))
     {
         return(false);
     }
     dasm.ops.Add(ImmediateOperand.Byte(imm));
     return(true);
 }
Example #2
0
 // abs = $0000
 private static bool abs(uint wInstr, Mos65816Disassembler dasm)
 {
     if (!dasm.rdr.TryReadLeUInt16(out ushort imm))
     {
         return(false);
     }
     dasm.ops.Add(new Operand(PrimitiveType.Byte)
     {
         Mode   = AddressMode.Absolute,
         Offset = Constant.Word16(imm),
     });
     return(true);
 }
Example #3
0
 // idp = ($00)
 private static bool idp(uint wInstr, Mos65816Disassembler dasm)
 {
     if (!dasm.rdr.TryReadByte(out byte imm))
     {
         return(false);
     }
     dasm.ops.Add(new Operand(PrimitiveType.Byte)
     {
         Mode   = AddressMode.DirectPageIndirect,
         Offset = Constant.Byte(imm),
     });
     return(true);
 }
Example #4
0
 private static bool sr(uint wInstr, Mos65816Disassembler dasm)
 {
     if (!dasm.rdr.TryReadByte(out byte imm))
     {
         return(false);
     }
     dasm.ops.Add(new Operand(PrimitiveType.Byte)
     {
         Mode     = AddressMode.StackRelative,
         Offset   = Constant.Byte(imm),
         Register = Registers.s,
     });
     return(true);
 }
Example #5
0
        // rell = $0000 (16 bits PC-relative)
        private static bool rell(uint wInstr, Mos65816Disassembler dasm)
        {
            if (!dasm.rdr.TryReadLeInt16(out short rel))
            {
                return(false);
            }

            dasm.ops.Add(new Operand(PrimitiveType.Byte)
            {
                Mode   = AddressMode.Immediate,
                Offset = Constant.Word16((ushort)((int)dasm.rdr.Address.Offset + rel)),
            });
            return(true);
        }
Example #6
0
 // isy = ($00,S),Y
 private static bool isy(uint wInstr, Mos65816Disassembler dasm)
 {
     if (!dasm.rdr.TryReadByte(out byte imm))
     {
         return(false);
     }
     dasm.ops.Add(new Operand(PrimitiveType.Byte)
     {
         Mode     = AddressMode.StackRelativeIndirectIndexedY,
         Offset   = Constant.Byte(imm),
         Register = Mos65816Architecture.Y
     });
     return(true);
 }
Example #7
0
 // bm = $00,$00
 private static bool bm(uint wInstr, Mos65816Disassembler dasm)
 {
     if (!dasm.rdr.TryReadByte(out byte bankDst) ||
         !dasm.rdr.TryReadByte(out byte bankSrc))
     {
         return(false);
     }
     dasm.ops.Add(new Operand(PrimitiveType.Byte)
     {
         Mode   = AddressMode.Immediate,
         Offset = Constant.Byte(bankDst)
     });
     dasm.ops.Add(new Operand(PrimitiveType.Byte)
     {
         Mode   = AddressMode.Immediate,
         Offset = Constant.Byte(bankSrc)
     });
     return(true);
 }
Example #8
0
        // alx = $000000,X
        private static bool alx(uint wInstr, Mos65816Disassembler dasm)
        {
            if (!dasm.rdr.TryReadLeUInt16(out ushort immLo))
            {
                return(false);
            }
            if (!dasm.rdr.TryReadByte(out byte immHi))
            {
                return(false);
            }

            var abs = ((uint)immHi << 16) | immLo;

            dasm.ops.Add(new Operand(PrimitiveType.Byte)
            {
                Mode   = AddressMode.AbsoluteLongX,
                Offset = Constant.Create(Mos65816Architecture.Word24, abs),
            });
            return(true);
        }