vdp rendering fixes

This commit is contained in:
kub 2020-03-27 19:25:20 +01:00
parent bd73e6eec0
commit 61114cd8b4
2 changed files with 17 additions and 6 deletions

View file

@ -486,7 +486,10 @@ static void DrawLayer(int plane_sh, int *hcache, int cellskip, int maxcells,
// shit, we have 2-cell column based vscroll // shit, we have 2-cell column based vscroll
// luckily this doesn't happen too often // luckily this doesn't happen too often
ts.line=ymask|(shift[width]<<24); // save some stuff instead of line 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); DrawStripVSRam(&ts, plane_sh, cellskip);
} else { } else {
vscroll = PicoMem.vsram[plane_sh & 1]; // Get vertical scroll value 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 // shit, we have 2-cell column based vscroll
// luckily this doesn't happen too often // luckily this doesn't happen too often
ts.line=ymask|(shift[width]<<24); // save some stuff instead of line 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); DrawStripVSRamForced(&ts, plane_sh, cellskip);
} else { } else {
vscroll = PicoMem.vsram[plane_sh & 1]; // Get vertical scroll value 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 (*fTileFunc)(unsigned char *pd, unsigned m, unsigned int pack, int pal);
unsigned char *pd = Pico.est.HighCol; unsigned char *pd = Pico.est.HighCol;
unsigned char mb[1+320+1]; unsigned char mb[1+320/8+1];
unsigned char *p, *mp; unsigned char *p, *mp;
unsigned m; unsigned m;
int entry, cnt; int entry, cnt;

View file

@ -523,6 +523,9 @@ DrawLayer:
@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
.DrawStrip_vsscroll: .DrawStrip_vsscroll:
tst r8, #1 @ if h40: lflags |= 0x10000
orrne r0, r0, #0x10000
rsb r8, r3, #0 rsb r8, r3, #0
mov r8, r8, lsr #3 @ r8=tilex=(-ts->hscroll)>>3 mov r8, r8, lsr #3 @ r8=tilex=(-ts->hscroll)>>3
bic r8, r8, #0x3fc00000 bic r8, r8, #0x3fc00000
@ -545,11 +548,13 @@ DrawLayer:
eor r3, r3, r7 eor r3, r3, r7
sub r10,r10, #1<<24 @ cell-- // start from negative for hscroll sub r10,r10, #1<<24 @ cell-- // start from negative for hscroll
tst r3, #0x08 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<<16 @ cells--
subne r10,r10, #1<<24 @ cell-- // even more negative 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 str r3, [r1, #0x7c] @ vsram[0x3e..0x3f]=r3
0: 0:
tst r9, #1<<31 tst r9, #1<<31