From: kub Date: Fri, 27 Mar 2020 18:25:20 +0000 (+0100) Subject: vdp rendering fixes X-Git-Tag: v2.00~761 X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=61114cd8b4c44f606e6030d44142534884fca35b;p=picodrive.git vdp rendering fixes --- diff --git a/pico/draw.c b/pico/draw.c index dff5e075..68af73e2 100644 --- a/pico/draw.c +++ b/pico/draw.c @@ -486,7 +486,10 @@ static void DrawLayer(int plane_sh, int *hcache, int cellskip, int maxcells, // shit, we have 2-cell column based vscroll // luckily this doesn't happen too often ts.line=ymask|(shift[width]<<24); // save some stuff instead of line - plane_sh |= PicoMem.vsram[0x26+(~plane_sh&1)] << 16; + // vscroll value for leftmost cells in case of hscroll not on 16px boundary + // XXX it's unclear what exactly the hw is doing. Continue reading where it + // stopped last seems to work best (H40: 0x50 (wrap->0x00), H32 0x40). + plane_sh |= PicoMem.vsram[(pvid->reg[12]&1?0x00:0x20) + (plane_sh&1)] << 16; DrawStripVSRam(&ts, plane_sh, cellskip); } else { vscroll = PicoMem.vsram[plane_sh & 1]; // Get vertical scroll value @@ -1173,7 +1176,10 @@ static void DrawLayerForced(int plane_sh, int cellskip, int maxcells, // shit, we have 2-cell column based vscroll // luckily this doesn't happen too often ts.line=ymask|(shift[width]<<24); // save some stuff instead of line - plane_sh |= PicoMem.vsram[0x26+(~plane_sh&1)] << 16; + // vscroll value for leftmost cells in case of hscroll not on 16px boundary + // XXX it's unclear what exactly the hw is doing. Continue reading where it + // stopped last seems to work best (H40: 0x50 (wrap->0x00), H32 0x40). + plane_sh |= PicoMem.vsram[(pvid->reg[12]&1?0x00:0x20) + (plane_sh&1)] << 16; DrawStripVSRamForced(&ts, plane_sh, cellskip); } else { vscroll = PicoMem.vsram[plane_sh & 1]; // Get vertical scroll value @@ -1191,7 +1197,7 @@ static void DrawSpritesForced(unsigned char *sprited) { unsigned (*fTileFunc)(unsigned char *pd, unsigned m, unsigned int pack, int pal); unsigned char *pd = Pico.est.HighCol; - unsigned char mb[1+320+1]; + unsigned char mb[1+320/8+1]; unsigned char *p, *mp; unsigned m; int entry, cnt; diff --git a/pico/draw_arm.S b/pico/draw_arm.S index 1a0f3513..2ae6dba6 100644 --- a/pico/draw_arm.S +++ b/pico/draw_arm.S @@ -523,6 +523,9 @@ DrawLayer: @ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ .DrawStrip_vsscroll: + tst r8, #1 @ if h40: lflags |= 0x10000 + orrne r0, r0, #0x10000 + rsb r8, r3, #0 mov r8, r8, lsr #3 @ r8=tilex=(-ts->hscroll)>>3 bic r8, r8, #0x3fc00000 @@ -545,11 +548,13 @@ DrawLayer: eor r3, r3, r7 sub r10,r10, #1<<24 @ cell-- // start from negative for hscroll tst r3, #0x08 - add_c24 r1, lr, (OFS_PMEM_vsram-OFS_PMEM_vram) - ldr r3, [r1, #0x4c] @ r3=vsram[0x26..0x27] subne r10,r10, #1<<16 @ cells-- subne r10,r10, #1<<24 @ cell-- // even more negative - ror r3, r3, #16 + + add_c24 r1, lr, (OFS_PMEM_vsram-OFS_PMEM_vram) + tst r0, #0x10000 @ h40? + ldrne r3, [r1, #0x00] @ r3=vsram[0x00..0x01] + ldreq r3, [r1, #0x40] @ r3=vsram[0x20..0x21] str r3, [r1, #0x7c] @ vsram[0x3e..0x3f]=r3 0: tst r9, #1<<31