예제 #1
0
        public void TestAddUninitialized()
        {
            var output = new Compilation();

            output.AddUninitialized(4);
            Assert.AreEqual(4, output.LogicalPC);

            output.SetPC(0xC000);
            output.AddUninitialized(16);
            Assert.AreEqual(0xC010, output.LogicalPC);
        }
예제 #2
0
        public void TestLogicalRelocation()
        {
            var output = new Compilation();

            output.SetPC(0xc000);
            Assert.AreEqual(0xc000, output.LogicalPC);
            Assert.AreEqual(0xc000, output.ProgramCounter);

            // nope can't do this!
            Assert.Throws <Compilation.InvalidPCAssignmentException>(() => output.SetPC(0x8000));

            output.SetLogicalPC(0xf000);
            Assert.AreNotEqual(output.ProgramCounter, output.LogicalPC);

            output.Add(0xfeedface, 4);
            Assert.AreEqual(0xc000, output.ProgramStart);
            Assert.AreEqual(0xc004, output.ProgramCounter);
            Assert.AreEqual(0xf004, output.LogicalPC);

            output.SynchPC();
            Assert.AreEqual(output.ProgramCounter, output.LogicalPC);

            output.SetLogicalPC(0x0002); // set to zp
            Assert.AreEqual(0x0002, output.LogicalPC);

            output.AddUninitialized(0x80);
            Assert.AreEqual(0x0082, output.LogicalPC);
        }
예제 #3
0
        public void TestProgramStart()
        {
            var output = new Compilation();

            output.SetPC(0x02);
            output.AddUninitialized(0x32);
            Assert.AreEqual(0x02 + 0x32, output.LogicalPC);

            // program start will not be set until we add
            // initialized data
            output.SetPC(0x0801);
            output.Add(0xffd220, 3);
            Assert.AreEqual(0x0801, output.ProgramStart);
            Assert.AreEqual(0x0804, output.LogicalPC);
        }