Pārlūkot izejas kodu

Fixed the .address property behaviour

master
Bryan Miller pirms 5 gadiem
vecāks
revīzija
4c9f047a7d
1 mainītis faili ar 9 papildinājumiem un 11 dzēšanām
  1. +9
    -11
      src/memory/mmc.js

+ 9
- 11
src/memory/mmc.js Parādīt failu

@@ -62,17 +62,15 @@ class MMC extends IMem{

get address(){return this.__addr;}
set address(a){
if (a >= 0 && a < this.size){
this.__addr = a;
let offset = 0;
for (let s=0; s < this.__switches.length; s++){
if (a >= offset && a < offset + this.__switches[s].mem.size){
this.__sidx = s;
this.__switches[s].mem.address = a - offset;
break;
} else {
offset += this.__switches[s].mem.size;
}
this.__addr = Math.min(this.size - 1, Math.max(0, a));
let offset = 0;
for (let s=0; s < this.__switches.length; s++){
if (this.__addr >= offset && this.__addr < offset + this.__switches[s].mem.size){
this.__sidx = s;
this.__switches[s].mem.address = this.__addr - offset;
break;
} else {
offset += this.__switches[s].mem.size;
}
}
}

Notiek ielāde…
Atcelt
Saglabāt