MBC2MemoryRule.h (1768B)
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 MBC2MEMORYRULE_H 21#define MBC2MEMORYRULE_H 22 23#include "MemoryRule.h" 24 25class MBC2MemoryRule : public MemoryRule 26{ 27public: 28 MBC2MemoryRule(Processor* pProcessor, Memory* pMemory, 29 Video* pVideo, Input* pInput, Cartridge* pCartridge, Audio* pAudio); 30 virtual ~MBC2MemoryRule(); 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 GetCurrentRomBank0Index(); 40 virtual int GetCurrentRamBankIndex(); 41 virtual u8* GetRomBank0(); 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_iCurrentROMBank; 49 bool m_bRamEnabled; 50 int m_CurrentROMAddress; 51}; 52 53#endif /* MBC2MEMORYRULE_H */