openMSX
memory
RomPageNN.cc
Go to the documentation of this file.
1
#include "
RomPageNN.hh
"
2
#include "
serialize.hh
"
3
#include "
unreachable.hh
"
4
#include "
xrange.hh
"
5
6
namespace
openmsx
{
7
8
RomPageNN::RomPageNN
(
const
DeviceConfig
& config,
Rom
&& rom_,
RomType
type)
9
:
Rom8kBBlocks
(config,
std
::move(rom_))
10
{
11
const
auto
pages = [&] {
12
switch
(type) {
13
case
ROM_PAGE0
:
return
0b0001;
14
case
ROM_PAGE1
:
return
0b0010;
15
case
ROM_PAGE01
:
return
0x0011;
16
case
ROM_PAGE2
:
return
0b0100;
17
case
ROM_PAGE12
:
return
0b0110;
18
case
ROM_PAGE012
:
return
0b0111;
19
case
ROM_PAGE3
:
return
0b1000;
20
case
ROM_PAGE23
:
return
0b1100;
21
case
ROM_PAGE123
:
return
0b1110;
22
case
ROM_PAGE0123
:
return
0b1111;
23
default
:
UNREACHABLE
;
return
0;
24
}
25
}();
26
int
bank = 0;
27
for
(
auto
page :
xrange
(4)) {
28
if
(pages & (1 << page)) {
29
setRom
(page * 2 + 0, bank++);
30
setRom
(page * 2 + 1, bank++);
31
}
else
{
32
setUnmapped
(page * 2 + 0);
33
setUnmapped
(page * 2 + 1);
34
}
35
}
36
}
37
38
REGISTER_MSXDEVICE
(
RomPageNN
,
"RomPageNN"
);
39
40
}
// namespace openmsx
RomPageNN.hh
openmsx::DeviceConfig
Definition:
DeviceConfig.hh:21
openmsx::RomBlocks
Definition:
RomBlocks.hh:15
openmsx::RomBlocks::setUnmapped
void setUnmapped(unsigned region)
Select 'unmapped' memory for this region.
Definition:
RomBlocks.cc:92
openmsx::RomBlocks::setRom
void setRom(unsigned region, unsigned block)
Selects a block of the ROM image for reading in a certain region.
Definition:
RomBlocks.cc:104
openmsx::RomPageNN
Definition:
RomPageNN.hh:10
openmsx::RomPageNN::RomPageNN
RomPageNN(const DeviceConfig &config, Rom &&rom, RomType type)
Definition:
RomPageNN.cc:8
openmsx::Rom
Definition:
Rom.hh:25
openmsx
This file implemented 3 utility functions:
Definition:
Autofire.cc:9
openmsx::REGISTER_MSXDEVICE
REGISTER_MSXDEVICE(ChakkariCopy, "ChakkariCopy")
openmsx::RomType
RomType
Definition:
RomTypes.hh:6
openmsx::ROM_PAGE1
@ ROM_PAGE1
Definition:
RomTypes.hh:66
openmsx::ROM_PAGE2
@ ROM_PAGE2
Definition:
RomTypes.hh:68
openmsx::ROM_PAGE01
@ ROM_PAGE01
Definition:
RomTypes.hh:67
openmsx::ROM_PAGE3
@ ROM_PAGE3
Definition:
RomTypes.hh:71
openmsx::ROM_PAGE12
@ ROM_PAGE12
Definition:
RomTypes.hh:69
openmsx::ROM_PAGE123
@ ROM_PAGE123
Definition:
RomTypes.hh:73
openmsx::ROM_PAGE23
@ ROM_PAGE23
Definition:
RomTypes.hh:72
openmsx::ROM_PAGE0123
@ ROM_PAGE0123
Definition:
RomTypes.hh:74
openmsx::ROM_PAGE012
@ ROM_PAGE012
Definition:
RomTypes.hh:70
openmsx::ROM_PAGE0
@ ROM_PAGE0
Definition:
RomTypes.hh:65
std
STL namespace.
serialize.hh
unreachable.hh
UNREACHABLE
#define UNREACHABLE
Definition:
unreachable.hh:38
xrange.hh
xrange
constexpr auto xrange(T e)
Definition:
xrange.hh:132
Generated on Fri May 19 2023 13:13:11 for openMSX by
1.9.4