Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
folium-app
GitHub Repository: folium-app/Folium
Path: blob/a-new-beginning/Cherry/Core/include/CVMemory_inline.h
2 views
1
/*
2
* Gearcoleco - ColecoVision Emulator
3
* Copyright (C) 2021 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 MEMORY_INLINE_H
21
#define MEMORY_INLINE_H
22
23
#include "Cartridge.h"
24
#include "Mapper.h"
25
26
inline u8 CVMemory::Read(u16 address)
27
{
28
#ifndef GEARCOLECO_DISABLE_DISASSEMBLER
29
CheckBreakpoints(address, false);
30
#endif
31
32
switch (address & 0xE000)
33
{
34
case 0x0000:
35
{
36
return m_bSGMLower ? m_pSGMRam[address] : m_pBios[address];
37
}
38
case 0x2000:
39
case 0x4000:
40
{
41
return m_bSGMUpper ? m_pSGMRam[address] : 0xFF;
42
}
43
case 0x6000:
44
{
45
return m_bSGMUpper ? m_pSGMRam[address] : m_pRam[address & 0x03FF];
46
}
47
case 0x8000:
48
case 0xA000:
49
case 0xC000:
50
case 0xE000:
51
{
52
return m_pMapper->Read(address);
53
}
54
default:
55
return 0xFF;
56
}
57
}
58
59
inline void CVMemory::Write(u16 address, u8 value)
60
{
61
#ifndef GEARCOLECO_DISABLE_DISASSEMBLER
62
CheckBreakpoints(address, true);
63
#endif
64
65
switch (address & 0xE000)
66
{
67
case 0x0000:
68
{
69
if (m_bSGMLower)
70
m_pSGMRam[address] = value;
71
break;
72
}
73
case 0x2000:
74
case 0x4000:
75
{
76
if (m_bSGMUpper)
77
m_pSGMRam[address] = value;
78
break;
79
}
80
case 0x6000:
81
{
82
if (m_bSGMUpper)
83
m_pSGMRam[address] = value;
84
else
85
m_pRam[address & 0x03FF] = value;
86
break;
87
}
88
case 0x8000:
89
case 0xA000:
90
case 0xC000:
91
case 0xE000:
92
{
93
m_pMapper->Write(address, value);
94
break;
95
}
96
}
97
}
98
99
inline CVMemory::stDisassembleRecord** CVMemory::GetDisassembledRomMemoryMap()
100
{
101
return m_pDisassembledRomMap;
102
}
103
104
inline CVMemory::stDisassembleRecord** CVMemory::GetDisassembledRamMemoryMap()
105
{
106
return m_pDisassembledRamMap;
107
}
108
109
inline CVMemory::stDisassembleRecord** CVMemory::GetDisassembledBiosMemoryMap()
110
{
111
return m_pDisassembledBiosMap;
112
}
113
114
inline CVMemory::stDisassembleRecord** CVMemory::GetDisassembledSGMRamMemoryMap()
115
{
116
return m_pDisassembledSGMRamMap;
117
}
118
119
#endif /* MEMORY_INLINE_H */
120
121
122