Path: blob/a-new-beginning/Cherry/Core/include/CVMemory_inline.h
2 views
/*1* Gearcoleco - ColecoVision Emulator2* Copyright (C) 2021 Ignacio Sanchez34* This program is free software: you can redistribute it and/or modify5* it under the terms of the GNU General Public License as published by6* the Free Software Foundation, either version 3 of the License, or7* any later version.89* This program is distributed in the hope that it will be useful,10* but WITHOUT ANY WARRANTY; without even the implied warranty of11* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the12* GNU General Public License for more details.1314* You should have received a copy of the GNU General Public License15* along with this program. If not, see http://www.gnu.org/licenses/16*17*/1819#ifndef MEMORY_INLINE_H20#define MEMORY_INLINE_H2122#include "Cartridge.h"23#include "Mapper.h"2425inline u8 CVMemory::Read(u16 address)26{27#ifndef GEARCOLECO_DISABLE_DISASSEMBLER28CheckBreakpoints(address, false);29#endif3031switch (address & 0xE000)32{33case 0x0000:34{35return m_bSGMLower ? m_pSGMRam[address] : m_pBios[address];36}37case 0x2000:38case 0x4000:39{40return m_bSGMUpper ? m_pSGMRam[address] : 0xFF;41}42case 0x6000:43{44return m_bSGMUpper ? m_pSGMRam[address] : m_pRam[address & 0x03FF];45}46case 0x8000:47case 0xA000:48case 0xC000:49case 0xE000:50{51return m_pMapper->Read(address);52}53default:54return 0xFF;55}56}5758inline void CVMemory::Write(u16 address, u8 value)59{60#ifndef GEARCOLECO_DISABLE_DISASSEMBLER61CheckBreakpoints(address, true);62#endif6364switch (address & 0xE000)65{66case 0x0000:67{68if (m_bSGMLower)69m_pSGMRam[address] = value;70break;71}72case 0x2000:73case 0x4000:74{75if (m_bSGMUpper)76m_pSGMRam[address] = value;77break;78}79case 0x6000:80{81if (m_bSGMUpper)82m_pSGMRam[address] = value;83else84m_pRam[address & 0x03FF] = value;85break;86}87case 0x8000:88case 0xA000:89case 0xC000:90case 0xE000:91{92m_pMapper->Write(address, value);93break;94}95}96}9798inline CVMemory::stDisassembleRecord** CVMemory::GetDisassembledRomMemoryMap()99{100return m_pDisassembledRomMap;101}102103inline CVMemory::stDisassembleRecord** CVMemory::GetDisassembledRamMemoryMap()104{105return m_pDisassembledRamMap;106}107108inline CVMemory::stDisassembleRecord** CVMemory::GetDisassembledBiosMemoryMap()109{110return m_pDisassembledBiosMap;111}112113inline CVMemory::stDisassembleRecord** CVMemory::GetDisassembledSGMRamMemoryMap()114{115return m_pDisassembledSGMRamMap;116}117118#endif /* MEMORY_INLINE_H */119120121122