32x, add support for h32 mode rendering

This commit is contained in:
kub 2021-11-22 19:18:12 +01:00
parent 23cd73bc8f
commit 52e4a905c8
6 changed files with 79 additions and 31 deletions

View file

@ -230,7 +230,6 @@ static void p32x_start_blank(void)
// XXX: no proper handling of 32col mode..
if ((Pico32x.vdp_regs[0] & P32XV_Mx) != 0 && // 32x not blanking
(Pico.video.reg[12] & 1) && // 40col mode
(!(Pico.video.debug_p & PVD_KILL_32X)))
{
int md_bg = Pico.video.reg[7] & 0x3f;
@ -238,7 +237,7 @@ static void p32x_start_blank(void)
// we draw full layer (not line-by-line)
PicoDraw32xLayer(offs, lines, md_bg);
}
else if (Pico32xDrawMode != PDM32X_32X_ONLY)
else if (Pico32xDrawMode == PDM32X_BOTH)
PicoDraw32xLayerMdOnly(offs, lines);
pprof_end(draw);

View file

@ -8,6 +8,14 @@
*/
#include "../pico_int.h"
// NB: 32X officially doesn't support H32 mode. However, it does work since the
// cartridge slot carries the EDCLK signal which is always H40 clock and is used
// as video clock by the 32X. The H32 MD image is overlayed with the 320 px 32X
// image which has the same on-screen width. How the /YS signal on the cartridge
// slot (signalling the display of background color) is processed in this case
// is however unclear and might lead to glitches due to race conditions by the
// different video clocks for H32 and H40.
// BGR555 to native conversion
#if defined(USE_BGR555)
#define PXCONV(t) ((t)&(mr|mg|mb|mp))
@ -122,8 +130,6 @@ void FinalizeLine32xRGB555(int sh, int line, struct PicoEState *est)
FinalizeLine555(sh, line, est);
if ((Pico32x.vdp_regs[0] & P32XV_Mx) == 0 || // 32x blanking
// XXX: how is 32col mode handled by real hardware?
!(Pico.video.reg[12] & 1) || // 32col mode
(Pico.video.debug_p & PVD_KILL_32X))
{
return;
@ -310,14 +316,6 @@ void PicoDraw32xLayerMdOnly(int offs, int lines)
int poffs = 0, plen = 320;
int l, p;
if (!(Pico.video.reg[12] & 1)) {
// 32col mode. for some render modes MD pixel data carries an offset
if (!(PicoIn.opt & POPT_DIS_32C_BORDER))
pmd += 32;
poffs = 32;
plen = 256;
}
PicoDrawUpdateHighPal();
dst += poffs;
@ -350,6 +348,8 @@ void PicoDrawSetOutFormat32x(pdso_t which, int use_32x_line_mode)
PicoDrawSetInternalBuf(NULL, 0);
PicoDrawSetOutBufMD(Pico.est.Draw2FB, 328);
}
// always need upscaling for H32, before mixing in 32X layer
PicoIn.opt |= POPT_EN_SOFTSCALE;
if (use_32x_line_mode)
// we'll draw via FinalizeLine32xRGB555 (rare)

View file

@ -57,7 +57,7 @@
add r0, r0, r4
mov lr, pc
ldr pc, [sp, #(4+1)*4]
ldr r1, [sp, #(3+2)*4] @ &Pico.est
ldr r1, [sp, #(4+2)*4] @ &Pico.est
ldr r0, [r1, #OFS_EST_DrawLineDest]
ldr r2, [r1, #OFS_EST_DrawLineDestIncr]
add r0, r0, r2