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); }
static void Main(string[] args) { Audio sing = new Audio("Scorpions", new DateTime(1990), "Classic rok", "Wind of Change", 4970250, new TimeSpan(0, 5, 10), 320); Image photo = new Image("Unknown", new DateTime(1990), "AlbumArt", "Scorpions", 65536, "500x500"); Video clip = new Video("Scorpions", new DateTime(1990), "Classic rok", "Wind of Change", 555, new TimeSpan(0, 5, 10), Quality.Best); AudioUrl sing1 = new AudioUrl("Scorpions", new DateTime(1990), "Classic rok", "Wind of Change", 4970250, new TimeSpan(0, 5, 10), 320, "http://mmm"); ImageURL photo1 = new ImageURL("Unknown", new DateTime(1990), "AlbumArt", "Scorpions", 65536, "500x500", "http://mmm"); VideoURL clip1 = new VideoURL("Scorpions", new DateTime(1990), "Classic rok", "Wind of Change", 555, new TimeSpan(0, 5, 10), Quality.Best, "http://mmm"); Disk disk = new Disk("MyDisk", DateTime.Now); disk.Add(sing); disk.Add(photo); disk.Add(clip); // Error Serial serial = new Serial("MySerial", DateTime.Now); serial.Add(new Video("Scorpions", new DateTime(1990), "Classic rok", "Wind of Change", 555, new TimeSpan(0, 5, 10), Quality.Best)); serial.Add(new Image("Unknown", new DateTime(1990), "AlbumArt", "Scorpions", 65536, "500x500")); serial.Add(new Audio("Scorpions", new DateTime(1990), "Classic rok", "Wind of Change", 4970250, new TimeSpan(0, 5, 10), 320)); // Error History history = new History("MyHistory", DateTime.Now); history.Add(photo); history.Add(photo1); history.Add(clip); history.Add(clip1); history.Add(sing); // Error Compilation comp = new Compilation("MyCompilation", DateTime.Now); comp.Add(sing); comp.Add(photo); comp.Add(sing1); //Error foreach (var i in comp) { Console.ForegroundColor = ConsoleColor.Cyan; Console.WriteLine(i.OpenItem()); } Console.ForegroundColor = ConsoleColor.White; // Console.WriteLine( history.OpenItem()); Console.ReadKey(); }
public void TestLittleEndian() { var output = new Compilation(true); output.Add(0xffd2, 2); Assert.AreEqual(0x0002, output.LogicalPC); var bytes = output.GetCompilation(); Assert.AreEqual(0xd2, bytes[0]); Assert.AreEqual(0xff, bytes[1]); }
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); }