handle masked io properly
This commit is contained in:
parent
a3dfec659a
commit
aeba27f6cf
|
@ -224,13 +224,15 @@ impl Memory {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
0xFF04 => self.io[addr_l] = 0,
|
0xFF04 => self.io[addr_l] = 0,
|
||||||
0xFF07 => {
|
0xFF07 => self.masked_io(addr_l, data, 0b111),
|
||||||
self.masked_io(addr_l, data, 0b111);
|
0xFF0F => self.masked_io(addr_l, data, 0b11111),
|
||||||
}
|
0xFF10 => self.masked_io(addr_l, data, 0b01111111),
|
||||||
0xFF0F => {
|
0xFF1A => self.masked_io(addr_l, data, 0b10000000),
|
||||||
self.masked_io(addr_l, data, 0b11111);
|
0xFF1C => self.masked_io(addr_l, data, 0b1100000),
|
||||||
}
|
0xFF20 => self.masked_io(addr_l, data, 0b111111),
|
||||||
0xFF11 | 0xFF14 | 0xFF16 | 0xFF19 | 0xFF1E | 0xFF23 | 0xFF26 => {
|
0xFF23 => self.io[addr_l] = (self.io[addr_l] & 0b10111111) | (data & 0b01000000),
|
||||||
|
0xFF26 => self.io[addr_l] = (self.io[addr_l] & 0b1111111) | (data & 0b10000000),
|
||||||
|
0xFF11 | 0xFF14 | 0xFF16 | 0xFF19 | 0xFF1E => {
|
||||||
// sound
|
// sound
|
||||||
self.io[addr_l] = data;
|
self.io[addr_l] = data;
|
||||||
}
|
}
|
||||||
|
@ -242,7 +244,16 @@ impl Memory {
|
||||||
// cgb only
|
// cgb only
|
||||||
self.io[addr_l] = data;
|
self.io[addr_l] = data;
|
||||||
}
|
}
|
||||||
0xFF44 | 0xFF76 | 0xFF77 => {
|
0xFF03
|
||||||
|
| 0xFF08..0xFF0F
|
||||||
|
| 0xFF15
|
||||||
|
| 0xFF1F
|
||||||
|
| 0xFF27
|
||||||
|
| 0xFF28
|
||||||
|
| 0xFF29
|
||||||
|
| 0xFF44
|
||||||
|
| 0xFF76
|
||||||
|
| 0xFF77 => {
|
||||||
// read-only addresses
|
// read-only addresses
|
||||||
println!("BANNED write: {data:#X} to {address:#X}");
|
println!("BANNED write: {data:#X} to {address:#X}");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue