* 10 shadow pal index\r
* 11 hilight|shadow=normal pal index\r
*\r
- * sprite ops can only be correctly done after the plane rendering s/h state is\r
- * known since the op result changes if there's at least one high prio plane.\r
+ * sprite s/h can only be correctly done after the plane rendering s/h state is\r
+ * known since the s/h result changes if there's at least one high prio plane.\r
* sprite op rendering is deferred until this is known, and hilight is used as\r
* mark since it can't occur before sprite ops:\r
* x1 op marker pal index\r
* - 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 (marked low, or high prio) are rendered\r
+ * - all op sprite pixels (either marked or high prio) are rendered\r
*\r
* not handled properly:\r
- * - high prio s/h ops overlapping low prio sprite shows low sprite, not A,B,G\r
+ * - high prio s/h sprite overlapping low prio sprite shows sprite, not A,B,G\r
*/\r
\r
#include "pico_int.h"\r
\r
#define LF_PLANE (1 << 0) // must be = 1\r
#define LF_SH (1 << 1) // must be = 2\r
-#define LF_FORCE (1 << 2)\r
+//#define LF_FORCE (1 << 2)\r
\r
#define LF_PLANE_A 0\r
#define LF_PLANE_B 1\r
\r
// draw sprite pixels, process operator colors\r
#define pix_sh(x) \\r
- if (!t); \\r
- else if (t>=0xe) pd[x]|=(t-1)<<6; /* 80 shadow, 40 hilight */ \\r
- else pd[x]=pal|t\r
+ if (t) { \\r
+ if (t>=0xe) pd[x]|=(t-1)<<6; /* 80 shadow, 40 hilight */ \\r
+ else pd[x]=pal|t; \\r
+ }\r
\r
TileNormMaker(TileNormSH, pix_sh)\r
TileFlipMaker(TileFlipSH, pix_sh)\r
\r
// draw sprite pixels, mark but don't process operator colors\r
#define pix_sh_markop(x) \\r
- if (!t); \\r
- else if (t>=0xe) pd[x]|=0x40; \\r
- else pd[x]=pal|t\r
+ if (t) { \\r
+ if (t>=0xe) pd[x]|=0x40; \\r
+ else pd[x]=pal|t; \\r
+ }\r
\r
TileNormMaker(TileNormSH_markop, pix_sh_markop)\r
TileFlipMaker(TileFlipSH_markop, pix_sh_markop)\r
// draw low prio sprite operator pixels if visible (i.e. marked)\r
#define pix_sh_onlyop(x) \\r
if (t>=0xe && (pd[x]&0x40)) \\r
- pd[x]=(pd[x]&0xbf)|((t-1)<<6)\r
+ pd[x]=(pd[x]&~0x40)|((t-1)<<6)\r
\r
#ifndef _ASM_DRAW_C\r
\r
TileFlipMakerAS(TileFlipAS, pix_as)\r
\r
// draw high prio sprite pixels, process operator colors (AS)\r
-// sprite+planes: h+s->n, h+[nh]->h, s+[nhs]->s, hence mask h before op\r
+// NB sprite+planes: h+s->n, h+[nh]->h, s+[nhs]->s, hence mask h before op\r
#define pix_sh_as(x) \\r
if (t && (m & (1<<(x+8)))) { \\r
m &= ~(1<<(x+8)); \\r
- if (t>=0xe) pd[x]=(pd[x]&0xbf)|((t-1)<<6); \\r
+ if (t>=0xe) pd[x]=(pd[x]&~0x40)|((t-1)<<6); \\r
else pd[x] = pal | t; \\r
}\r
\r
TileFlipMakerAS(TileFlipAS_onlymark, pix_sh_as_onlymark)\r
\r
#ifdef FORCE\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
TileFlipMaker(TileFlip_and, pix_and)\r
\r
// forced sprite draw (through debug reg)\r
-#define pix_sh_as_and(x) /* XXX is there S/H with forced draw? */ \\r
+#define pix_sh_as_and(x) \\r
if (m & (1<<(x+8))) { \\r
m &= ~(1<<(x+8)); \\r
- if (t>=0xe) pd[x]=(pd[x]&0xbf)|((t-1)<<6); \\r
- else pd[x] = (pd[x] & 0xc0) | (pd[x] & (pal | t)); \\r
+ if (t<0xe) pd[x] = (pd[x] & 0xc0) | (pd[x] & (pal | t)); \\r
}\r
\r
TileNormMakerAS(TileNormSH_AS_and, pix_sh_as_and)\r
static void DrawStrip(struct TileStrip *ts, int lflags, int cellskip)\r
{\r
unsigned char *pd = Pico.est.HighCol;\r
- int tilex,dx,ty,code=0,addr=0,cells;\r
- int oldcode=-1,blank=-1; // The tile we know is blank\r
- int pal=0;\r
- unsigned int pack = 0;\r
+ int *hc = ts->hc;\r
+ int tilex, dx, ty, cells;\r
+ int oldcode = -1, blank = -1; // The tile we know is blank\r
+ unsigned int pal = 0, pack = 0;\r
\r
// Draw tiles across screen:\r
tilex=((-ts->hscroll)>>3)+cellskip;\r
if(dx != 8) cells++; // have hscroll, need to draw 1 cell more\r
dx+=cellskip<<3;\r
\r
+// int force = (lflags&LF_FORCE) << 13;\r
for (; cells > 0; dx+=8, tilex++, cells--)\r
{\r
- code = PicoMem.vram[ts->nametab + (tilex & ts->xmask)];\r
+ u32 code = PicoMem.vram[ts->nametab + (tilex & ts->xmask)];\r
+// code &= ~force; // forced always draw everything\r
+\r
+ if (code == blank && !((code & 0x8000) && (lflags & LF_SH)))\r
+ continue;\r
\r
if (code!=oldcode) {\r
oldcode = code;\r
pack = 0;\r
if (code != blank) {\r
// Get tile address/2:\r
- addr=(code&0x7ff)<<4;\r
- addr+=ty;\r
- if (code&0x1000) addr^=0xe; // Y-flip\r
+ u32 addr = ((code&0x7ff)<<4) + ty;\r
+ if (code & 0x1000) addr ^= 0xe; // Y-flip\r
\r
- pal=((code>>9)&0x30)|((lflags&LF_SH)<<6); // shadow\r
+ pal = ((code>>9)&0x30) | ((lflags&LF_SH)<<6); // shadow\r
\r
pack = *(unsigned int *)(PicoMem.vram + addr);\r
if (!pack)\r
}\r
}\r
\r
- if ((code >> 15) | (lflags & LF_FORCE)) { // high priority tile\r
- if ((lflags&LF_SH) | (code!=blank)) {\r
- int cval = code | (dx<<16) | (ty<<25);\r
- if (code&0x1000) cval^=0xe<<25;\r
- *ts->hc++ = cval, *ts->hc++ = pack; // cache it\r
- }\r
- continue;\r
+ if (code & 0x8000) { // (un-forced) high priority tile\r
+ int cval = code | (dx<<16) | (ty<<25);\r
+ if (code & 0x1000) cval ^= 0xe<<25;\r
+ *hc++ = cval, *hc++ = pack; // cache it\r
+ } else if (code != blank) {\r
+ if (code & 0x0800) TileFlip(pd + dx, pack, pal);\r
+ else TileNorm(pd + dx, pack, pal);\r
}\r
- if (code == blank)\r
- continue;\r
-\r
- if (code & 0x0800) TileFlip(pd + dx, pack, pal);\r
- else TileNorm(pd + dx, pack, pal);\r
}\r
\r
// terminate the cache list\r
- *ts->hc = 0;\r
+ *hc = 0;\r
+\r
// if oldcode wasn't changed, it means all layer is hi priority\r
if (oldcode == -1) Pico.est.rendstatus |= PDRAW_PLANE_HI_PRIO;\r
}\r
static void DrawStripVSRam(struct TileStrip *ts, int plane_sh, int cellskip)\r
{\r
unsigned char *pd = Pico.est.HighCol;\r
- int tilex,dx,code=0,addr=0,cell=0;\r
- int oldcode=-1,blank=-1; // The tile we know is blank\r
- int pal=0,scan=Pico.est.DrawScanline;\r
+ int *hc = ts->hc;\r
+ int tilex, dx, ty = 0, addr = 0, cell = 0, nametabadd = 0;\r
+ int oldcode = -1, blank = -1; // The tile we know is blank\r
+ unsigned int pal = 0, scan = Pico.est.DrawScanline;\r
\r
// Draw tiles across screen:\r
tilex=(-ts->hscroll)>>3;\r
tilex+=cellskip;\r
dx+=cellskip<<3;\r
\r
+// int force = (plane_sh&LF_FORCE) << 13;\r
for (; cell < ts->cells; dx+=8,tilex++,cell++)\r
{\r
- int nametabadd, ty;\r
- unsigned int pack;\r
+ u32 code, pack;\r
\r
- //if((cell&1)==0)\r
+ if ((cell&1)==0 || cell<0)\r
{\r
int line,vscroll;\r
- vscroll=PicoMem.vsram[(plane_sh&1)+(cell&0x3e)];\r
+ vscroll = PicoMem.vsram[(plane_sh&1) + (cell&0x3e)];\r
\r
// Find the line in the name table\r
line=(vscroll+scan)&ts->line&0xffff; // ts->line is really ymask ..\r
ty=(line&7)<<1; // Y-Offset into tile\r
}\r
\r
- code=PicoMem.vram[ts->nametab+nametabadd+(tilex&ts->xmask)];\r
+ code= PicoMem.vram[ts->nametab + nametabadd + (tilex & ts->xmask)];\r
+// code &= ~force; // forced always draw everything\r
+ code |= ty<<16; // add ty since that can change pixel row for every 2nd tile\r
+\r
+ if (code == blank && !((code & 0x8000) && (plane_sh & LF_SH)))\r
+ continue;\r
+\r
if (code!=oldcode) {\r
oldcode = code;\r
// Get tile address/2:\r
addr = (code&0x7ff)<<4;\r
\r
- pal = ((code>>9)&0x30)|((plane_sh&LF_SH)<<6); // shadow\r
+ pal = ((code>>9)&0x30) | ((plane_sh&LF_SH)<<6); // shadow\r
}\r
- code |= ty<<16;\r
\r
- if (code & 0x1000) ty ^= 0xe; // Y-flip\r
- pack = *(unsigned int *)(PicoMem.vram + addr+ty);\r
+ pack = (code & 0x1000 ? ty^0xe : ty); // Y-flip\r
+ pack = *(unsigned int *)(PicoMem.vram + addr+pack);\r
if (!pack)\r
blank = code;\r
\r
- if ((code >> 15) | (plane_sh & LF_FORCE)) { // high priority tile\r
- if ((plane_sh&LF_SH) | (code!=blank)) {\r
- int cval = code | (dx<<16) | (ty<<25);\r
- *ts->hc++ = cval, *ts->hc++ = pack; // cache it\r
- }\r
- continue;\r
+ if (code & 0x8000) { // (un-forced) high priority tile\r
+ int cval = (u16)code | (dx<<16) | (ty<<25);\r
+ if (code & 0x1000) cval ^= 0xe<<25;\r
+ *hc++ = cval, *hc++ = pack; // cache it\r
+ } else if (code != blank) {\r
+ if (code & 0x0800) TileFlip(pd + dx, pack, pal);\r
+ else TileNorm(pd + dx, pack, pal);\r
}\r
- if (code == blank) continue;\r
-\r
- if (code & 0x0800) TileFlip(pd + dx, pack, pal);\r
- else TileNorm(pd + dx, pack, pal);\r
}\r
\r
// terminate the cache list\r
- *ts->hc = 0;\r
+ *hc = 0;\r
+\r
if (oldcode == -1) Pico.est.rendstatus |= PDRAW_PLANE_HI_PRIO;\r
}\r
#endif\r
void DrawStripInterlace(struct TileStrip *ts, int plane_sh)\r
{\r
unsigned char *pd = Pico.est.HighCol;\r
- int tilex=0,dx=0,ty=0,code=0,addr=0,cells;\r
- int oldcode=-1,blank=-1; // The tile we know is blank\r
- int pal=0;\r
- unsigned int pack = 0;\r
+ int *hc = ts->hc;\r
+ int tilex = 0, dx = 0, ty = 0, cells;\r
+ int oldcode = -1, blank = -1; // The tile we know is blank\r
+ unsigned int pal = 0, pack = 0;\r
\r
// Draw tiles across screen:\r
tilex=(-ts->hscroll)>>3;\r
cells = ts->cells;\r
if(dx != 8) cells++; // have hscroll, need to draw 1 cell more\r
\r
+// int force = (plane_sh&LF_FORCE) << 13;\r
for (; cells; dx+=8,tilex++,cells--)\r
{\r
- code = PicoMem.vram[ts->nametab + (tilex & ts->xmask)];\r
+ u32 code = PicoMem.vram[ts->nametab + (tilex & ts->xmask)];\r
+// code &= ~force; // forced always draw everything\r
+\r
+ if (code == blank && !(code & 0x8000))\r
+ continue;\r
\r
if (code!=oldcode) {\r
oldcode = code;\r
pack = 0;\r
if (code != blank) {\r
// Get tile address/2:\r
- addr = (code&0x3ff)<<5;\r
- if (code&0x1000) addr+=30-ty; else addr+=ty; // Y-flip\r
+ u32 addr = ((code&0x3ff)<<5) + ty;\r
+ if (code & 0x1000) addr ^= 0x1e; // Y-flip\r
\r
- pal = ((code>>9)&0x30)|((plane_sh&LF_SH)<<6); // shadow\r
+ pal = ((code>>9)&0x30) | ((plane_sh&LF_SH)<<6); // shadow\r
\r
pack = *(unsigned int *)(PicoMem.vram + addr);\r
if (!pack)\r
}\r
}\r
\r
- if ((code >> 15) | (plane_sh & LF_FORCE)) { // high priority tile\r
+ if (code & 0x8000) { // high priority tile\r
if ((plane_sh&LF_SH) | (code!=blank)) {\r
- int cval = (code&0xfc00) | (dx<<16) | (ty<<25);\r
- cval|=(code&0x3ff)<<1;\r
- if (code&0x1000) cval^=0x1e<<25;\r
- *ts->hc++ = cval, *ts->hc++ = pack; // cache it\r
+ int cval = (code&0xfc00) | ((code&0x3ff)<<1) | (dx<<16) | (ty<<25);\r
+ if (code & 0x1000) cval ^= 0x1e<<25;\r
+ *hc++ = cval, *hc++ = pack; // cache it\r
}\r
continue;\r
+ } else if (code != blank) {\r
+ if (code & 0x0800) TileFlip(pd + dx, pack, pal);\r
+ else TileNorm(pd + dx, pack, pal);\r
}\r
- if (code == blank)\r
- continue;\r
-\r
- if (code & 0x0800) TileFlip(pd + dx, pack, pal);\r
- else TileNorm(pd + dx, pack, pal);\r
}\r
\r
// terminate the cache list\r
- *ts->hc = 0;\r
+ *hc = 0;\r
}\r
\r
// --------------------------------------------\r
}\r
\r
#ifdef FORCE\r
-static void DrawStripForced(struct TileStrip *ts, int lflags, int cellskip)\r
+// NB lots of duplicate code, all for the sake of a small performance gain.\r
+\r
+static void DrawStripForced(struct TileStrip *ts, int cellskip)\r
{\r
unsigned char *pd = Pico.est.HighCol;\r
- int tilex,dx,ty,code=0,addr=0,cells;\r
- int oldcode=-1;\r
- int pal=0;\r
+ int tilex, dx, ty, code=0, addr=0, cells;\r
+ int oldcode = -1;\r
+ int pal = 0;\r
\r
// Draw tiles across screen:\r
tilex=((-ts->hscroll)>>3)+cellskip;\r
if (code!=oldcode) {\r
oldcode = code;\r
// Get tile address/2:\r
- addr=(code&0x7ff)<<4;\r
- addr+=ty;\r
- if (code&0x1000) addr^=0xe; // Y-flip\r
+ addr = ((code&0x7ff)<<4) + ty;\r
+ if (code & 0x1000) addr^=0xe; // Y-flip\r
\r
- pal=((code>>9)&0x30)|((lflags & LF_SH) << 6);\r
+ pal = (code>>9)&0x30;\r
}\r
\r
pack = *(unsigned int *)(PicoMem.vram + addr);\r
}\r
}\r
\r
-// this is messy\r
static void DrawStripVSRamForced(struct TileStrip *ts, int plane_sh, int cellskip)\r
{\r
unsigned char *pd = Pico.est.HighCol;\r
- int tilex,dx,code=0,addr=0,cell=0;\r
+ int tilex, dx, ty=0, code=0, addr=0, cell=0, nametabadd=0;\r
int oldcode=-1;\r
int pal=0,scan=Pico.est.DrawScanline;\r
\r
\r
for (; cell < ts->cells; dx+=8,tilex++,cell++)\r
{\r
- int nametabadd, ty;\r
unsigned int pack;\r
\r
- //if((cell&1)==0)\r
+ if ((cell&1)==0 || cell<0)\r
{\r
int line,vscroll;\r
- vscroll=PicoMem.vsram[(plane_sh&1)+(cell&0x3e)];\r
+ vscroll = PicoMem.vsram[(plane_sh&1)+(cell&0x3e)];\r
\r
// Find the line in the name table\r
line=(vscroll+scan)&ts->line&0xffff; // ts->line is really ymask ..\r
// Get tile address/2:\r
addr=(code&0x7ff)<<4;\r
\r
- pal=((code>>9)&0x30)|((plane_sh&LF_SH)<<6); // shadow\r
+ pal = (code>>9)&0x30; // shadow\r
}\r
\r
- if (code & 0x1000) ty ^= 0xe; // Y-flip\r
- pack = *(unsigned int *)(PicoMem.vram + addr+ty);\r
+ pack = code & 0x1000 ? ty^0xe : ty; // Y-flip\r
+ pack = *(unsigned int *)(PicoMem.vram + addr+pack);\r
+\r
+ if (code & 0x0800) TileFlip_and(pd + dx, pack, pal);\r
+ else TileNorm_and(pd + dx, pack, pal);\r
+ }\r
+}\r
+\r
+void DrawStripInterlaceForced(struct TileStrip *ts)\r
+{\r
+ unsigned char *pd = Pico.est.HighCol;\r
+ int tilex = 0, dx = 0, ty = 0, cells;\r
+ int oldcode = -1;\r
+ unsigned int pal = 0, pack = 0;\r
+\r
+ // Draw tiles across screen:\r
+ tilex=(-ts->hscroll)>>3;\r
+ ty=(ts->line&15)<<1; // Y-Offset into tile\r
+ dx=((ts->hscroll-1)&7)+1;\r
+ cells = ts->cells;\r
+ if(dx != 8) cells++; // have hscroll, need to draw 1 cell more\r
+\r
+ for (; cells; dx+=8,tilex++,cells--)\r
+ {\r
+ u32 code = PicoMem.vram[ts->nametab + (tilex & ts->xmask)];\r
+\r
+ if (code!=oldcode) {\r
+ oldcode = code;\r
+\r
+ // Get tile address/2:\r
+ u32 addr = ((code&0x3ff)<<5) + ty;\r
+ if (code & 0x1000) addr ^= 0x1e; // Y-flip\r
+\r
+ pal = (code>>9)&0x30; // shadow\r
+\r
+ pack = *(unsigned int *)(PicoMem.vram + addr);\r
+ }\r
\r
if (code & 0x0800) TileFlip_and(pd + dx, pack, pal);\r
else TileNorm_and(pd + dx, pack, pal);\r
}\r
}\r
\r
+// XXX only duplicated to avoid ARM asm hassles\r
static void DrawLayerForced(int plane_sh, int cellskip, int maxcells,\r
struct PicoEState *est)\r
{\r
ts.line=(vscroll+(est->DrawScanline<<1))&((ymask<<1)|1);\r
ts.nametab+=(ts.line>>4)<<shift[width];\r
\r
- DrawStripInterlace(&ts, plane_sh);\r
+ DrawStripInterlaceForced(&ts);\r
} else if( pvid->reg[11]&4) {\r
// shit, we have 2-cell column based vscroll\r
// luckily this doesn't happen too often\r
ts.line=(vscroll+est->DrawScanline)&ymask;\r
ts.nametab+=(ts.line>>3)<<shift[width];\r
\r
- DrawStripForced(&ts, plane_sh, cellskip);\r
+ DrawStripForced(&ts, cellskip);\r
}\r
}\r
\r
-// rather messy (XXX revisit layer compositing)\r
static void DrawSpritesForced(unsigned char *sprited)\r
{\r
unsigned (*fTileFunc)(unsigned m, unsigned char *pd, unsigned int pack, int pal);\r
\r
// anything not covered by a sprite is off (XXX or bg?)\r
for (cnt = 1; cnt < sizeof(mb)-1; cnt++)\r
- if (mb[cnt] == 0xff)\r
- for (m = 0; m < 8; m++)\r
- pd[8*cnt+m] = 0;\r
- else if (mb[cnt])\r
+ if (mb[cnt] == 0xff) {\r
+ *(u32 *)(pd+8*cnt+0) = 0;\r
+ *(u32 *)(pd+8*cnt+4) = 0;\r
+ } else if (mb[cnt])\r
for (m = 0; m < 8; m++)\r
if (mb[cnt] & (1<<m))\r
pd[8*cnt+m] = 0;\r
movs r3, r9, lsl #1 @ (force[31]|sh[30]) << 1\r
mov r3, #0\r
orrmi r10,r10, #1<<23 @ r10=cells[31:24]|sh[23]|hi_not_empty[22]\r
- orrcs r10,r10, #1<<20 @ |had_output[21]|force[20]|ty[15:0]\r
+@ orrcc r10,r10, #1<<20 @ |had_output[21]|!force[20]|ty[15:0]\r
movmi r3, #0x80 @ default to shadowed pal on sh mode\r
\r
cmp r7, #8\r
mvn r9, #0 @ r9=prevcode=-1\r
add r1, r11, r7 @ r1=pdest\r
\r
-\r
+ @ r10=cells[31:24]|sh[23]|hi_not_empty[22]|had_output[21]|!force[20]|ty[15:0]\r
+ @ r1=pd+dx r2=pack r3=pal r5=xmask r6=hc r8=tilex r9=prevcode r11=HighCol r12=nametab lr=vram\r
@ r4 & r7 are scratch in this loop\r
.dsloop_subr1:\r
sub r1, r1, #8\r
\r
.DrawStrip_samecode:\r
tst r9, #0x8000\r
- tsteq r10, #1<<20 @ force?\r
+@ tstne r10, #1<<20 @ !force[20]\r
bne .DrawStrip_hiprio\r
\r
orr r10, r10, #1<<21 @ seen non hi-prio tile\r
rsb r8, r3, #0\r
mov r8, r8, lsr #3 @ r8=tilex=(-ts->hscroll)>>3\r
bic r8, r8, #0x3fc00000\r
- orr r8, r8, r5, lsl #25 @ r8=(xmask[31:25]|had_output[24]|tilex[21:0])\r
+ orr r8, r8, r5, lsl #25 @ r8=(xmask[31:25]|had_output[24]|!force[23]|tilex[21:0])\r
\r
ldr r11, [sp, #9*4] @ est\r
orr r5, r1, r10, lsl #24\r
mov r3, #0\r
orrne r10,r10, #1<<23 @ r10=(cell[31:24]|sh[23]|hi_not_empty[22]|cells_max[21:16]|plane[15]|ty[14:0])\r
movne r3, #0x80 @ default to shadowed pal on sh mode\r
+@ tst r9, #1<<31\r
+@ orreq r8, r8, #1<<23\r
\r
and r9, r9, #0xff00\r
add r8, r8, r9, lsr #8 @ tilex+=cellskip\r
mvn r9, #0 @ r9=prevcode=-1\r
add r1, r11, r7 @ r1=pdest\r
\r
+ @ r10=cells[31:24]|sh[23]|hi_not_empty[22]|cells_max[21:16]|plane[15]|ty[14:0]\r
+ @ r8=xmask[31:25]|had_output[24]|!force[23]|tilex[21:0]\r
+ @ r5=shift_width[31:24]|scanline[23:16]|ymask[15:0]\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
.dsloop_vs_subr1:\r
sub r1, r1, #8\r
cmp r4, r10, asr #8\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
+ bmi 0f\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
mov r4, r4, lsr #19\r
mov r7, r5, lsr #24\r
mov r4, r4, lsl r7 @ nametabadd\r
-\r
+ and r3, r3, #0xff\r
+ orr r3, r3, r4, lsl #16 @ r3=(nametabadd[31:16],pal[15:0])\r
+0:\r
and r7, r8, r8, lsr #25\r
add r7, lr, r7, lsl #1 @ PicoMem.vram+((tilex&ts->xmask) as halfwords)\r
- add r7, r7, r4, lsl #1\r
+ add r7, r7, r3, lsr #15\r
ldrh r7, [r7, r12] @ r7=code (int, but from unsigned, no sign extend)\r
\r
add r1, r1, #8\r
\r
.DrawStrip_vs_samecode:\r
tst r9, #0x8000\r
- tsteq r10, #(1<<20) @ force[20]\r
+@ tstne r8, #1<<23 @ !force[23]\r
bne .DrawStrip_vs_hiprio\r
\r
orr r8, r8, #(1<<24)@ seen non hi-prio tile\r
stmia r1!,{r2,r4,r5,r7}\r
bne .dtfc_loop_shprep\r
\r
- mvn r5, #0 @ r5=prevcode=-1\r
b .dtfc_loop\r
\r
.pool\r