Beispiel #1
0
        public void ParseImmediate_IntelSyntax()
        {
            OperandParser    opp = Create16BitParser("21Eh");
            ParsedOperand    po  = opp.ParseOperand();
            ImmediateOperand mop = (ImmediateOperand)po.Operand;

            Assert.AreEqual("021E", mop.ToString(MachineInstructionRendererOptions.Default));
        }
Beispiel #2
0
        public void ParseRegisterOperand()
        {
            OperandParser opp = Create16BitParser("eax");
            ParsedOperand po  = opp.ParseOperand();

            Assert.AreEqual("RegisterOperand", po.Operand.GetType().Name);
            Assert.AreEqual("eax", po.Operand.ToString());
        }
Beispiel #3
0
        public void ParseMemoryAccess_IntelSyntax_NegativeOffset()
        {
            OperandParser opp = Create16BitParser("[ebp-70h]");
            ParsedOperand po  = opp.ParseOperand();
            var           mop = (MemoryOperand)po.Operand;

            Assert.AreEqual("[ebp-70]", mop.ToString(MachineInstructionRendererOptions.Default));
        }
Beispiel #4
0
        public void ParseMemoryOperandWithSpecifiedWidth()
        {
            OperandParser opp = Create16BitParser("byte ptr [bx]");
            ParsedOperand po  = opp.ParseOperand();
            MemoryOperand mop = (MemoryOperand)po.Operand;

            Assert.AreSame(PrimitiveType.Byte, mop.Width);
            Assert.AreSame(Registers.bx, mop.Base);
        }
Beispiel #5
0
        public void ParseMemoryOperandWithUnspecifiedWidth()
        {
            OperandParser opp = Create16BitParser("[bx]");
            ParsedOperand po  = opp.ParseOperand();
            MemoryOperand mop = (MemoryOperand)po.Operand;

            Assert.IsNull(po.Operand.Width, "Operand width should have been null, was " + po.Operand.Width);
            Assert.AreSame(Registers.bx, mop.Base);
        }
Beispiel #6
0
        public void ParseSibMemoryOperand()
        {
            OperandParser opp = Create16BitParser("[eax+eax*4]");
            ParsedOperand po  = opp.ParseOperand();
            MemoryOperand mop = (MemoryOperand)po.Operand;

            Assert.IsNull(mop.Width, "Width should be undefined, but is " + mop.Width);
            Assert.IsNull(mop.Offset, "Offset should be null, but is " + mop.Offset);
            Assert.AreEqual("[eax+eax*4]", mop.ToString(MachineInstructionWriterOptions.None));
        }
Beispiel #7
0
        public void ParseNumericMemoryOperand()
        {
            OperandParser opp = Create16BitParser("[0x21E]");
            ParsedOperand po  = opp.ParseOperand();
            MemoryOperand mop = (MemoryOperand)po.Operand;

            Assert.IsNull(mop.Width, "Width should be undefined, but is " + mop.Width);
            Assert.AreSame(PrimitiveType.Word16, mop.Offset.DataType);
            Assert.AreEqual("[021E]", mop.ToString(MachineInstructionWriterOptions.None));
        }
Beispiel #8
0
        public void ParseMemorySymbol()
        {
            OperandParser opp = Create16BitParser("[foo]");
            ParsedOperand po  = opp.ParseOperand();
            MemoryOperand mop = (MemoryOperand)po.Operand;

            Assert.IsNull(mop.Width, "Width should be undefined, but is " + mop.Width);
            Assert.IsNotNull(po.Symbol, "Should have defined symbol foo");
            Assert.AreEqual("[0000]", mop.ToString(MachineInstructionWriterOptions.None));
        }
Beispiel #9
0
 public void Sta(ParsedOperand op)
 {
     EmitOpcodeOperand(Mnemonic.sta, op.Operand);
 }
Beispiel #10
0
 public void Ldy(ParsedOperand op)
 {
     EmitOpcodeOperand(Mnemonic.ldy, op.Operand);
 }
Beispiel #11
0
 public void Rol(ParsedOperand op)
 {
     EmitOpcodeOperand(Mnemonic.rol, op.Operand);
 }
Beispiel #12
0
 public void Inc(ParsedOperand op)
 {
     EmitOpcodeOperand(Mnemonic.inc, op.Operand);
 }
Beispiel #13
0
 public void Cpy(ParsedOperand op)
 {
     EmitOpcodeOperand(Mnemonic.cpy, op.Operand);
 }
Beispiel #14
0
 public void Asl(ParsedOperand op)
 {
     EmitOpcodeOperand(Mnemonic.asl, op.Operand);
 }
Beispiel #15
0
 public void Adc(ParsedOperand op)
 {
     EmitOpcodeOperand(Mnemonic.adc, op.Operand);
 }