Update the screen auto-byte to bring it up to spec
This commit is contained in:
parent
dd6e5c4ee9
commit
d87d43ce22
26
src/main.c
26
src/main.c
|
@ -364,27 +364,33 @@ screen_deo(Device *d, u8 port) {
|
|||
if(d->dat[0x6] & 0x02) DEVPOKE16(0xa, y + 1); /* auto y+1 */
|
||||
} break;
|
||||
case 0xf: {
|
||||
u16 x, y, addr;
|
||||
u16 x, y, dx, dy, addr;
|
||||
u8 twobpp = !!(d->dat[0xf] & 0x80);
|
||||
DEVPEEK16(x, 0x8);
|
||||
DEVPEEK16(y, 0xa);
|
||||
DEVPEEK16(addr, 0xc);
|
||||
if(addr > 0xfff8 - twobpp * 8) {
|
||||
u8 n = d->dat[0x6] >> 4;
|
||||
dx = (d->dat[0x6] & 0x01) << 3;
|
||||
dy = (d->dat[0x6] & 0x02) << 2;
|
||||
if(addr > 0x10000 - ((n + 1) << (3 + twobpp))) {
|
||||
return;
|
||||
}
|
||||
u8 *layer = (d->dat[0xf] & 0x40) ? pixels_fg : pixels_bg;
|
||||
u8 color = d->dat[0xf] & 0xf;
|
||||
u8 flipx = d->dat[0xf] & 0x10;
|
||||
u8 flipy = d->dat[0xf] & 0x20;
|
||||
u8 *sprite = &d->u->ram[addr];
|
||||
if (twobpp) {
|
||||
ppu_2bpp(layer, x, y, sprite, color, flipx, flipy);
|
||||
} else {
|
||||
ppu_1bpp(layer, x, y, sprite, color, flipx, flipy);
|
||||
for(size_t i = 0; i <= n; i++) {
|
||||
u8 *sprite = &d->u->ram[addr];
|
||||
if (twobpp) {
|
||||
ppu_2bpp(layer, x + dy * i, y + dx * i, sprite, color, flipx, flipy);
|
||||
} else {
|
||||
ppu_1bpp(layer, x + dy * i, y + dx * i, sprite, color, flipx, flipy);
|
||||
}
|
||||
addr += (d->dat[0x6] & 0x04) << (1 + twobpp);
|
||||
}
|
||||
if(d->dat[0x6] & 0x04) DEVPOKE16(0xc, addr + 8 + twobpp * 8); /* auto addr+length */
|
||||
if(d->dat[0x6] & 0x01) DEVPOKE16(0x8, x + 8); /* auto x+8 */
|
||||
if(d->dat[0x6] & 0x02) DEVPOKE16(0xa, y + 8); /* auto y+8 */
|
||||
DEVPOKE16(0xc, addr); /* auto addr+length */
|
||||
DEVPOKE16(0x8, x + dx); /* auto x+8 */
|
||||
DEVPOKE16(0xa, y + dy); /* auto y+8 */
|
||||
} break;
|
||||
}
|
||||
reqdraw = 1;
|
||||
|
|
Loading…
Reference in New Issue