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
using
enum
RomType
;
14
case
PAGE0
:
return
0b0001;
15
case
PAGE1
:
return
0b0010;
16
case
PAGE01
:
return
0x0011;
17
case
PAGE2
:
return
0b0100;
18
case
PAGE12
:
return
0b0110;
19
case
PAGE012
:
return
0b0111;
20
case
PAGE3
:
return
0b1000;
21
case
PAGE23
:
return
0b1100;
22
case
PAGE123
:
return
0b1110;
23
case
PAGE0123
:
return
0b1111;
24
default
:
UNREACHABLE
;
25
}
26
}();
27
int
bank = 0;
28
for
(
auto
page :
xrange
(4)) {
29
if
(pages & (1 << page)) {
30
setRom
(page * 2 + 0, bank++);
31
setRom
(page * 2 + 1, bank++);
32
}
else
{
33
setUnmapped
(page * 2 + 0);
34
setUnmapped
(page * 2 + 1);
35
}
36
}
37
}
38
39
REGISTER_MSXDEVICE
(
RomPageNN
,
"RomPageNN"
);
40
41
}
// namespace openmsx
REGISTER_MSXDEVICE
#define REGISTER_MSXDEVICE(CLASS, NAME)
Definition
MSXDevice.hh:356
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:11
openmsx::RomType
RomType
Definition
RomTypes.hh:6
openmsx::RomType::PAGE3
@ PAGE3
openmsx::RomType::PAGE2
@ PAGE2
openmsx::RomType::PAGE0123
@ PAGE0123
openmsx::RomType::PAGE1
@ PAGE1
openmsx::RomType::PAGE01
@ PAGE01
openmsx::RomType::PAGE123
@ PAGE123
openmsx::RomType::PAGE23
@ PAGE23
openmsx::RomType::PAGE0
@ PAGE0
openmsx::RomType::PAGE12
@ PAGE12
openmsx::RomType::PAGE012
@ PAGE012
std
STL namespace.
serialize.hh
unreachable.hh
UNREACHABLE
#define UNREACHABLE
Definition
unreachable.hh:40
xrange.hh
xrange
constexpr auto xrange(T e)
Definition
xrange.hh:132
Generated on Wed Nov 13 2024 23:13:42 for openMSX by
1.9.8