Ejemplo n.º 1
0
        public static byte[] Check_CompleteScreenCycle()
        {
            ULATestSystem testSystem = new ULATestSystem();

            testSystem.LoadScreenInVideoMemory("ULA/Video/ScreenSamples/BuggyBoy.scr");
            testSystem.ULA.Debug_SetBorderColor(4);

            ULAStateLogger logger = new ULAStateLogger(testSystem.ULA);

            logger.StartLogging(
                ULAStateLogger.ULAStateElements.MasterCounters | ULAStateLogger.ULAStateElements.DataIO | ULAStateLogger.ULAStateElements.VideoOutput | ULAStateLogger.ULAStateElements.VideoRegisters,
                new ULA.LifecycleEventType[] { ULA.LifecycleEventType.ClockCycle });
            for (int i = 0; i < ULA.ONE_FRAME_TICKS_COUNT + 7; i++)
            {
                testSystem.PixelClock.Tick();
            }
            logger.StopLogging();

            if (!logger.CompareWithSavedLog("ULA/Video/Logs/Check_CompleteScreenCycle"))
            {
                throw new Exception("Log compare failed");
            }

            ZXSpectrumComputer computer = new ZXSpectrumComputer();
            // Load a program that does nothing in computer ROM
            StringBuilder testProgram = new StringBuilder();

            testProgram.AppendLine("JP 0");
            computer.LoadProgramInROM(testProgram.ToString());
            // Load sample picture in video memory and set green border color
            using (Stream stream = PlatformSpecific.GetStreamForProjectFile("ULA/Video/ScreenSamples/BuggyBoy.scr"))
            {
                using (BinaryReader reader = new BinaryReader(stream))
                {
                    reader.Read(computer.RAM16K.Cells, 0, 6912);
                }
            }
            computer.ULA.Debug_SetBorderColor(4);

            // Render the same screen with the complete computer
            for (int i = 0; i < ULA.ONE_FRAME_TICKS_COUNT + 7; i++)
            {
                computer.Clock.Tick();
            }
            string testScreenValues     = GetDisplayAsString(testSystem.Screen.Display);
            string computerScreenValues = GetDisplayAsString(computer.Screen.Display);

            if (!testScreenValues.Equals(computerScreenValues))
            {
                throw new Exception("Screen compare failed for complete computer");
            }

            return(testSystem.Screen.Display);
        }
        public static byte[] Check_CompleteScreenCycle()
        {
            ULATestSystem testSystem = new ULATestSystem();
            testSystem.LoadScreenInVideoMemory("ULA/Video/ScreenSamples/BuggyBoy.scr");
            testSystem.ULA.Debug_SetBorderColor(4);

            ULAStateLogger logger = new ULAStateLogger(testSystem.ULA);
            logger.StartLogging(
                ULAStateLogger.ULAStateElements.MasterCounters | ULAStateLogger.ULAStateElements.DataIO | ULAStateLogger.ULAStateElements.VideoOutput | ULAStateLogger.ULAStateElements.VideoRegisters,
                new ULA.LifecycleEventType[] { ULA.LifecycleEventType.ClockCycle });
            for (int i = 0; i < ULA.ONE_FRAME_TICKS_COUNT + 7; i++)
            {
                testSystem.PixelClock.Tick();
            }
            logger.StopLogging();

            if (!logger.CompareWithSavedLog("ULA/Video/Logs/Check_CompleteScreenCycle"))
            {
                throw new Exception("Log compare failed");
            }

            ZXSpectrumComputer computer = new ZXSpectrumComputer();
            // Load a program that does nothing in computer ROM
            StringBuilder testProgram = new StringBuilder();
            testProgram.AppendLine("JP 0");
            computer.LoadProgramInROM(testProgram.ToString());
            // Load sample picture in video memory and set green border color
            using (Stream stream = PlatformSpecific.GetStreamForProjectFile("ULA/Video/ScreenSamples/BuggyBoy.scr"))
            {
                using (BinaryReader reader = new BinaryReader(stream))
                {
                    reader.Read(computer.RAM16K.Cells, 0, 6912);
                }
            }
            computer.ULA.Debug_SetBorderColor(4);

            // Render the same screen with the complete computer
            for (int i = 0; i < ULA.ONE_FRAME_TICKS_COUNT + 7; i++)
            {
                computer.Clock.Tick();
            }
            string testScreenValues = GetDisplayAsString(testSystem.Screen.Display);
            string computerScreenValues = GetDisplayAsString(computer.Screen.Display);

            if (!testScreenValues.Equals(computerScreenValues))
            {
                throw new Exception("Screen compare failed for complete computer");
            }

            return testSystem.Screen.Display;
        }