Exemple #1
0
        public GameBoyEmulator()
        {
            SetStyle(ControlStyles.UserPaint, true);
            SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
            SetStyle(ControlStyles.AllPaintingInWmPaint, true);

            InitializeComponent();

            graphics = new LCDController();
            sound    = new SoundUnit();
            timer    = new TimerUnit();
            joypad   = new Joypad();

            memory    = new MemoryDispatcher(graphics, sound, timer, joypad);
            processor = new Z80Processor(memory);

            gameThread                            = new BackgroundWorker();
            gameThread.DoWork                    += GameThread_DoWork;
            gameThread.RunWorkerCompleted        += GameThread_RunWorkerCompleted;
            gameThread.WorkerSupportsCancellation = true;

            frameTimer.Interval = 15; // Run at 60 FPS
            syncTimer.Interval  = 8;
        }
Exemple #2
0
 public Z80Processor(MemoryDispatcher memory)
 {
     md             = memory;
     instructionSet = InitInstructionSet();
 }