⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 nes_6502.h

📁 PocketNester的c++源代码,很好的学习例子,仅供大家学习
💻 H
字号:
/*
** nester - NES emulator
** Copyright (C) 2000  Darren Ranalli
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful, 
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
** Library General Public License for more details.  To obtain a 
** copy of the GNU Library General Public License, write to the Free 
** Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
**
** Any permitted reproduction of these routines, in whole or in part,
** must bear this legend.
*/

// NES_6502 interface class
// created to cut down on extra work required for retro-fitting of
// new releases of Matt Conte's nes6502

#ifndef _NES_6502_H_
#define _NES_6502_H_

#include "types.h"

#include "nes6502.h"

class NES;  // prototype of NES class

class NES_6502
{
public:
  struct Context : public nes6502_context {};

public:
  NES_6502(NES* parent);
  ~NES_6502();

  // Functions that govern the 6502's execution
  void Init()                           { /*nes6502_init();*/ }
  void Reset()                          { nes6502_reset(); }
  int  Execute(int total_cycles)        { return nes6502_execute(total_cycles); }
  void DoNMI(void)                      { nes6502_nmi(); }
  void DoIRQ(void)                      { nes6502_irq(); }
  void SetDMA(int cycles)               { nes6502_burn(cycles); }
  uint8  GetByte(uint32 address)        { return nes6502_getbyte(address); }
  uint32 GetCycles(boolean reset_flag)  { return nes6502_getcycles(reset_flag); }
#ifdef FRAME_IRQ
  void DoPendingIRQ(void)               { nes6502_pending_irq(); }
#endif

  // Context get/set
  void SetContext(Context *cpu);
  void GetContext(Context *cpu);

  // Rick
  void Set_CPU_banks(uint8 * bank4, uint8 * bank5, uint8 * bank6, uint8 * bank7);
  void Set_CPU_banks(uint8 * bank3, uint8 * bank4, uint8 * bank5, uint8 * bank6, uint8 * bank7);
  void Set_CPU_bank(uint32 num, uint8 *bank);
  uint8 * NES_6502::Get_DMA_mem_ptr(uint32 address);

protected:

  NES* ParentNES;

  uint8 MemoryRead(uint32 addr);
  void  MemoryWrite(uint32 addr, uint8 data);

  friend void NES_write(uint32 address, uint8 value);
  friend uint8 NES_read(uint32 address);

};

#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -