Пример #1
0
        void Initialize()
        {
            Console.WriteLine("Initialize hardware...");

            onboardLed = new RgbPwmLed(device: Device,
                                       redPwmPin: Device.Pins.OnboardLedRed,
                                       greenPwmPin: Device.Pins.OnboardLedGreen,
                                       bluePwmPin: Device.Pins.OnboardLedBlue,
                                       3.3f, 3.3f, 3.3f,
                                       Meadow.Peripherals.Leds.IRgbLed.CommonType.CommonAnode);

            var spiBus = Device.CreateSpiBus();

            display = new ZXBox.MeadowApp.Display.Ssd1351(
                device: Device,
                spiBus: spiBus,
                chipSelectPin: Device.Pins.D00,
                dcPin: Device.Pins.D02,
                resetPin: Device.Pins.D01,
                width: 128, height: 127);


            //graphics.Clear();

            //graphics.Show();
            speccy = new ZXSpectrum(true, true, 32, 32, 0);
            speccy.Reset();
            graphics = new GraphicsLibrary(display);
            display.Clear(true);
            display.ClearScreen(1);
            display.InvertDisplay(false);
            graphics.DrawRectangle(0, 0, 127, 127, Color.FromHex("#00cdcd"), true);
            graphics.Show();
        }
Пример #2
0
        public static bool TestInstruction(string file)
        {
            file = $"{Directory.GetParent(Directory.GetCurrentDirectory()).Parent.Parent.FullName}\\Testfiles\\" + file;
            ZXSpectrum z80 = new ZXSpectrum();

            z80.Reset();

            TestState ts = TestfileHandler.ReadINFile(file);

            z80.AF     = ts.af;
            z80.AFPrim = ts.af_;
            z80.BC     = ts.bc;
            z80.BCPrim = ts.bc_;
            z80.DE     = ts.de;
            z80.DEPrim = ts.de_;
            z80.HL     = ts.hl;
            z80.HLPrim = ts.hl_;
            z80.I      = ts.i;
            z80.IFF    = ts.iff1;
            z80.IFF2   = ts.iff2;
            z80.IM     = ts.im;
            z80.IX     = ts.ix;
            z80.IY     = ts.iy;

            //z80.Memory = ts.Memory;
            for (int m = 0; m < ts.Memory.Length; m++)
            {
                z80.WriteByteToMemory(m, ts.Memory[m]);
            }
            z80.PC = ts.pc;
            z80.R  = ts.r;
            z80.SP = ts.sp;

            z80.DoIntructions(ts.end_tstates2);

            TestState tsout = TestfileHandler.ReadOUTFile(Path.GetDirectoryName(file) + "\\" + Path.GetFileNameWithoutExtension(file) + ".out", ts.Memory);

            //Compare
            bool result = CoreTest.CompareFunction(tsout, ExtractState(z80));

            if (!result)
            {
                Debug.WriteLine(Path.GetFileNameWithoutExtension(file) + " failed");
            }
            else
            {
                Debug.WriteLine(Path.GetFileNameWithoutExtension(file) + " succeeded");
            }

            return(result);
        }
        protected async override Task OnInitializedAsync()
        {
            gameLoop.Start();
            speccy.InputHardware.Add(Keyboard);

            kempston = new Kempston();
            speccy.InputHardware.Add(kempston);

            //beeper = new Beeper<byte>(128, 255, 48000/50, 1);
            //speccy.OutputHardware.Add(beeper);

            speccy.Reset();
            await base.OnInitializedAsync();
        }