Пример #1
0
		static void Main() {
			Timers timers = new Timers();
			Screen screen = new Screen();
			Keyboard keyboard = new Keyboard();
			Sound sound = new Sound();
			Chip8Emulator chip8 = new Chip8Emulator(timers, screen, keyboard, sound);
			Application.Run(new MainForm(chip8));
		}
Пример #2
0
        static void Main()
        {
            Timers        timers   = new Timers();
            Screen        screen   = new Screen();
            Keyboard      keyboard = new Keyboard();
            Sound         sound    = new Sound();
            Chip8Emulator chip8    = new Chip8Emulator(timers, screen, keyboard, sound);

            Application.Run(new MainForm(chip8));
        }
Пример #3
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here
            graphics.PreferredBackBufferWidth  = Chip8Display.SCREEN_WIDTH * Chip8Display.SCREEN_SCALE;
            graphics.PreferredBackBufferHeight = Chip8Display.SCREEN_HEIGHT * Chip8Display.SCREEN_SCALE;
            graphics.ApplyChanges();

            createTextures();

            Chip8Rom rom = new Chip8Rom("PONG");

            this.emulator = new Chip8Emulator(rom);

            base.Initialize();
        }
Пример #4
0
 public ConsoleDisplayView(Chip8Emulator emulator) : this(emulator.DisplayModel)
 {
 }
Пример #5
0
		public MainForm(Chip8Emulator chip8) {
			_chip8 = chip8;
			InitializeComponent();
		}
Пример #6
0
 public RunChip8EmulatorTest(Chip8Emulator _emulator, ConsoleDisplayView _displayView)
 {
     chip8Emulator = _emulator;
     displayView   = _displayView;
 }
Пример #7
0
        static void Main(string[] args)
        {
            Console.CursorVisible = false;
            Console.SetWindowSize(Console.WindowWidth, 32);

            FillScreen();

            var consoleKeyboardInput = new ConsoleKeyboardInput();
            var consoleAudioPlayer   = new ConsoleSound();

            Chip8Emulator emulator           = new Chip8Emulator(consoleKeyboardInput, consoleAudioPlayer);
            var           consoleDisplayView = new ConsoleDisplayView(emulator);

            if (args.Length > 0)
            {
                emulator.LoadROM(args[0]);

#if false
                var runChipEmulator = new RunChip8EmulatorTest(emulator, consoleDisplayView);
//                var runChipEmulator = new RunChip8EmulatorWithTimers(emulator, consoleDisplayView);

                try
                {
                    while (true)
                    {
                        runChipEmulator.Run();
                    }
                }
                catch (EndEmulationException)
                {
                }
#endif

#if true
                var runChipEmulator = new RunChip8EmulatorWithTimers(emulator, consoleDisplayView);

                while (true)
                {
                    runChipEmulator.Run();
                }
#endif

                Environment.ExitCode = 0;
                return;
            }

#if false
            var memory = emulator.Memory;
            memory[0x0200] = 0x62;
            memory[0x0201] = 0x0A;
            memory[0x0202] = 0x63;
            memory[0x0203] = 0x0C;
            memory[0x0204] = 0xA2;
            memory[0x0205] = 0x20;
            memory[0x0206] = 0xD2;
            memory[0x0207] = 0x36;
            memory[0x0208] = 0xD2;
            memory[0x0209] = 0x36;
            memory[0x020A] = 0x00; // Invalid!
            memory[0x0220] = 0xBA;
            memory[0x0221] = 0x7C;
            memory[0x0222] = 0xD6;
            memory[0x0223] = 0xFE;
            memory[0x0224] = 0x54;
            memory[0x0225] = 0xAA;
#endif


            Console.CursorVisible = true;
        }
Пример #8
0
 public MainForm(Chip8Emulator chip8)
 {
     _chip8 = chip8;
     InitializeComponent();
 }