mirror of
https://github.com/sehugg/8bitworkshop.git
synced 2025-02-16 17:30:27 +00:00
fixed SMS memory map
This commit is contained in:
parent
5323862172
commit
3b4d2b5f82
@ -145,42 +145,38 @@ export class SMS extends SG1000 {
|
|||||||
return this.rom[a + ((this.pagingRegisters[reg] & this.romPageMask) << 14)]; // * $4000
|
return this.rom[a + ((this.pagingRegisters[reg] & this.romPageMask) << 14)]; // * $4000
|
||||||
}
|
}
|
||||||
|
|
||||||
newMembus() {
|
read = newAddressDecoder([
|
||||||
return {
|
[0xc000, 0xffff, 0x1fff, (a) => { return this.ram[a]; }],
|
||||||
read: newAddressDecoder([
|
[0x0000, 0x03ff, 0x3ff, (a) => { return this.rom[a]; }],
|
||||||
[0xc000, 0xffff, 0x1fff, (a) => { return this.ram[a]; }],
|
[0x0400, 0x3fff, 0x3fff, (a) => { return this.getPagedROM(a,1); }],
|
||||||
[0x0000, 0x03ff, 0x3ff, (a) => { return this.rom[a]; }],
|
[0x4000, 0x7fff, 0x3fff, (a) => { return this.getPagedROM(a,2); }],
|
||||||
[0x0400, 0x3fff, 0x3fff, (a) => { return this.getPagedROM(a,1); }],
|
[0x8000, 0xbfff, 0x3fff, (a) => {
|
||||||
[0x4000, 0x7fff, 0x3fff, (a) => { return this.getPagedROM(a,2); }],
|
var reg0 = this.pagingRegisters[0]; // RAM select?
|
||||||
[0x8000, 0xbfff, 0x3fff, (a) => {
|
if (reg0 & 0x8) {
|
||||||
var reg0 = this.pagingRegisters[0]; // RAM select?
|
return this.cartram[(reg0 & 0x4) ? a+0x4000 : a];
|
||||||
if (reg0 & 0x8) {
|
} else {
|
||||||
return this.cartram[(reg0 & 0x4) ? a+0x4000 : a];
|
return this.getPagedROM(a,3);
|
||||||
} else {
|
}
|
||||||
return this.getPagedROM(a,3);
|
}],
|
||||||
}
|
]);
|
||||||
}],
|
|
||||||
]),
|
write = newAddressDecoder([
|
||||||
write: newAddressDecoder([
|
[0xc000, 0xfffb, 0x1fff, (a,v) => {
|
||||||
[0xc000, 0xfffb, 0x1fff, (a,v) => {
|
this.ram[a] = v;
|
||||||
this.ram[a] = v;
|
}],
|
||||||
}],
|
[0xfffc, 0xffff, 0x3, (a,v) => {
|
||||||
[0xfffc, 0xffff, 0x3, (a,v) => {
|
this.pagingRegisters[a] = v;
|
||||||
this.pagingRegisters[a] = v;
|
this.ram[a+0x1ffc] = v;
|
||||||
this.ram[a+0x1ffc] = v;
|
}],
|
||||||
}],
|
[0x8000, 0xbfff, 0x3fff, (a,v) => {
|
||||||
[0x8000, 0xbfff, 0x3fff, (a,v) => {
|
var reg0 = this.pagingRegisters[0]; // RAM select?
|
||||||
var reg0 = this.pagingRegisters[0]; // RAM select?
|
if (reg0 & 0x8) {
|
||||||
if (reg0 & 0x8) {
|
if (this.cartram.length == 0)
|
||||||
if (this.cartram.length == 0)
|
this.cartram = new Uint8Array(0x8000); // create cartridge RAM lazily
|
||||||
this.cartram = new Uint8Array(0x8000); // create cartridge RAM lazily
|
this.cartram[(reg0 & 0x4) ? a+0x4000 : a] = v;
|
||||||
this.cartram[(reg0 & 0x4) ? a+0x4000 : a] = v;
|
}
|
||||||
}
|
}],
|
||||||
}],
|
]);
|
||||||
]),
|
|
||||||
isContended: () => { return false; },
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
loadROM(data:Uint8Array) {
|
loadROM(data:Uint8Array) {
|
||||||
if (data.length <= 0xc000) {
|
if (data.length <= 0xc000) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user