commit e52fe8292517217fdb75c00d8272ba216037a7c6
parent a3502f163774ae2d863a10f10dd83e8c6aa44e35
Author: neauoire <aliceffekt@gmail.com>
Date: Fri, 10 Sep 2021 08:52:07 -0700
Fixed PPU auto byte
Diffstat:
2 files changed, 16 insertions(+), 17 deletions(-)
diff --git a/src/uxn.c b/src/uxn.c
@@ -127,10 +127,8 @@ uxn_eval(Uxn *u, Uint16 vec)
case 0x1e: /* EOR */ a = pop(u->src), b = pop(u->src); push(u->src, b ^ a); break;
case 0x1f: /* SFT */ a = pop8(u->src), b = pop(u->src); push(u->src, b >> (a & 0x0f) << ((a & 0xf0) >> 4)); break;
}
- if(u->wst.error)
- return uxn_halt(u, u->wst.error, "Working-stack", instr);
- if(u->rst.error)
- return uxn_halt(u, u->rst.error, "Return-stack", instr);
+ if(u->wst.error) return uxn_halt(u, u->wst.error, "Working-stack", instr);
+ if(u->rst.error) return uxn_halt(u, u->rst.error, "Return-stack", instr);
}
return 1;
}
diff --git a/src/uxnemu.c b/src/uxnemu.c
@@ -322,24 +322,25 @@ screen_talk(Device *d, Uint8 b0, Uint8 w)
if(w && b0 == 0xe) {
Uint16 x = peek16(d->dat, 0x8);
Uint16 y = peek16(d->dat, 0xa);
- Uint8 layer = d->dat[0xe] >> 4 & 0x1;
- ppu_pixel(&ppu, layer, x, y, d->dat[0xe] & 0x3);
+ Uint8 layer = d->dat[0xe] & 0x40;
+ ppu_pixel(&ppu, !!layer, x, y, d->dat[0xe] & 0x3);
+ if(d->dat[0x6] & 0x1) poke16(d->dat, 0x8, x + 1); /* auto x+1 */
+ if(d->dat[0x6] & 0x2) poke16(d->dat, 0xa, y + 1); /* auto y+1 */
reqdraw = 1;
} else if(w && b0 == 0xf) {
Uint16 x = peek16(d->dat, 0x8);
Uint16 y = peek16(d->dat, 0xa);
- Uint8 layer = d->dat[0xf] >> 0x6 & 0x1;
+ Uint8 layer = d->dat[0xf] & 0x40;
Uint8 *addr = &d->mem[peek16(d->dat, 0xc)];
- /* Sprite byte */
- if(d->dat[0xf] >> 0x7 & 0x6)
- ppu_2bpp(&ppu, layer, x, y, addr, d->dat[0xf] & 0xf, d->dat[0xf] >> 0x4 & 0x1, d->dat[0xf] >> 0x5 & 0x1);
- else
- ppu_1bpp(&ppu, layer, x, y, addr, d->dat[0xf] & 0xf, d->dat[0xf] >> 0x4 & 0x1, d->dat[0xf] >> 0x5 & 0x1);
- /* Auto byte */
- if(d->dat[0x6] & 0x1) poke16(d->dat, 0x8, x + 8);
- if(d->dat[0x6] & 0x2) poke16(d->dat, 0xa, y + 8);
- if(d->dat[0x6] & 0x3) poke16(d->dat, 0xc, peek16(d->dat, 0xc) + 8);
- if(d->dat[0x6] & 0x4) poke16(d->dat, 0xc, peek16(d->dat, 0xc) + 16);
+ if(d->dat[0xf] & 0x80) {
+ ppu_2bpp(&ppu, !!layer, x, y, addr, d->dat[0xf] & 0xf, d->dat[0xf] & 0x10, d->dat[0xf] & 0x20);
+ if(d->dat[0x6] & 0x3) poke16(d->dat, 0xc, peek16(d->dat, 0xc) + 16); /* auto addr+16 */
+ } else {
+ ppu_1bpp(&ppu, !!layer, x, y, addr, d->dat[0xf] & 0xf, d->dat[0xf] & 0x10, d->dat[0xf] & 0x20);
+ if(d->dat[0x6] & 0x3) poke16(d->dat, 0xc, peek16(d->dat, 0xc) + 8); /* auto addr+8 */
+ }
+ if(d->dat[0x6] & 0x1) poke16(d->dat, 0x8, x + 8); /* auto x+8 */
+ if(d->dat[0x6] & 0x2) poke16(d->dat, 0xa, y + 8); /* auto y+8 */
reqdraw = 1;
}
return 1;