Rewritten screen_talk with switch

This commit is contained in:
Andrew Alderwick 2021-09-19 22:51:35 +01:00
parent 6337680774
commit 15239a1fd2
1 changed files with 33 additions and 25 deletions

View File

@ -345,32 +345,40 @@ screen_talk(Device *d, Uint8 b0, Uint8 w)
{ {
if(!w) if(!w)
return 1; return 1;
if(b0 == 0x3) else
set_size(peek16(d->dat, 0x2), ppu.height); switch(b0) {
else if(b0 == 0x5) case 0x3:
set_size(ppu.width, peek16(d->dat, 0x4)); set_size(peek16(d->dat, 0x2), ppu.height);
else if(b0 == 0xe) { break;
Uint16 x = peek16(d->dat, 0x8); case 0x5:
Uint16 y = peek16(d->dat, 0xa); set_size(ppu.width, peek16(d->dat, 0x4));
Uint8 layer = d->dat[0xe] & 0x40; break;
reqdraw |= ppu_pixel(&ppu, layer ? ppu.fg : ppu.bg, x, y, d->dat[0xe] & 0x3); case 0xe: {
if(d->dat[0x6] & 0x01) poke16(d->dat, 0x8, x + 1); /* auto x+1 */ Uint16 x = peek16(d->dat, 0x8);
if(d->dat[0x6] & 0x02) poke16(d->dat, 0xa, y + 1); /* auto y+1 */ Uint16 y = peek16(d->dat, 0xa);
} else if(b0 == 0xf) { Uint8 layer = d->dat[0xe] & 0x40;
Uint16 x = peek16(d->dat, 0x8); reqdraw |= ppu_pixel(&ppu, layer ? ppu.fg : ppu.bg, x, y, d->dat[0xe] & 0x3);
Uint16 y = peek16(d->dat, 0xa); if(d->dat[0x6] & 0x01) poke16(d->dat, 0x8, x + 1); /* auto x+1 */
Uint8 layer = d->dat[0xf] & 0x40; if(d->dat[0x6] & 0x02) poke16(d->dat, 0xa, y + 1); /* auto y+1 */
Uint8 *addr = &d->mem[peek16(d->dat, 0xc)]; break;
if(d->dat[0xf] & 0x80) { }
reqdraw |= ppu_2bpp(&ppu, layer ? ppu.fg : ppu.bg, x, y, addr, d->dat[0xf] & 0xf, d->dat[0xf] & 0x10, d->dat[0xf] & 0x20); case 0xf: {
if(d->dat[0x6] & 0x04) poke16(d->dat, 0xc, peek16(d->dat, 0xc) + 16); /* auto addr+16 */ Uint16 x = peek16(d->dat, 0x8);
} else { Uint16 y = peek16(d->dat, 0xa);
reqdraw |= ppu_1bpp(&ppu, layer ? ppu.fg : ppu.bg, x, y, addr, d->dat[0xf] & 0xf, d->dat[0xf] & 0x10, d->dat[0xf] & 0x20); Uint8 layer = d->dat[0xf] & 0x40;
if(d->dat[0x6] & 0x04) poke16(d->dat, 0xc, peek16(d->dat, 0xc) + 8); /* auto addr+8 */ Uint8 *addr = &d->mem[peek16(d->dat, 0xc)];
if(d->dat[0xf] & 0x80) {
reqdraw |= ppu_2bpp(&ppu, layer ? ppu.fg : ppu.bg, x, y, addr, d->dat[0xf] & 0xf, d->dat[0xf] & 0x10, d->dat[0xf] & 0x20);
if(d->dat[0x6] & 0x04) poke16(d->dat, 0xc, peek16(d->dat, 0xc) + 16); /* auto addr+16 */
} else {
reqdraw |= ppu_1bpp(&ppu, layer ? ppu.fg : ppu.bg, x, y, addr, d->dat[0xf] & 0xf, d->dat[0xf] & 0x10, d->dat[0xf] & 0x20);
if(d->dat[0x6] & 0x04) poke16(d->dat, 0xc, peek16(d->dat, 0xc) + 8); /* auto addr+8 */
}
if(d->dat[0x6] & 0x01) poke16(d->dat, 0x8, x + 8); /* auto x+8 */
if(d->dat[0x6] & 0x02) poke16(d->dat, 0xa, y + 8); /* auto y+8 */
break;
}
} }
if(d->dat[0x6] & 0x01) poke16(d->dat, 0x8, x + 8); /* auto x+8 */
if(d->dat[0x6] & 0x02) poke16(d->dat, 0xa, y + 8); /* auto y+8 */
}
return 1; return 1;
} }