Exemple #1
0
        public void globals2()
        {
            z80assembler z = new z80assembler();

            z.loadcommands();
            z.ramstart = 0x4000;
            z.reset();

            var wasCalled = false;

            z.DoErr += delegate(string file, int line, string description) { wasCalled = true; };

            string lines = " nop\n nop\n nop\ntest: ld hl,test \n nop\n";

            z.parse(lines, "");
            z.link();
            z.partialreset();

            Assert.IsFalse(wasCalled);

            lines = " .extern test \n nop\n nop\n nop\n ld hl,(test) \n nop\n";
            z.parse(lines, "");

            z.link();

            Assert.IsFalse(wasCalled);

            z.finallink();

            Assert.IsTrue(wasCalled);
        }
Exemple #2
0
        public void labelmath2()
        {
            z80assembler z = new z80assembler();

            z.loadcommands();
            z.ramstart = 0x4000;
            z.reset();

            var wasCalled = false;

            z.DoErr += delegate(string file, int line, string description) { wasCalled = true; };

            string lines = " .global test\n nop\n nop\ntest: .db 10,20,30";

            z.parse(lines, "");
            Assert.IsFalse(wasCalled);

            z.link();
            Assert.IsFalse(wasCalled);

            lines = " .extern test\n nop\n nop\n ld a,(test+1)";

            z.partialreset();
            z.parse(lines, "");
            Assert.IsFalse(wasCalled);

            z.link();
            Assert.IsFalse(wasCalled);

            z.finallink();
            Assert.IsFalse(wasCalled);
        }
Exemple #3
0
        public bool build()
        {
            error = false;
            assembler_Msg(" -------- BUILD STARTING -------------");

            assembler.basepath = solution.getbasepath();
            //assembler.ramstart = solution.details.ramstart;
            assembler.ramstart = 0x4000;


            assembler.Msg += new z80assembler.MsgHandler(assembler_Msg);

            assembler.reset();

            foreach (file f in solution.details.files)
            {
                if (f.assemblefile == true)
                {
                    assembler_Msg("\r\n Staring file " + f.name);
                    assembler.partialreset();
                    assembler.parse(solution.loadfile(f.name), f.name);
                    assembler.link(); // This is the per file link
                }
            }

            assembler_Msg(" \r\n-------- LINKING -------------\r\n ");

            assembler.finallink(); // This is the per file link

            assembler_Msg("\r\n --------DONE -------------");

            return(error);
        }