(draft) Add looping functionality to Screen/auto.

This commit is contained in:
Andrew Alderwick 2022-03-06 13:36:47 +00:00
parent 11c9ec8b49
commit 1b04e0814b
2 changed files with 42 additions and 4 deletions

View File

@ -0,0 +1,30 @@
( devices )
|00 @System &vector $2 &wst $1 &rst $1 &swsz $1 &swap $1 &pad $2 &r $2 &g $2 &b $2 &debug $1 &halt $1
|20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1
( variables )
|0000
( program )
|0100 ( -> )
( theme )
#0fe5 .System/r DEO2
#0fc5 .System/g DEO2
#0f25 .System/b DEO2
#35 .Screen/auto DEO
;font #0210 ADD2 .Screen/addr DEO2
#3400 &loop
#04 .Screen/sprite DEO
INC
GTHk ,&loop JCN
BRK
~projects/assets/msx01x02.tal

View File

@ -157,7 +157,7 @@ screen_deo(Device *d, Uint8 port)
break;
}
case 0xf: {
Uint16 x, y, addr;
Uint16 x, y, addr, auto_i;
Uint8 twobpp = !!(d->dat[0xf] & 0x80);
Layer *layer = (d->dat[0xf] & 0x40) ? &uxn_screen.fg : &uxn_screen.bg;
DEVPEEK16(x, 0x8);
@ -166,9 +166,17 @@ screen_deo(Device *d, Uint8 port)
if(addr > 0xfff8 - twobpp * 8)
return;
screen_blit(&uxn_screen, layer, x, y, &d->u->ram[addr], d->dat[0xf] & 0xf, d->dat[0xf] & 0x10, d->dat[0xf] & 0x20, 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 */
auto_i = d->dat[0x6] + 0x40;
if((auto_i >> 6) > ((auto_i & 0x30) >> 4)) {
d->dat[0x6] = auto_i & 0x3f;
DEVPOKE16(0x8, x + ((auto_i & 0x01) << 3) - ((auto_i & 0x02) * (auto_i & 0x30) >> 2));
DEVPOKE16(0xa, y + ((auto_i & 0x02) << 2) - ((auto_i & 0x01) * (auto_i & 0x30) >> 1));
} else {
d->dat[0x6] = auto_i;
DEVPOKE16(0x8, x + ((auto_i & 0x02) << 2));
DEVPOKE16(0xa, y + ((auto_i & 0x01) << 3));
}
if(auto_i & 0x04) DEVPOKE16(0xc, addr + 8 + twobpp * 8); /* auto addr+length */
break;
}
}