void vidConvCpyRGB565(void *to, void *from, int pixels);\r
#endif\r
void PicoDoHighPal555(int sh, int line, struct PicoEState *est);\r
-// internals\r
+// internals, NB must keep in sync with ASM draw functions\r
#define PDRAW_SPRITES_MOVED (1<<0) // SAT address modified\r
#define PDRAW_WND_DIFF_PRIO (1<<1) // not all window tiles use same priority\r
#define PDRAW_PARSE_SPRITES (1<<2) // SAT needs parsing\r
extern unsigned SATaddr, SATmask;\r
static __inline void UpdateSAT(u32 a, u32 d)\r
{\r
- unsigned num = (a-SATaddr) >> 3;\r
+ unsigned num = (a^SATaddr) >> 3;\r
\r
Pico.est.rendstatus |= PDRAW_DIRTY_SPRITES;\r
if (!(a & 4) && num < 128) {\r
int PicoVideoFIFOWrite(int count, int byte_p, unsigned sr_mask, unsigned sr_flags);\r
void PicoVideoSave(void);\r
void PicoVideoLoad(void);\r
+void PicoVideoCacheSAT(void);\r
\r
// misc.c\r
PICO_INTERNAL_ASM void memcpy16bswap(unsigned short *dest, void *src, int count);\r
areaRead(&Pico.video, 1, sizeof(Pico.video), afile);\r
}\r
areaClose(afile);\r
+\r
+ PicoVideoCacheSAT();\r
return 0;\r
}\r
\r
unsigned short vram[0x8000];\r
unsigned short cram[0x40];\r
unsigned short vsram[0x40];\r
+ unsigned int satcache[0x80];\r
\r
//struct PicoMisc m;\r
struct PicoVideo video;\r
memcpy(t->vram, PicoMem.vram, sizeof(PicoMem.vram));\r
memcpy(t->cram, PicoMem.cram, sizeof(PicoMem.cram));\r
memcpy(t->vsram, PicoMem.vsram, sizeof(PicoMem.vsram));\r
+ memcpy(t->satcache, VdpSATCache, sizeof(VdpSATCache));\r
memcpy(&t->video, &Pico.video, sizeof(Pico.video));\r
\r
#ifndef NO_32X\r
memcpy(PicoMem.vram, t->vram, sizeof(PicoMem.vram));\r
memcpy(PicoMem.cram, t->cram, sizeof(PicoMem.cram));\r
memcpy(PicoMem.vsram, t->vsram, sizeof(PicoMem.vsram));\r
+ memcpy(VdpSATCache, t->satcache, sizeof(VdpSATCache));\r
memcpy(&Pico.video, &t->video, sizeof(Pico.video));\r
Pico.m.dirtyPal = 1;\r
\r
return d;\r
}\r
\r
+void PicoVideoCacheSAT(void)\r
+{\r
+ struct PicoVideo *pv = &Pico.video;\r
+ int l;\r
+\r
+ SATaddr = ((pv->reg[5]&0x7f) << 9) | ((pv->reg[6]&0x20) << 11);\r
+ SATmask = ~0x1ff;\r
+ if (pv->reg[12]&1)\r
+ SATaddr &= ~0x200, SATmask &= ~0x200; // H40, zero lowest SAT bit\r
+\r
+ // rebuild SAT cache XXX wrong since cache and memory can differ\r
+ for (l = 0; l < 80; l++) {\r
+ ((u16 *)VdpSATCache)[l*2 ] = PicoMem.vram[(SATaddr>>1) + l*4 ];\r
+ ((u16 *)VdpSATCache)[l*2 + 1] = PicoMem.vram[(SATaddr>>1) + l*4 + 1];\r
+ }\r
+\r
+ Pico.est.rendstatus |= PDRAW_SPRITES_MOVED;\r
+}\r
+\r
void PicoVideoSave(void)\r
{\r
struct VdpFIFO *vf = &VdpFIFO;\r
{\r
struct VdpFIFO *vf = &VdpFIFO;\r
struct PicoVideo *pv = &Pico.video;\r
- int l;\r
\r
// convert former dma_xfers (why was this in PicoMisc anyway?)\r
if (Pico.m.dma_xfers) {\r
vf->fifo_total = Pico.m.dma_xfers;\r
Pico.m.dma_xfers = 0;\r
}\r
-\r
- SATaddr = ((pv->reg[5]&0x7f) << 9) | ((pv->reg[6]&0x20) << 11);\r
- SATmask = ~0x1ff;\r
- if (pv->reg[12]&1)\r
- SATaddr &= ~0x200, SATmask &= ~0x200; // H40, zero lowest SAT bit\r
-\r
- // rebuild SAT cache XXX wrong since cache and memory can differ\r
- for (l = 0; l < 80; l++) {\r
- *((u16 *)VdpSATCache + 2*l ) = PicoMem.vram[(SATaddr>>1) + l*4 ];\r
- *((u16 *)VdpSATCache + 2*l+1) = PicoMem.vram[(SATaddr>>1) + l*4 + 1];\r
- }\r
+ PicoVideoCacheSAT();\r
}\r
-\r
// vim:shiftwidth=2:ts=2:expandtab\r
\r
PicoDrawSetOutFormat(PDF_RGB555, 1);\r
Pico.m.dirtyPal = 1;\r
+ Pico.est.rendstatus |= PDRAW_DIRTY_SPRITES;\r
if (do_emu)\r
PicoFrame();\r
else\r