... | ... |
@@ -127,10 +127,8 @@ uxn_eval(Uxn *u, Uint16 vec) |
127 | 127 |
case 0x1e: /* EOR */ a = pop(u->src), b = pop(u->src); push(u->src, b ^ a); break; |
128 | 128 |
case 0x1f: /* SFT */ a = pop8(u->src), b = pop(u->src); push(u->src, b >> (a & 0x0f) << ((a & 0xf0) >> 4)); break; |
129 | 129 |
} |
130 |
- if(u->wst.error) |
|
131 |
- return uxn_halt(u, u->wst.error, "Working-stack", instr); |
|
132 |
- if(u->rst.error) |
|
133 |
- return uxn_halt(u, u->rst.error, "Return-stack", instr); |
|
130 |
+ if(u->wst.error) return uxn_halt(u, u->wst.error, "Working-stack", instr); |
|
131 |
+ if(u->rst.error) return uxn_halt(u, u->rst.error, "Return-stack", instr); |
|
134 | 132 |
} |
135 | 133 |
return 1; |
136 | 134 |
} |
... | ... |
@@ -322,24 +322,25 @@ screen_talk(Device *d, Uint8 b0, Uint8 w) |
322 | 322 |
if(w && b0 == 0xe) { |
323 | 323 |
Uint16 x = peek16(d->dat, 0x8); |
324 | 324 |
Uint16 y = peek16(d->dat, 0xa); |
325 |
- Uint8 layer = d->dat[0xe] >> 4 & 0x1; |
|
326 |
- ppu_pixel(&ppu, layer, x, y, d->dat[0xe] & 0x3); |
|
325 |
+ Uint8 layer = d->dat[0xe] & 0x40; |
|
326 |
+ ppu_pixel(&ppu, !!layer, x, y, d->dat[0xe] & 0x3); |
|
327 |
+ if(d->dat[0x6] & 0x1) poke16(d->dat, 0x8, x + 1); /* auto x+1 */ |
|
328 |
+ if(d->dat[0x6] & 0x2) poke16(d->dat, 0xa, y + 1); /* auto y+1 */ |
|
327 | 329 |
reqdraw = 1; |
328 | 330 |
} else if(w && b0 == 0xf) { |
329 | 331 |
Uint16 x = peek16(d->dat, 0x8); |
330 | 332 |
Uint16 y = peek16(d->dat, 0xa); |
331 |
- Uint8 layer = d->dat[0xf] >> 0x6 & 0x1; |
|
333 |
+ Uint8 layer = d->dat[0xf] & 0x40; |
|
332 | 334 |
Uint8 *addr = &d->mem[peek16(d->dat, 0xc)]; |
333 |
- /* Sprite byte */ |
|
334 |
- if(d->dat[0xf] >> 0x7 & 0x6) |
|
335 |
- ppu_2bpp(&ppu, layer, x, y, addr, d->dat[0xf] & 0xf, d->dat[0xf] >> 0x4 & 0x1, d->dat[0xf] >> 0x5 & 0x1); |
|
336 |
- else |
|
337 |
- ppu_1bpp(&ppu, layer, x, y, addr, d->dat[0xf] & 0xf, d->dat[0xf] >> 0x4 & 0x1, d->dat[0xf] >> 0x5 & 0x1); |
|
338 |
- /* Auto byte */ |
|
339 |
- if(d->dat[0x6] & 0x1) poke16(d->dat, 0x8, x + 8); |
|
340 |
- if(d->dat[0x6] & 0x2) poke16(d->dat, 0xa, y + 8); |
|
341 |
- if(d->dat[0x6] & 0x3) poke16(d->dat, 0xc, peek16(d->dat, 0xc) + 8); |
|
342 |
- if(d->dat[0x6] & 0x4) poke16(d->dat, 0xc, peek16(d->dat, 0xc) + 16); |
|
335 |
+ if(d->dat[0xf] & 0x80) { |
|
336 |
+ ppu_2bpp(&ppu, !!layer, x, y, addr, d->dat[0xf] & 0xf, d->dat[0xf] & 0x10, d->dat[0xf] & 0x20); |
|
337 |
+ if(d->dat[0x6] & 0x3) poke16(d->dat, 0xc, peek16(d->dat, 0xc) + 16); /* auto addr+16 */ |
|
338 |
+ } else { |
|
339 |
+ ppu_1bpp(&ppu, !!layer, x, y, addr, d->dat[0xf] & 0xf, d->dat[0xf] & 0x10, d->dat[0xf] & 0x20); |
|
340 |
+ if(d->dat[0x6] & 0x3) poke16(d->dat, 0xc, peek16(d->dat, 0xc) + 8); /* auto addr+8 */ |
|
341 |
+ } |
|
342 |
+ if(d->dat[0x6] & 0x1) poke16(d->dat, 0x8, x + 8); /* auto x+8 */ |
|
343 |
+ if(d->dat[0x6] & 0x2) poke16(d->dat, 0xa, y + 8); /* auto y+8 */ |
|
343 | 344 |
reqdraw = 1; |
344 | 345 |
} |
345 | 346 |
return 1; |