Pico32x.dirty_pal = 0;
}
+// 555 conversion for direct color mode
+#if defined(USE_BGR555)
+#define DC555(t) t
+#else
+#define DC555(t) ((t&m1) << 11) | ((t&m2) << 1) | ((t&m3) >> 10)
+#endif
+
// direct color mode
#define do_line_dc(pd, p32x, pmd, inv, pmd_draw_code) \
{ \
while (i > 0) { \
for (; i > 0 && (*pmd & 0x3f) == mdbg; pd++, pmd++, i--) { \
t = *p32x++; \
- *pd = ((t&m1) << 11) | ((t&m2) << 1) | ((t&m3) >> 10); \
+ *pd = DC555(t); \
} \
for (; i > 0 && (*pmd & 0x3f) != mdbg; pd++, pmd++, i--) { \
t = *p32x++; \
if ((t ^ inv) & 0x8000) \
- *pd = ((t&m1) << 11) | ((t&m2) << 1) | ((t&m3) >> 10); \
+ *pd = DC555(t); \
else \
pmd_draw_code; \
} \
*\r
* low prio s/h rendering:\r
* - plane and non-op sprite pixels have shadow\r
- * - sprite op pixel rendering is marked with hilight (deferred)\r
+ * - s/h sprite op pixel rendering is marked with hilight (deferred)\r
* high prio s/h rendering:\r
* - plane and non-op sprite pixels are normal\r
- * - all op sprite pixels (either marked or high prio) are rendered\r
+ * - all s/h sprite op pixels (either marked or high prio) are rendered\r
*\r
* not handled properly:\r
- * - high prio s/h sprite overlapping low prio sprite shows sprite, not A,B,G\r
+ * - high prio s/h sprite op overlapping low prio sprite shows sprite, not A,B,G\r
+ * - in debug sprite-masked, transparent high-prio sprite px don't remove shadow\r
*/\r
\r
#include "pico_int.h"\r
// NB s/h already resolved by non-forced drawing\r
// forced both layer draw (through debug reg)\r
#define pix_and(x) \\r
- pd[x] = (pd[x] & 0xc0) | (pd[x] & (pal | t))\r
+ pal |= 0xc0; /* leave s/h bits untouched in pixel "and" */ \\r
+ pd[x] &= pal | t\r
\r
TileNormMaker(TileNorm_and, pix_and)\r
TileFlipMaker(TileFlip_and, pix_and)\r
\r
// forced sprite draw (through debug reg)\r
#define pix_sh_as_and(x) \\r
+ pal |= 0xc0; /* leave s/h bits untouched in pixel "and" */ \\r
if (m & (1<<(x+8))) { \\r
m &= ~(1<<(x+8)); \\r
- if (t<0xe) pd[x] = (pd[x] & 0xc0) | (pd[x] & (pal | t)); \\r
+ if (t<0xe) pd[x] &= pal | t; \\r
}\r
\r
TileNormMakerAS(TileNormSH_AS_and, pix_sh_as_and)\r
dx+=cellskip<<3;\r
\r
// int force = (plane_sh&LF_FORCE) << 13;\r
+ if ((cell&1)==1)\r
+ {\r
+ int line,vscroll;\r
+ vscroll = PicoMem.vsram[plane + (cell&0x3e)];\r
+\r
+ // Find the line in the name table\r
+ line=(vscroll+scan)&ts->line&0xffff; // ts->line is really ymask ..\r
+ nametabadd=(line>>3)<<(ts->line>>24); // .. and shift[width]\r
+ ty=(line&7)<<1; // Y-Offset into tile\r
+ }\r
for (; cell < ts->cells; dx+=8,tilex++,cell++)\r
{\r
u32 code, pack;\r
\r
- if ((cell&1)==0 || cell<0)\r
+ if ((cell&1)==0)\r
{\r
int line,vscroll;\r
vscroll = PicoMem.vsram[plane + (cell&0x3e)];\r
tilex+=cellskip;\r
dx+=cellskip<<3;\r
\r
+ if ((cell&1)==1)\r
+ {\r
+ int line,vscroll;\r
+ vscroll = PicoMem.vsram[plane + (cell&0x3e)];\r
+\r
+ // Find the line in the name table\r
+ line=(vscroll+scan)&ts->line&0xffff; // ts->line is really ymask ..\r
+ nametabadd=(line>>3)<<(ts->line>>24); // .. and shift[width]\r
+ ty=(line&7)<<1; // Y-Offset into tile\r
+ }\r
for (; cell < ts->cells; dx+=8,tilex++,cell++)\r
{\r
unsigned int pack;\r
\r
- if ((cell&1)==0 || cell<0)\r
+ if ((cell&1)==0)\r
{\r
int line,vscroll;\r
vscroll = PicoMem.vsram[plane + (cell&0x3e)];\r
@ r3=nametabadd[31:16]|must_be_0[15:8]|pal[7:0]\r
@ r1=pd+dx r2=pack r6=hc r9=prevcode r11=HighCol r12=nametab lr=vram\r
@ r4 & r7 are scratch in this loop\r
+\r
+ @ need to calc new ty?\r
+ lsls r7, r10, #7 @ (cell&1)?\r
+ bmi .dsloop_vs_subr1\r
+\r
+ @ calc offset and read tileline code to r7, also calc ty\r
+ add_c24 r7, lr, (OFS_PMEM_vsram-OFS_PMEM_vram)\r
+ and r4, r10, #0x3e000000\r
+ add r7, r7, r4, asr #23 @ vsram + ((cell&0x3e)<<1)\r
+ tst r10,#0x8000 @ plane1?\r
+ addne r7, r7, #2\r
+ ldrh r7, [r7] @ r7=vscroll\r
+\r
+ bic r10,r10,#0xff @ clear old ty\r
+ and r4, r5, #0xff0000 @ scanline\r
+ add r4, r4, r7, lsl #16 @ ... += vscroll\r
+ and r4, r4, r5, lsl #16 @ ... &= ymask\r
+ and r7, r4, #0x70000\r
+ orr r10,r10,r7, lsr #15 @ new ty\r
+\r
+ mov r4, r4, lsr #19\r
+ mov r7, r5, lsr #24\r
+ mov r4, r4, lsl r7 @ nametabadd\r
+ and r3, r3, #0xff\r
+ orr r3, r3, r4, lsl #16 @ r3=(nametabadd[31:16],pal[15:0])\r
+\r
.dsloop_vs_subr1:\r
sub r1, r1, #8\r
.dsloop_vs: @ 40-41 times\r
ble .dsloop_vs_exit\r
\r
@ need to calc new ty?\r
- lsls r7, r10, #7 @ (cell&1) && ...\r
- mvnmis r7, r10 @ ... cell>=0\r
+ lsls r7, r10, #7 @ (cell&1)?\r
bmi 0f\r
\r
@ calc offset and read tileline code to r7, also calc ty\r