MBC1MemoryRule.h (1890B)
1/* 2 * Gearboy - Nintendo Game Boy Emulator 3 * Copyright (C) 2012 Ignacio Sanchez 4 5 * This program is free software: you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation, either version 3 of the License, or 8 * any later version. 9 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 15 * You should have received a copy of the GNU General Public License 16 * along with this program. If not, see http://www.gnu.org/licenses/ 17 * 18 */ 19 20#ifndef MBC1MEMORYRULE_H 21#define MBC1MEMORYRULE_H 22 23#include "MemoryRule.h" 24 25class MBC1MemoryRule : public MemoryRule 26{ 27public: 28 MBC1MemoryRule(Processor* pProcessor, Memory* pMemory, 29 Video* pVideo, Input* pInput, Cartridge* pCartridge, Audio* pAudio); 30 virtual ~MBC1MemoryRule(); 31 virtual u8 PerformRead(u16 address); 32 virtual void PerformWrite(u16 address, u8 value); 33 virtual void Reset(bool bCGB); 34 virtual void SaveRam(std::ostream &file); 35 virtual bool LoadRam(std::istream &file, s32 fileSize); 36 virtual size_t GetRamSize(); 37 virtual u8* GetRamBanks(); 38 virtual u8* GetCurrentRamBank(); 39 virtual int GetCurrentRamBankIndex(); 40 virtual u8* GetRomBank0(); 41 virtual int GetCurrentRomBank0Index(); 42 virtual u8* GetCurrentRomBank1(); 43 virtual int GetCurrentRomBank1Index(); 44 virtual void SaveState(std::ostream& stream); 45 virtual void LoadState(std::istream& stream); 46 47private: 48 int m_iMode; 49 int m_iCurrentRAMBank; 50 int m_iCurrentROMBank; 51 bool m_bRamEnabled; 52 u8 m_HigherRomBankBits; 53 u8* m_pRAMBanks; 54 int m_CurrentROMAddress; 55 int m_CurrentRAMAddress; 56}; 57 58#endif /* MBC1MEMORYRULE_H */