From 47677a2ab1404a8f87d54bf911586d558cd36747 Mon Sep 17 00:00:00 2001 From: kub Date: Wed, 30 Sep 2020 19:31:41 +0200 Subject: [PATCH] vdp rendering, fixes and optimisations --- pico/32x/draw.c | 4 ++ pico/draw.c | 155 ++++++++++++++++++++++++------------------------ pico/draw_arm.S | 133 +++++++++++++++++++---------------------- pico/pico.h | 2 +- 4 files changed, 143 insertions(+), 151 deletions(-) diff --git a/pico/32x/draw.c b/pico/32x/draw.c index 991abaec..bef8dd3d 100644 --- a/pico/32x/draw.c +++ b/pico/32x/draw.c @@ -31,7 +31,11 @@ static void convert_pal555(int invert_prio) // place prio to LS green bit for (i = 0x100/2; i > 0; i--, ps++, pd++) { unsigned int t = *ps; +#if defined(USE_BGR555) + *pd = t ^ inv; +#else *pd = (((t & m1) << 11) | ((t & m2) << 1) | ((t & m3) >> 10)) ^ inv; +#endif } Pico32x.dirty_pal = 0; diff --git a/pico/draw.c b/pico/draw.c index 02dffec1..a57523a5 100644 --- a/pico/draw.c +++ b/pico/draw.c @@ -56,8 +56,8 @@ static unsigned int DefOutBuff[320*2/2]; void *DrawLineDestBase = DefOutBuff; int DrawLineDestIncrement; -static int HighCacheA[41+1]; // caches for high layers -static int HighCacheB[41+1]; +static int HighCacheA[41*2+1]; // caches for high layers +static int HighCacheB[41*2+1]; static int HighPreSpr[80*2+1]; // slightly preprocessed sprites unsigned int VdpSATCache[128]; // VDP sprite cache (1st 32 sprite attr bits) @@ -275,6 +275,7 @@ static void DrawStrip(struct TileStrip *ts, int lflags, int cellskip) int tilex,dx,ty,code=0,addr=0,cells; int oldcode=-1,blank=-1; // The tile we know is blank int pal=0; + unsigned int pack = 0; // Draw tiles across screen: tilex=((-ts->hscroll)>>3)+cellskip; @@ -286,33 +287,36 @@ static void DrawStrip(struct TileStrip *ts, int lflags, int cellskip) for (; cells > 0; dx+=8, tilex++, cells--) { - unsigned int pack; - code = PicoMem.vram[ts->nametab + (tilex & ts->xmask)]; - if ((code >> 15) | (lflags & LF_FORCE)) { // high priority tile - int cval = code | (dx<<16) | (ty<<25); - if(code&0x1000) cval^=7<<26; - *ts->hc++ = cval; // cache it - continue; - } - if (code == blank) - continue; if (code!=oldcode) { oldcode = code; - // Get tile address/2: - addr=(code&0x7ff)<<4; - addr+=ty; - if (code&0x1000) addr^=0xe; // Y-flip - pal=((code>>9)&0x30)|((lflags&LF_SH)<<6); // shadow + pack = 0; + if (code != blank) { + // Get tile address/2: + addr=(code&0x7ff)<<4; + addr+=ty; + if (code&0x1000) addr^=0xe; // Y-flip + + pal=((code>>9)&0x30)|((lflags&LF_SH)<<6); // shadow + + pack = *(unsigned int *)(PicoMem.vram + addr); + if (!pack) + blank = code; + } } - pack = *(unsigned int *)(PicoMem.vram + addr); - if (!pack) { - blank = code; + if ((code >> 15) | (lflags & LF_FORCE)) { // high priority tile + if ((lflags&LF_SH) | (code!=blank)) { + int cval = code | (dx<<16) | (ty<<25); + if (code&0x1000) cval^=0xe<<25; + *ts->hc++ = cval, *ts->hc++ = pack; // cache it + } continue; } + if (code == blank) + continue; if (code & 0x0800) TileFlip(pd + dx, pack, pal); else TileNorm(pd + dx, pack, pal); @@ -362,29 +366,28 @@ static void DrawStripVSRam(struct TileStrip *ts, int plane_sh, int cellskip) } code=PicoMem.vram[ts->nametab+nametabadd+(tilex&ts->xmask)]; - if (code>>15) { // high priority tile - int cval = code | (dx<<16) | (ty<<25); - if(code&0x1000) cval^=7<<26; - *ts->hc++ = cval; // cache it - continue; - } - if ((code<<16|ty)==blank) continue; - if (code!=oldcode) { oldcode = code; // Get tile address/2: - addr=(code&0x7ff)<<4; + addr = (code&0x7ff)<<4; - pal=((code>>9)&0x30)|((plane_sh&LF_SH)<<6); // shadow + pal = ((code>>9)&0x30)|((plane_sh&LF_SH)<<6); // shadow } + code |= ty<<16; if (code & 0x1000) ty ^= 0xe; // Y-flip pack = *(unsigned int *)(PicoMem.vram + addr+ty); + if (!pack) + blank = code; - if (!pack) { - blank = code<<16|ty; + if ((code >> 15) | (plane_sh & LF_FORCE)) { // high priority tile + if ((plane_sh&LF_SH) | (code!=blank)) { + int cval = code | (dx<<16) | (ty<<25); + *ts->hc++ = cval, *ts->hc++ = pack; // cache it + } continue; } + if (code == blank) continue; if (code & 0x0800) TileFlip(pd + dx, pack, pal); else TileNorm(pd + dx, pack, pal); @@ -405,6 +408,7 @@ void DrawStripInterlace(struct TileStrip *ts, int plane_sh) int tilex=0,dx=0,ty=0,code=0,addr=0,cells; int oldcode=-1,blank=-1; // The tile we know is blank int pal=0; + unsigned int pack = 0; // Draw tiles across screen: tilex=(-ts->hscroll)>>3; @@ -415,32 +419,36 @@ void DrawStripInterlace(struct TileStrip *ts, int plane_sh) for (; cells; dx+=8,tilex++,cells--) { - unsigned int pack; - code = PicoMem.vram[ts->nametab + (tilex & ts->xmask)]; - if (code>>15) { // high priority tile - int cval = (code&0xfc00) | (dx<<16) | (ty<<25); - cval|=(code&0x3ff)<<1; - if(code&0x1000) cval^=0xf<<26; - *ts->hc++ = cval; // cache it - continue; - } - if (code==blank) continue; if (code!=oldcode) { oldcode = code; - // Get tile address/2: - addr=(code&0x3ff)<<5; - if (code&0x1000) addr+=30-ty; else addr+=ty; // Y-flip - pal=((code>>9)&0x30)|((plane_sh&LF_SH)<<6); // shadow + pack = 0; + if (code != blank) { + // Get tile address/2: + addr = (code&0x3ff)<<5; + if (code&0x1000) addr+=30-ty; else addr+=ty; // Y-flip + + pal = ((code>>9)&0x30)|((plane_sh&LF_SH)<<6); // shadow + + pack = *(unsigned int *)(PicoMem.vram + addr); + if (!pack) + blank = code; + } } - pack = *(unsigned int *)(PicoMem.vram + addr); - if (!pack) { - blank = code; + if ((code >> 15) | (plane_sh & LF_FORCE)) { // high priority tile + if ((plane_sh&LF_SH) | (code!=blank)) { + int cval = (code&0xfc00) | (dx<<16) | (ty<<25); + cval|=(code&0x3ff)<<1; + if (code&0x1000) cval^=0x1e<<25; + *ts->hc++ = cval, *ts->hc++ = pack; // cache it + } continue; } + if (code == blank) + continue; if (code & 0x0800) TileFlip(pd + dx, pack, pal); else TileNorm(pd + dx, pack, pal); @@ -549,7 +557,7 @@ static void DrawWindow(int tstart, int tend, int prio, int sh, tilex=tstart<<1; - if (prio && !(est->rendstatus & PDRAW_WND_HIGH_PRIO)) { + if (prio && !(est->rendstatus & PDRAW_WND_DIFF_PRIO)) { // all tiles processed in low prio pass return; } @@ -568,7 +576,7 @@ static void DrawWindow(int tstart, int tend, int prio, int sh, code = PicoMem.vram[nametab + tilex]; if ((code>>15) != prio) { - est->rendstatus |= PDRAW_WND_HIGH_PRIO; + est->rendstatus |= PDRAW_WND_DIFF_PRIO; continue; } if (code==blank) continue; @@ -600,7 +608,7 @@ static void DrawWindow(int tstart, int tend, int prio, int sh, code = PicoMem.vram[nametab + tilex]; if((code>>15) != prio) { - est->rendstatus |= PDRAW_WND_HIGH_PRIO; + est->rendstatus |= PDRAW_WND_DIFF_PRIO; continue; } @@ -651,7 +659,7 @@ static void DrawTilesFromCacheShPrep(void) static void DrawTilesFromCache(int *hc, int sh, int rlim, struct PicoEState *est) { unsigned char *pd = Pico.est.HighCol; - int code, addr, dx; + int code, dx; unsigned int pack; int pal; @@ -667,11 +675,7 @@ static void DrawTilesFromCache(int *hc, int sh, int rlim, struct PicoEState *est if (!sh) { while ((code=*hc++)) { - // Get tile address/2: - addr = (code & 0x7ff) << 4; - addr += (unsigned int)code >> 25; // y offset into tile - - pack = *(unsigned int *)(PicoMem.vram + addr); + pack = *hc++; if (!pack) continue; @@ -689,15 +693,12 @@ static void DrawTilesFromCache(int *hc, int sh, int rlim, struct PicoEState *est while ((code=*hc++)) { unsigned char *zb; - // Get tile address/2: - addr=(code&0x7ff)<<4; - addr+=(unsigned int)code>>25; // y offset into tile - dx=(code>>16)&0x1ff; + dx = (code >> 16) & 0x1ff; zb = est->HighCol+dx; *zb++ &= 0x7f; *zb++ &= 0x7f; *zb++ &= 0x7f; *zb++ &= 0x7f; *zb++ &= 0x7f; *zb++ &= 0x7f; *zb++ &= 0x7f; *zb++ &= 0x7f; - pack = *(unsigned int *)(PicoMem.vram + addr); + pack = *hc++; if (!pack) continue; @@ -880,12 +881,12 @@ static NOINLINE void DrawAllSpritesInterlace(int pri, int sh) // check if it is on this line sy = (code&0x3ff)-0x100; height = (((code>>24)&3)+1)<<4; - if(sline < sy || sline >= sy+height) goto nextsprite; // no + if((sline < sy) | (sline >= sy+height)) goto nextsprite; // no // check if sprite is not hidden offscreen sx = (sx>>16)&0x1ff; sx -= 0x78; // Get X coordinate + 8 - if(sx <= -8*3 || sx >= 328) goto nextsprite; + if((sx <= -8*3) | (sx >= 328)) goto nextsprite; // sprite is good, save it's pointer sprites[i++]=sprite; @@ -1494,11 +1495,11 @@ void PicoDoHighPal555_8bit(int sh, int line, struct PicoEState *est) t |= (t >> 4) & 0x08610861; dpal[0x40/2 + i] = t; } - // pixels in color 14 always appear normal (hw bug?) + // shadowed pixels in color 14 always appear normal (hw bug?) unsigned short *hpal = est->HighPal; - hpal[0x80 + 0x0e] = hpal[0x40 + 0x0e] = hpal[0x0e]; - hpal[0x80 + 0x1e] = hpal[0x40 + 0x1e] = hpal[0x1e]; - hpal[0x80 + 0x2e] = hpal[0x40 + 0x2e] = hpal[0x2e]; + hpal[0x80 + 0x0e] = hpal[0x0e]; + hpal[0x80 + 0x1e] = hpal[0x1e]; + hpal[0x80 + 0x2e] = hpal[0x2e]; } } @@ -1516,7 +1517,7 @@ void PicoDoHighPal555(int sh, int line, struct PicoEState *est) for (i = 0; i < 0x40 / 2; i++) { t = spal[i]; #ifdef USE_BGR555 - t = ((t & 0x0e000e00)<< 3) | ((t & 0x00e000e0)<<2) | ((t & 0x000e000e)<<1); + t = ((t & 0x000e000e)<< 1) | ((t & 0x00e000e0)<<3) | ((t & 0x0e000e00)<<4); #else t = ((t & 0x000e000e)<<12) | ((t & 0x00e000e0)<<3) | ((t & 0x0e000e00)>>7); #endif @@ -1540,9 +1541,9 @@ void PicoDoHighPal555(int sh, int line, struct PicoEState *est) } // pixels in color 14 always appear normal (hw bug?) unsigned short *hpal = est->HighPal; - hpal[0x80 + 0x0e] = hpal[0x40 + 0x0e] = hpal[0x0e]; - hpal[0x80 + 0x1e] = hpal[0x40 + 0x1e] = hpal[0x1e]; - hpal[0x80 + 0x2e] = hpal[0x40 + 0x2e] = hpal[0x2e]; + hpal[0x80 + 0x0e] = hpal[0x0e]; + hpal[0x80 + 0x1e] = hpal[0x1e]; + hpal[0x80 + 0x2e] = hpal[0x2e]; } } @@ -1592,7 +1593,7 @@ static void FinalizeLine8bit(int sh, int line, struct PicoEState *est) if (Pico.m.dirtyPal == 1) { // a hack for mid-frame palette changes - if (!(est->rendstatus & PDRAW_SONIC_MODE) || line - dirty_line > 4) { + if (!(est->rendstatus & PDRAW_SONIC_MODE) | (line - dirty_line > 4)) { // store a maximum of 2 additional palettes in SonicPal if (est->SonicPalCount < 2) est->SonicPalCount ++; @@ -1634,7 +1635,7 @@ static int DrawDisplay(int sh) int win=0, edge=0, hvwind=0, lflags; int maxw, maxcells; - est->rendstatus &= ~(PDRAW_SHHI_DONE|PDRAW_PLANE_HI_PRIO|PDRAW_WND_HIGH_PRIO); + est->rendstatus &= ~(PDRAW_SHHI_DONE|PDRAW_PLANE_HI_PRIO|PDRAW_WND_DIFF_PRIO); if (pvid->reg[12]&1) { maxw = 328; maxcells = 40; @@ -1730,8 +1731,8 @@ static int DrawDisplay(int sh) #if 0 { int *c, a, b; - for (a = 0, c = HighCacheA; *c; c++, a++); - for (b = 0, c = HighCacheB; *c; c++, b++); + for (a = 0, c = HighCacheA; *c; c+=2, a++); + for (b = 0, c = HighCacheB; *c; c+=2, b++); printf("%i:%03i: a=%i, b=%i\n", Pico.m.frame_count, Pico.est.DrawScanline, a, b); } diff --git a/pico/draw_arm.S b/pico/draw_arm.S index 7dab0899..46ecc771 100644 --- a/pico/draw_arm.S +++ b/pico/draw_arm.S @@ -14,7 +14,7 @@ .extern DrawStripInterlace .equ PDRAW_SPRITES_MOVED, (1<<0) -.equ PDRAW_WND_HIGH_PRIO, (1<<1) +.equ PDRAW_WND_DIFF_PRIO, (1<<1) .equ PDRAW_PARSE_SPRITES, (1<<2) .equ PDRAW_DIRTY_SPRITES, (1<<4) .equ PDRAW_PLANE_HI_PRIO, (1<<6) @@ -426,15 +426,10 @@ DrawLayer: add r1, r1, #8 add r8, r8, #1 - tst r7, #0x8000 - tsteq r10, #1<<20 @ force? - bne .DrawStrip_hiprio - cmp r7, r9 beq .DrawStrip_samecode @ we know stuff about this tile already mov r9, r7 @ remember code - orr r10, r10, #1<<21 @ seen non hi-prio tile movs r2, r9, lsl #20 @ if (code&0x1000) mov r2, r2, lsl #1 @@ -444,14 +439,19 @@ DrawLayer: ldr r2, [lr, r2, lsl #1] @ pack=*(unsigned int *)(Pico.vram+addr); // Get 8 pixels - bic r7, r3, #0x7f - and r3, r9, #0x6000 - add r3, r7, r3, lsr #9 @ r3=pal=((code&0x6000)>>9); - .DrawStrip_samecode: + tst r9, #0x8000 + tsteq r10, #1<<20 @ force? + bne .DrawStrip_hiprio + + orr r10, r10, #1<<21 @ seen non hi-prio tile tst r2, r2 beq .dsloop @ tileline blank + bic r7, r3, #0x7f + and r3, r9, #0x6000 + add r3, r7, r3, lsr #9 @ r3=pal=((code&0x6000)>>9); + cmp r2, r2, ror #4 beq .DrawStrip_SingleColor @ tileline singlecolor @@ -481,13 +481,18 @@ DrawLayer: b .dsloop_subr1 .DrawStrip_hiprio: - sub r0, r1, r11 - orr r7, r7, r0, lsl #16 + tst r10, #(1<<23) @ sh[23] + tsteq r2, r2 @ if (!sh[23] && code==blank) continue + beq .dsloop + +@ orr r10, r10, #1<<22 @ hi_not_empty[22] + sub r7, r1, r11 + orr r7, r9, r7, lsl #16 orr r7, r7, r10, lsl #25 @ (ty<<25) - tst r7, #0x1000 - eorne r7, r7, #7<<26 @ if(code&0x1000) cval^=7<<26; - str r7, [r6], #4 @ cache hi priority tile - mov r0, #0xf + tst r9, #0x1000 + eorne r7, r7, #0xe<<25 @ if(code&0x1000) cval^=0xe<<25; + str r7, [r6], #4 @ cache hi priority tile code + str r2, [r6], #4 @ cache hi priority tile data b .dsloop .dsloop_exit: @@ -499,8 +504,7 @@ DrawLayer: orreq r2, r2, #PDRAW_PLANE_HI_PRIO @ had a layer with all hi-prio tiles streq r2, [r1, #OFS_EST_rendstatus] - ldmfd sp!, {r4-r11,lr} - bx lr + ldmfd sp!, {r4-r11,pc} @ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@ -593,15 +597,11 @@ DrawLayer: add r1, r1, #8 add r8, r8, #1 - tst r7, #0x8000 - bne .DrawStrip_vs_hiprio - orr r7, r7, r10, lsl #24 @ code | (ty << 24) cmp r7, r9 beq .DrawStrip_vs_samecode @ we know stuff about this tile already mov r9, r7 @ remember code - orr r8, r8, #(1<<24)@ seen non hi-prio tile movs r2, r9, lsl #20 @ if (code&0x1000) mov r2, r2, lsl #1 @@ -611,14 +611,19 @@ DrawLayer: ldr r2, [lr, r2, lsl #1] @ pack=*(unsigned int *)(PicoMem.vram+addr); // Get 8 pixels - bic r7, r3, #0x7f - and r3, r9, #0x6000 - add r3, r7, r3, lsr #9 @ r3=pal=((code&0x6000)>>9); - .DrawStrip_vs_samecode: + tst r9, #0x8000 + tsteq r10, #(1<<20) @ force[20] + bne .DrawStrip_vs_hiprio + + orr r8, r8, #(1<<24)@ seen non hi-prio tile tst r2, r2 beq .dsloop_vs @ tileline blank + bic r7, r3, #0x7f + and r3, r9, #0x6000 + add r3, r7, r3, lsr #9 @ r3=pal=((code&0x6000)>>9); + cmp r2, r2, ror #4 beq .DrawStrip_vs_SingleColor @ tileline singlecolor @@ -648,13 +653,18 @@ DrawLayer: b .dsloop_vs_subr1 .DrawStrip_vs_hiprio: - sub r0, r1, r11 - orr r7, r7, r0, lsl #16 + tst r10, #(1<<23) @ sh[23] + tsteq r2, r2 @ if (!sh[23] && code==blank) continue + beq .dsloop_vs + +@ orr r10, r10, #1<<22 @ hi_not_empty[22] + sub r7, r1, r11 + orr r7, r9, r7, lsl #16 orr r7, r7, r10, lsl #25 @ (ty<<25) - tst r7, #0x1000 + tst r9, #0x1000 eorne r7, r7, #7<<26 @ if(code&0x1000) cval^=7<<26; - str r7, [r6], #4 @ cache hi priority tile - mov r0, #0xf + str r7, [r6], #4 @ cache hi priority tile code + str r2, [r6], #4 @ cache hi priority tile data b .dsloop_vs .dsloop_vs_exit: @@ -666,8 +676,7 @@ DrawLayer: orreq r2, r2, #PDRAW_PLANE_HI_PRIO @ had a layer with all hi-prio tiles streq r2, [r1, #OFS_EST_rendstatus] - ldmfd sp!, {r4-r11,lr} - bx lr + ldmfd sp!, {r4-r11,pc} @ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@ -696,8 +705,7 @@ DrawLayer: bl DrawStripInterlace @ struct TileStrip *ts, int plane_sh add sp, sp, #6*4 - ldmfd sp!, {r4-r11,lr} - bx lr + ldmfd sp!, {r4-r11,pc} .pool @@ -739,8 +747,7 @@ BackFill: stmia lr!, {r0-r7} stmia lr!, {r0-r7} - ldmfd sp!, {r4-r9,lr} - bx lr + ldmfd sp!, {r4-r9,pc} @ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@ -758,7 +765,6 @@ DrawTilesFromCache: ldr lr, [r3, #OFS_EST_PicoMem_vram] mov r9, r3 @ est - mvn r5, #0 @ r5=prevcode=-1 ands r8, r1, #1 orr r8, r8, r2, lsl #1 bne .dtfc_check_rendflags @@ -771,22 +777,11 @@ DrawTilesFromCache: bic r4, r1, #0xfe00 add r1, r11, r4 @ r1=pdest - movs r7, r6, lsl #16 - cmp r5, r7, lsr #16 - beq .dtfc_samecode @ if (code==prevcode) - - mov r5, r7, lsr #16 - - mov r2, r5, lsl #21 - mov r2, r2, lsr #17 @ r2=addr=(code&0x7ff)<<4; - add r2, r2, r6, lsr #25 @ addr+=ty + ldr r2, [r0], #4 @ read pixel data - and r3, r5, #0x6000 + and r3, r6, #0x6000 mov r3, r3, lsr #9 @ r3=pal=((code&0x6000)>>9); - ldr r2, [lr, r2, lsl #1] @ pack=*(unsigned int *)(Pico.vram+addr); // Get 8 pixels - -.dtfc_samecode: rsbs r4, r4, r8, lsr #1 bmi .dtfc_cut_tile @@ -799,7 +794,7 @@ DrawTilesFromCache: cmp r2, r2, ror #4 beq .dtfc_SingleColor @ tileline singlecolor - tst r5, #0x0800 + tst r6, #0x0800 bne .dtfc_TileFlip @ (r1=pdest, r2=pixels8, r3=pal) r4: scratch, r12: helper pattern @@ -831,7 +826,7 @@ DrawTilesFromCache: cmp r2, r2, ror #4 beq .dtfc_SingleColor @ tileline singlecolor - tst r5, #0x0800 + tst r6, #0x0800 bne .dtfc_TileFlipShHP @ (r1=pdest, r2=pixels8, r3=pal) r4: scratch, r12: helper pattern @@ -871,7 +866,7 @@ DrawTilesFromCache: mov r12,#0xf<<28 mov r12,r12,asr r4 mov r2, r2, ror #16 - tst r5, #0x0800 @ flipped? + tst r6, #0x0800 @ flipped? mvnne r12,r12 and r2, r2, r12 mov r2, r2, ror #16 @@ -880,7 +875,7 @@ DrawTilesFromCache: bne .dtfc_shadow tst r2, r2 beq .dtfc_loop - tst r5, #0x0800 + tst r6, #0x0800 beq .dtfc_TileNorm b .dtfc_TileFlip @@ -1310,8 +1305,8 @@ DrawWindow: @ fetch the first code now ldrh r7, [lr, r12] - ands r6, r6, #PDRAW_WND_HIGH_PRIO - cmpeq r2, #1 @ prio && !(rendstatus & WND_HIGH_PRIO)? + ands r6, r6, #PDRAW_WND_DIFF_PRIO + cmpeq r2, #1 @ prio && !(rendstatus & WND_DIFF_PRIO)? ldmeqfd sp!, {r4-r11,pc} @ yes, assume that whole window uses same priority orr r6, r6, r2 @@ -1339,7 +1334,7 @@ DrawWindow: eor r5, r6, r7, lsr #15 tst r5, #1 - orrne r6, r6, #PDRAW_WND_HIGH_PRIO @ wrong pri + orrne r6, r6, #PDRAW_WND_DIFF_PRIO @ wrong pri bne .dwloop cmp r7, r9 @@ -1405,7 +1400,7 @@ DrawWindow: b .dw_shadow_done .dwloop_end: - and r2, r6, #PDRAW_WND_HIGH_PRIO + and r2, r6, #PDRAW_WND_DIFF_PRIO ldmfd sp!, {r4-r11,lr} ldr r0, [sp] ldr r1, [r0, #OFS_EST_rendstatus] @@ -1463,8 +1458,7 @@ vidConvCpyRGB565: @ void *to, void *from, int pixels orr r8, r8, #0x0800 orr r8, r8, r8, lsl #16 vidConvCpyRGB565_local - ldmfd sp!, {r4-r9,lr} - bx lr + ldmfd sp!, {r4-r9,pc} @ void PicoDoHighPal555(int sh, int line, struct PicoEState *est) @@ -1532,14 +1526,11 @@ PicoDoHighPal555: stmia r4!, {r1,r6} bne .fl_loopcpRGB555_sh - @ fixup color 14 in palette 0,1,2 (always normal) + @ fixup shadowed color 14 in palette 0,1,2 (always normal) sub r4, r3, #0x40*2 ldrh r1, [r4, #0x0e*2] @ 0x0e, 0x1e, 0x2e ldrh r5, [r4, #0x1e*2] ldrh r6, [r4, #0x2e*2] - strh r1, [r3, #0x0e*2] @ 0x4e, 0x5e, 0x6e - strh r5, [r3, #0x1e*2] - strh r6, [r3, #0x2e*2] strh r1, [r3, #0x4e*2] @ 0x8e, 0x9e, 0xae strh r5, [r3, #0x5e*2] strh r6, [r3, #0x6e*2] @@ -1622,8 +1613,7 @@ FinalizeLine555: stmia r0!, {r4,r5,r8,r12} bne .fl_loopRGB555 - ldmfd sp!, {r4-r10,lr} - bx lr + ldmfd sp!, {r4-r10,pc} .fl_32scale_RGB555: @@ -1687,8 +1677,7 @@ FinalizeLine555: stmia r0!, {r4,r5,r6,r8,r10} bne .fl_loop32scale_RGB555 - ldmfd sp!, {r4-r10,lr} - bx lr + ldmfd sp!, {r4-r10,pc} #ifdef UNALIGNED_DRAWLINEDEST @ unaligned versions of loops @@ -1733,8 +1722,7 @@ FinalizeLine555: strh r8, [r0], #2 - ldmfd sp!, {r4-r10,lr} - bx lr + ldmfd sp!, {r4-r10,pc} .fl_32scale_RGB555u: @@ -1799,8 +1787,7 @@ FinalizeLine555: strh r4, [r0], #2 - ldmfd sp!, {r4-r10,lr} - bx lr + ldmfd sp!, {r4-r10,pc} #endif /* UNALIGNED_DRAWLINEDEST */ diff --git a/pico/pico.h b/pico/pico.h index 6e99045f..3c800f6a 100644 --- a/pico/pico.h +++ b/pico/pico.h @@ -199,7 +199,7 @@ void vidConvCpyRGB565(void *to, void *from, int pixels); void PicoDoHighPal555(int sh, int line, struct PicoEState *est); // internals, NB must keep in sync with ASM draw functions #define PDRAW_SPRITES_MOVED (1<<0) // SAT address modified -#define PDRAW_WND_HIGH_PRIO (1<<1) // have window with high prio tiles +#define PDRAW_WND_DIFF_PRIO (1<<1) // not all window tiles use same priority #define PDRAW_PARSE_SPRITES (1<<2) // SAT needs parsing #define PDRAW_INTERLACE (1<<3) #define PDRAW_DIRTY_SPRITES (1<<4) // SAT modified -- 2.39.5