Pico.video.addr=(unsigned short)(Pico.video.addr+Pico.video.reg[0xf]);\r
}\r
\r
-static NOINLINE void VideoWrite128(u32 a, u16 d)\r
+static NOINLINE unsigned int VideoWrite128(u32 a, u16 d)\r
{\r
// nasty\r
a = ((a & 2) >> 1) | ((a & 0x400) >> 9) | (a & 0x3FC) | ((a & 0x1F800) >> 1);\r
((u8 *)PicoMem.vram)[a] = d;\r
+ return a;\r
}\r
\r
static void VideoWrite(u16 d)\r
case 1: if (a & 1)\r
d = (u16)((d << 8) | (d >> 8));\r
PicoMem.vram [(a >> 1) & 0x7fff] = d;\r
- if (a - ((unsigned)(Pico.video.reg[5]&0x7f) << 9) < 0x400)\r
+ if ((unsigned)(a - ((Pico.video.reg[5]&0x7f) << 9)) < 0x400)\r
Pico.est.rendstatus |= PDRAW_DIRTY_SPRITES;\r
break;\r
case 3: if (PicoMem.cram [(a >> 1) & 0x3f] != d) Pico.m.dirtyPal = 1;\r
PicoMem.cram [(a >> 1) & 0x3f] = d; break;\r
case 5: PicoMem.vsram[(a >> 1) & 0x3f] = d; break;\r
- case 0x81:\r
- a |= Pico.video.addr_u << 16;\r
- VideoWrite128(a, d);\r
- break;\r
+ case 0x81: if (a & 1)\r
+ d = (u16)((d << 8) | (d >> 8));\r
+ a |= Pico.video.addr_u << 16;\r
+ a = VideoWrite128(a, d);\r
+ if ((unsigned)(a - ((Pico.video.reg[5]&0x7f) << 9)) < 0x400)\r
+ Pico.est.rendstatus |= PDRAW_DIRTY_SPRITES;\r
+ break;\r
//default:elprintf(EL_ANOMALY, "VDP write %04x with bad type %i", d, Pico.video.type); break;\r
}\r
\r
if (!once++)\r
elprintf(EL_STATUS|EL_ANOMALY|EL_VDPDMA, "TODO: cram/vsram fill");\r
}\r
+ case 0x81:\r
+ for (l = len; l; l--) {\r
+ VideoWrite128(a, data);\r
+\r
+ // Increment address register\r
+ a = (a + inc) & 0x1ffff;\r
+ }\r
+ Pico.video.addr_u = a >> 16;\r
+ Pico.est.rendstatus |= PDRAW_DIRTY_SPRITES;\r
+ break;\r
default:\r
a += len * inc;\r
break;\r