public GraphicsDisplay() { InitializeComponent(); this.Paint += new PaintEventHandler(GraphicsDisplay_Paint); this.FormClosed += new FormClosedEventHandler(GraphicsDisplay_FormClosing); _memory = new Memory(0xFFFF); _processor = new Processor(_memory, 0x600); // alive.asm //_memory.Set(0x600, new List<byte> { 0xa9, 0xf, 0x85, 0x0, 0x85, 0x1, 0xa5, 0xfe, 0x29, 0x3, 0xc9, 0x0, 0xf0, 0x2f, 0xc9, 0x1, 0xf0, 0x30, 0xc9, 0x2, 0xf0, 0x22, 0xc6, 0x1, 0xa5, 0x1, 0x29, 0x1f, 0xa, 0xaa, 0xbd, 0x47, 0x6, 0x85, 0x2, 0xe8, 0xbd, 0x47, 0x6, 0x85, 0x3, 0xa5, 0x0, 0x29, 0x1f, 0xa8, 0xb1, 0x2, 0xaa, 0xe8, 0x8a, 0x91, 0x2, 0x4c, 0x6, 0x6, 0xe6, 0x1, 0x4c, 0x18, 0x6, 0xc6, 0x0, 0x4c, 0x18, 0x6, 0xe6, 0x0, 0x4c, 0x18, 0x6, 0x0, 0x2, 0x20, 0x2, 0x40, 0x2, 0x60, 0x2, 0x80, 0x2, 0xa0, 0x2, 0xc0, 0x2, 0xe0, 0x2, 0x0, 0x3, 0x20, 0x3, 0x40, 0x3, 0x60, 0x3, 0x80, 0x3, 0xa0, 0x3, 0xc0, 0x3, 0xe0, 0x3, 0x0, 0x4, 0x20, 0x4, 0x40, 0x4, 0x60, 0x4, 0x80, 0x4, 0xa0, 0x4, 0xc0, 0x4, 0xe0, 0x4, 0x0, 0x5, 0x20, 0x5, 0x40, 0x5, 0x60, 0x5, 0x80, 0x5, 0xa0, 0x5, 0xc0, 0x5, 0xe0, 0x5 }); // disco.asm _memory.Set(0x600, new List<byte> { 0xe8, 0x8a, 0x99, 0x0, 0x2, 0x99, 0x0, 0x3, 0x99, 0x0, 0x4, 0x99, 0x0, 0x5, 0xc8, 0x98, 0xc5, 0x10, 0xd0, 0x4, 0xc8, 0x4c, 0x0, 0x6, 0xc8, 0xc8, 0xc8, 0xc8, 0x4c, 0x0, 0x6 }); }
static void ExecuteThread(object memory) { Interpreter.Processor processor = new Interpreter.Processor((Interpreter.Memory)memory, 0x600); //int interval = 500000; //System.Diagnostics.Stopwatch stopwatch = new System.Diagnostics.Stopwatch(); //stopwatch.Start(); for (; ; ) processor.Execute(); //stopwatch.Stop(); //Console.WriteLine((stopwatch.ElapsedMilliseconds / 1000.0) + " seconds"); //Console.WriteLine(4 * interval + " cycles"); //Console.WriteLine(4.0 * interval / (stopwatch.ElapsedMilliseconds / 1000.0) + " hertz"); }
static void ExecuteThread(object memory) { Interpreter.Processor processor = new Interpreter.Processor((Interpreter.Memory)memory, 0x600); //int interval = 500000; //System.Diagnostics.Stopwatch stopwatch = new System.Diagnostics.Stopwatch(); //stopwatch.Start(); for (; ;) { processor.Execute(); } //stopwatch.Stop(); //Console.WriteLine((stopwatch.ElapsedMilliseconds / 1000.0) + " seconds"); //Console.WriteLine(4 * interval + " cycles"); //Console.WriteLine(4.0 * interval / (stopwatch.ElapsedMilliseconds / 1000.0) + " hertz"); }