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