-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmapper000.cpp
More file actions
53 lines (44 loc) · 1.62 KB
/
mapper000.cpp
File metadata and controls
53 lines (44 loc) · 1.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include "mapper000.hpp"
/**** mapper 000 ****/
uint32_t Mapper000::MapReadPRG(uint16_t address, bool &fromRAM)
{
uint32_t mappedAddress = 0x00000000;
if (address >= 0x6000 && address <= 0x7FFF)
{
mappedAddress = address & 0x1FFF;
fromRAM = true;
}
else if (address >= 0x8000 && address <= 0xFFFF)
{
if (numBanksPRG == 1) // mapped PRG address == first 14 bits if 16 KiB (0x8000 - 0xBFFF mirrored 0xC000 - 0xFFFF)
mappedAddress = address & 0x3FFF;
else if (numBanksPRG == 2) // mapped PRG address == first 15 bits if 32 KiB (0x8000 - 0xFFFF)
mappedAddress = address & 0x7FFF;
}
return mappedAddress;
}
uint32_t Mapper000::MapWritePRG(uint16_t address, uint8_t data, bool &toRAM)
{
uint32_t mappedAddress = 0x00000000;
if (address >= 0x6000 && address <= 0x7FFF)
{
mappedAddress = address & 0x1FFF;
toRAM = true;
}
else if (address >= 0x8000 && address <= 0xFFFF)
{
if (numBanksPRG == 1) // mapped PRG address == first 14 bits if 16 KiB (0x8000 - 0xBFFF mirrored 0xC000 - 0xFFFF)
mappedAddress = address & 0x3FFF;
else if (numBanksPRG == 2) // mapped PRG address == first 15 bits if 32 KiB (0x8000 - 0xFFFF)
mappedAddress = address & 0x7FFF;
}
return mappedAddress;
}
uint32_t Mapper000::MapReadCHR(uint16_t address)
{
return address;
}
uint32_t Mapper000::MapWriteCHR(uint16_t address)
{
return address;
}