-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmapper0.js
More file actions
48 lines (41 loc) · 1.2 KB
/
Copy pathmapper0.js
File metadata and controls
48 lines (41 loc) · 1.2 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
var NES = NES || { };
NES.Mapper0 = function(prgData, chrData) {
var me = this;
this.mirror = ppu.Mirror.Horizontal;
this.writeByte = function(address, value) {
if (address < 0x2000) {
chrData[address] = value;
}
else if (address >= 0x6000 && address < 0x8000) {
}
else if (address < 0x10000) {
if ((prgData.length >> 14) == 1) {
prgData[address % 0x4000] = value;
}
else {
prgData[address % 0x8000] = value;
}
}
else {
throw('Invalid write address to mapper0 - ' + address.toString(16));
}
};
this.readByte = function(address) {
if (address < 0x2000) {
return chrData[address];
}
else if (address >= 0x6000 && address < 0x8000) {
}
else if (address < 0x10000) {
if ((prgData.length >> 14) == 1) {
return prgData[address % 0x4000];
}
else {
return prgData[address % 0x8000];
}
}
else {
throw('Invalid read address to mapper0 - ' + address.toString(16));
}
};
};