core, fix H32 mode in fast renderer

This commit is contained in:
kub 2023-11-23 20:56:47 +01:00
parent 9215679134
commit 96a972dcec
2 changed files with 11 additions and 7 deletions

View file

@ -168,7 +168,7 @@ static void DrawWindowFull(int start, int end, int prio, struct PicoEState *est)
end = end<<16>>16; end = end<<16>>16;
// Find name table line: // Find name table line:
if (pvid->reg[12]&1) if (!(est->rendstatus & PDRAW_32_COLS))
{ {
nametab=(pvid->reg[3]&0x3c)<<9; // 40-cell mode nametab=(pvid->reg[3]&0x3c)<<9; // 40-cell mode
nametab_step = 1<<6; nametab_step = 1<<6;
@ -268,7 +268,7 @@ static void DrawLayerFull(int plane, u32 *hcache, int planestart, int planeend,
else nametab=(pvid->reg[4]&0x07)<<12; // B else nametab=(pvid->reg[4]&0x07)<<12; // B
scrpos = est->Draw2FB; scrpos = est->Draw2FB;
if (est->rendstatus & PDRAW_BORDER_32) if ((~est->rendstatus & (PDRAW_BORDER_32|PDRAW_32_COLS)) == 0)
scrpos += 32; scrpos += 32;
scrpos+=8*est->Draw2Width*(planestart-scrstart); scrpos+=8*est->Draw2Width*(planestart-scrstart);
@ -280,7 +280,7 @@ static void DrawLayerFull(int plane, u32 *hcache, int planestart, int planeend,
// Get vertical scroll value: // Get vertical scroll value:
vscroll=PicoMem.vsram[plane];//&0x1ff; vscroll=PicoMem.vsram[plane];//&0x1ff;
#if VSRAM #if VSRAM
if (!(pvid->reg[12]&1) && (pvid->reg[11]&4)) // H32 + 2-cell mode if ((est->rendstatus & PDRAW_32_COLS) && (pvid->reg[11]&4)) // H32 + 2-cell mode
vscroll=PicoMem.vsram[plane+0x20];//&0x1ff; vscroll=PicoMem.vsram[plane+0x20];//&0x1ff;
#endif #endif
#if INTERLACE #if INTERLACE
@ -371,7 +371,7 @@ static void DrawTilesFromCacheF(u32 *hc, struct PicoEState *est)
unsigned char *scrpos = est->Draw2FB, *pd = 0; unsigned char *scrpos = est->Draw2FB, *pd = 0;
int scrstart = est->Draw2Start; int scrstart = est->Draw2Start;
if (est->rendstatus & PDRAW_BORDER_32) if ((~est->rendstatus & (PDRAW_BORDER_32|PDRAW_32_COLS)) == 0)
scrpos += 32; scrpos += 32;
while((code=*hc++)) { while((code=*hc++)) {
@ -446,7 +446,7 @@ static void DrawSpriteFull(u32 *sprite, struct PicoEState *est)
while(sy <= 0) { sy+=8; tile+=tdeltay; height--; } while(sy <= 0) { sy+=8; tile+=tdeltay; height--; }
scrpos = est->Draw2FB; scrpos = est->Draw2FB;
if (est->rendstatus&PDRAW_BORDER_32) if ((~est->rendstatus & (PDRAW_BORDER_32|PDRAW_32_COLS)) == 0)
scrpos += 32; scrpos += 32;
scrpos+=sy*est->Draw2Width; scrpos+=sy*est->Draw2Width;
@ -489,13 +489,13 @@ static void DrawAllSpritesFull(int prio, int maxwidth, struct PicoEState *est)
int i,u,link=0; int i,u,link=0;
u32 *sprites[80]; // Sprites u32 *sprites[80]; // Sprites
int y_min=START_ROW*8, y_max=END_ROW*8; // for a simple sprite masking int y_min=START_ROW*8, y_max=END_ROW*8; // for a simple sprite masking
int max_sprites = pvid->reg[12]&1 ? 80 : 64; int max_sprites = !(est->rendstatus & PDRAW_32_COLS) ? 80 : 64;
if (est->rendstatus & PDRAW_30_ROWS) if (est->rendstatus & PDRAW_30_ROWS)
y_min += 8, y_max += 8; y_min += 8, y_max += 8;
table=pvid->reg[5]&0x7f; table=pvid->reg[5]&0x7f;
if (pvid->reg[12]&1) table&=0x7e; // Lowest bit 0 in 40-cell mode if (!(est->rendstatus & PDRAW_32_COLS)) table&=0x7e; // Lowest bit 0 in 40-cell mode
table<<=8; // Get sprite table address/2 table<<=8; // Get sprite table address/2
for (i = u = 0; u < max_sprites && link < max_sprites; u++) for (i = u = 0; u < max_sprites && link < max_sprites; u++)

View file

@ -428,6 +428,7 @@ DrawLayerFull:
ldr r11, [r11, #OFS_EST_Draw2FB] ldr r11, [r11, #OFS_EST_Draw2FB]
sub r4, r9, r4, lsl #24 sub r4, r9, r4, lsl #24
tst r7, #PDRAW_BORDER_32 @ H32 border mode? tst r7, #PDRAW_BORDER_32 @ H32 border mode?
tstne r7, #PDRAW_32_COLS
addne r11, r11, #32 addne r11, r11, #32
mov r4, r4, asr #24 mov r4, r4, asr #24
mov r7, #328*8 mov r7, #328*8
@ -609,6 +610,7 @@ DrawTilesFromCacheF:
ldr r11,[r1, #OFS_EST_Draw2Start] ldr r11,[r1, #OFS_EST_Draw2Start]
ldr r2, [r0], #4 @ read y offset ldr r2, [r0], #4 @ read y offset
tst r7, #PDRAW_BORDER_32 @ H32 border mode? tst r7, #PDRAW_BORDER_32 @ H32 border mode?
tstne r7, #PDRAW_32_COLS
addne r4, r4, #32 addne r4, r4, #32
mov r7, #328 mov r7, #328
mla r2, r7, r2, r4 mla r2, r7, r2, r4
@ -717,6 +719,7 @@ DrawWindowFull:
and r12, r12, #0xf800 and r12, r12, #0xf800
mov r5, r5, lsl #6 @ nametab_step mov r5, r5, lsl #6 @ nametab_step
tst r7, #PDRAW_BORDER_32 tst r7, #PDRAW_BORDER_32
tstne r7, #PDRAW_32_COLS
addne r11, r11, #32 @ center screen in H32 mode addne r11, r11, #32 @ center screen in H32 mode
0: and r4, r0, #0xff 0: and r4, r0, #0xff
@ -945,6 +948,7 @@ DrawSpriteFull:
ldr r2, [r1, #OFS_EST_Draw2Start] ldr r2, [r1, #OFS_EST_Draw2Start]
ldr r10, [r1, #OFS_EST_PicoMem_vram] ldr r10, [r1, #OFS_EST_PicoMem_vram]
tst r0, #PDRAW_BORDER_32 @ H32 border mode? tst r0, #PDRAW_BORDER_32 @ H32 border mode?
tstne r0, #PDRAW_32_COLS
addne r11, r11, #32 addne r11, r11, #32
sub r12, r12, r2, lsl #3 sub r12, r12, r2, lsl #3
mov r0, #328 mov r0, #328