Exemplo n.º 1
0
        public bool TestQuick()
        {
            Console.WriteLine("Running general quick tests... ");

            using (FileStream file = new FileStream("quick.bin", FileMode.Open, FileAccess.Read))
                _ram.Load(file, 0x4000);

            // Set reset vector to the start of the code
            _ram.Write16(0xFFFC, 0x4000);
            // Set IRQ vector to test BRK
            _ram.Write16(0xFFFE, 0x45A4); // IRQ
            _cpu.SetReset();

            //Display = true;

            while (_cpu.PC != 0x45CA)
            {
                _cpu.ExecuteNextOpcode();
            }
            //Display = false;


            byte result = _ram.Read(0x0210);

            //Console.SetCursorPosition(x, y);
            if (result == 0xFF)
            {
                Console.ForegroundColor = ConsoleColor.Green;
                Console.WriteLine("OK!");
                Console.ResetColor();
                return(true);
            }
            Console.ForegroundColor = ConsoleColor.Red;
            Console.WriteLine("FAIL: " + result.ToString("X2"));
            Console.ResetColor();
            return(false);
        }