/// <summary> /// Meant to be called once per frame (every 1/60th second) /// </summary> /// <param name="input"></param> public void Step(InputFrame input) { CPUTick(); // Master Clock: 21,477,272 ticks per second, 357954.533333 per frame for (int i = 0; i < 357955; i++) { // CPU, master clock divided by 12 if ((i % 12) == 0) { CPUTick(); } } }
/// <summary> /// Allows the game to run logic such as updating the world, /// checking for collisions, gathering input, and playing audio. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Update(GameTime gameTime) { if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape)) { Exit(); } InputFrame input = new InputFrame(); Console.WriteLine("stepped"); nes.Step(input); base.Update(gameTime); }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); textFont = Content.Load <SpriteFont>("text"); nes = new Machine(); testString = nes.Initiate("donkey kong.nes").ToString(); InputFrame input = new InputFrame(); for (int i = 0; i < 20; i++) { //nes.Step(input); } // TODO: use this.Content to load your game content here }