instruction.rs: Add edge wrapping for draw_lores_sprite, and fix the Last Byte Bug
This commit is contained in:
parent
401b247c05
commit
1573e00928
@ -339,16 +339,25 @@ impl CPU {
|
|||||||
let sprite = sprite.to_vec();
|
let sprite = sprite.to_vec();
|
||||||
for (line, &sprite) in sprite.iter().enumerate() {
|
for (line, &sprite) in sprite.iter().enumerate() {
|
||||||
let line = line as u16;
|
let line = line as u16;
|
||||||
if y + line >= h {
|
let sprite = ((sprite as u16) << (8 - (x % 8))).to_be_bytes();
|
||||||
break;
|
for (addr, &byte) in sprite.iter().enumerate().filter_map(|(idx, byte)| {
|
||||||
}
|
let x = (x / 8) + idx as u16;
|
||||||
let sprite = (sprite as u16) << (8 - (x % 8))
|
Some((
|
||||||
& if (x % w) >= (w - 8) { 0xff00 } else { 0xffff };
|
if self.flags.quirks.screen_wrap {
|
||||||
let addr = |x, y| -> u16 { (y + line) * w_bytes + (x / 8) + self.screen };
|
((y + line) % h * w_bytes + (x % w_bytes)) % (w_bytes * h)
|
||||||
let screen: u16 = bus.read(addr(x, y));
|
} else if x < w_bytes {
|
||||||
bus.write(addr(x, y), screen ^ sprite);
|
(y + line) * w_bytes + x
|
||||||
if screen & sprite != 0 {
|
} else {
|
||||||
self.v[0xf] = 1;
|
return None;
|
||||||
|
} + self.screen,
|
||||||
|
byte,
|
||||||
|
))
|
||||||
|
}) {
|
||||||
|
let screen: u8 = bus.read(addr);
|
||||||
|
bus.write(addr, byte ^ screen);
|
||||||
|
if byte & screen != 0 {
|
||||||
|
self.v[0xf] = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user