📄 gbammu.h
字号:
/*************************************************************************** DSemu - The Next Generation ** GBA memory management: Class definition [gbammu.h] ** Copyright Imran Nazar, 2005; released under the BSD public licence. ***************************************************************************/#ifndef __GBAMMU_H_#define __GBAMMU_H_#include "plgmmu32.h"#include "plgcpu.h"#include "plggui.h"#include <string>#include <map>// An implementation of the 32-bit MMU plugin interface.class gbaMMU : public MMU32Plugin{ public: gbaMMU(std::string name, REQPTR req, UNREQPTR unreq); ~gbaMMU(); PLUGININFO *getinfo(); void reset(); void release(); void status(int,int); u8 getCaps(); void load(std::string); void priv(u8); void setCPU(CPUPlugin*); u8 rdB(u32); u16 rdH(u32); u32 rdW(u32); void wrB(u32, u8 ); void wrH(u32, u16); void wrW(u32, u32); void event(int, void*); void rangeReg(u8, rdBptr, rdHptr, rdWptr, wrBptr, wrHptr, wrWptr); void mmioReg(u8, rdBptr, rdHptr, rdWptr, wrBptr, wrHptr, wrWptr); private: std::string pName, pClass; REQPTR pRequest; UNREQPTR pUnrequest; static PLUGININFO pInfo; static std::string pluginName; static GUIPlugin *GUI; static CPUPlugin *CPU; static int dmpwinID; static u32 *dmpbuffer; static u32 dmpaddr; u32 nlpo2(u32); static u8 *EWRAM, *IWRAM, *ROM, *BIOS; static u16 *EWRAMh, *IWRAMh, *ROMh, *BIOSh; static u32 *EWRAMw, *IWRAMw, *ROMw, *BIOSw; PAGE pagetable[256]; static PAGE mmioPages[256]; static u32 BIOSsize, ROMsize; typedef struct { union { u8 b[4]; u16 h[2]; u32 w; }; } IOREG; // The DMA subhandler is a class in itself. class DMA { public: DMA(void*); ~DMA(); static void check(int); static void fire(int); static void reset(); private: static gbaMMU *parent; static u8 rdB(u32); static u16 rdH(u32); static u32 rdW(u32); static void wrB(u32,u8), wrH(u32,u16), wrW(u32,u32); static IOREG reg[12]; }; // Pointer to an instance of the DMA class static DMA *dma; static IOREG interruptIO[4]; static void eventI(int); static void waitstates(u16); static int waitSRAM, waitROM0, waitROM1, waitROM2; static int waitROM0s, waitROM1s, waitROM2s; static u32 prevROMaddr; // Region-specific access handlers static u8 rdB_EWRAM(u32), rdB_IWRAM(u32), rdB_BIOS(u32), rdB_ROM(u32), rdB_BAD(u32); static u8 rdB_MMIO(u32), rdB_INT(u32); static u16 rdH_EWRAM(u32), rdH_IWRAM(u32), rdH_BIOS(u32), rdH_ROM(u32), rdH_BAD(u32); static u16 rdH_MMIO(u32), rdH_INT(u32); static u32 rdW_EWRAM(u32), rdW_IWRAM(u32), rdW_BIOS(u32), rdW_ROM(u32), rdW_BAD(u32); static u32 rdW_MMIO(u32), rdW_INT(u32); static void wrB_EWRAM(u32,u8 ),wrB_IWRAM(u32,u8 ),wrB_BIOS(u32,u8 ),wrB_ROM(u32,u8 ),wrB_BAD(u32,u8 ); static void wrB_MMIO(u32,u8 ),wrB_INT(u32,u8 ),wrB_DMA(u32,u8 ); static void wrH_EWRAM(u32,u16),wrH_IWRAM(u32,u16),wrH_BIOS(u32,u16),wrH_ROM(u32,u16),wrH_BAD(u32,u16); static void wrH_MMIO(u32,u16),wrH_INT(u32,u16),wrH_DMA(u32,u16); static void wrW_EWRAM(u32,u32),wrW_IWRAM(u32,u32),wrW_BIOS(u32,u32),wrW_ROM(u32,u32),wrW_BAD(u32,u32); static void wrW_MMIO(u32,u32),wrW_INT(u32,u32),wrW_DMA(u32,u32); // Useful defines for the access page table #define PAGE_INDEX ((addr&0x0FF00000)>>20) #define MMIO_PAGE_INDEX ((a&0x00000FF0)>>4)};#endif//__GBAMMU_H_/*** EOF: gbammu.h *******************************************************/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -