public void labels() { z80assembler z = new z80assembler(); z.loadcommands(); z.reset(); //Check labels work z.pushcommand("nop", "", "", ""); z.pushcommand("nop", "", "", ""); z.pushcommand("nop", "", "", ""); z.pushcommand("nop", "", "", ""); z.pushcommand("nop", "", "", ""); z.pushlabel("test"); z.fixlabel("test"); z.pushcommand("LD", "A", "(test)", " LD A,(test)"); z.link(); // Test is at address 5 so expect 05 00 jump address Assert.AreEqual(z.bytes[6], 05); Assert.AreEqual(z.bytes[7], 00); z.parse(" LD HL,test", ""); Assert.AreEqual(0x21, z.bytes[8]); Assert.AreEqual(00, z.bytes[9]); Assert.AreEqual(00, z.bytes[10]); z.link(); Assert.AreEqual(z.bytes[9], 0x05); Assert.AreEqual(z.bytes[10], 00); z.parse(" LD HL,5+5", ""); Assert.AreEqual(z.bytes[11], 0x21); Assert.AreEqual(z.bytes[12], 0x0A); Assert.AreEqual(z.bytes[13], 0x00); //z.matchbreak = true; z.parse(" LD HL,(test+5)", ""); z.link(); Assert.AreEqual(z.bytes[14], 0x2A); Assert.AreEqual(z.bytes[15], 0x0A); Assert.AreEqual(z.bytes[16], 0x00); // DD CB oo C6+8*b //z.parse( " SET 3, (IX+5)",""); //Assert.AreEqual(z.bytes[17] , 0xDD); //Assert.AreEqual(z.bytes[18] , 0xCB); //Assert.AreEqual(z.bytes[19] , 0x05); //Assert.AreEqual(z.bytes[20] , 0xC6+8*3); z.link(); }