public void AddDefinition_Overrides()
        {
            var assembler = new Sharp_LR35902_Assembler.Assembler();

            assembler.SetDefintion("X", 1);
            assembler.SetDefintion("X", 2);

            ushort val = 0;

            Assert.IsTrue(assembler.TryParseImmediate("X", ref val));
            Assert.AreEqual(2, val);
        }
        public void CompileInstruction_FindsDefinition_CaseInsensitive()
        {
            ushort val       = 11;
            var    assembler = new Sharp_LR35902_Assembler.Assembler();

            assembler.SetDefintion("x", val);

            var result = assembler.CompileInstruction("LD A x");

            Is(result, 0x3E, (byte)val);
        }
        public void TryParseConstant_GetDefinition_DefaultValue()
        {
            var assembler = new Sharp_LR35902_Assembler.Assembler();

            assembler.SetDefintion("B");

            ushort value = 11;

            Assert.IsTrue(assembler.TryParseImmediate("B", ref value));
            Assert.AreEqual(0, value);
        }
        public void TryParseConstant_GetDefinition_FindsIt()
        {
            ushort expectedvalue = 0x7F00;
            var    assembler     = new Sharp_LR35902_Assembler.Assembler();

            assembler.SetDefintion("XX", expectedvalue);

            ushort value = 0;

            Assert.IsTrue(assembler.TryParseImmediate("XX", ref value));
            Assert.AreEqual(expectedvalue, value);
        }