sms mode 4, fix 8 bit renderer code

This commit is contained in:
kub 2020-07-25 23:58:57 +02:00
parent 2e5cbf5b6a
commit 7980d47767
4 changed files with 35 additions and 14 deletions

View file

@ -36,8 +36,8 @@ int (*PicoScanBegin)(unsigned int num) = NULL;
int (*PicoScanEnd) (unsigned int num) = NULL;
static unsigned char DefHighCol[8+320+8];
static unsigned char *HighColBase = DefHighCol;
static int HighColIncrement;
unsigned char *HighColBase = DefHighCol;
int HighColIncrement;
static unsigned int DefOutBuff[320*2/2];
void *DrawLineDestBase = DefOutBuff;
@ -1848,7 +1848,9 @@ void PicoDrawUpdateHighPal(void)
if ((PicoIn.opt & POPT_ALT_RENDERER) | (est->rendstatus & PDRAW_SONIC_MODE))
sh = 0; // no s/h support
if (FinalizeLine == FinalizeLine8bit)
if (PicoIn.AHW & PAHW_SMS)
PicoDoHighPal555M4();
else if (FinalizeLine == FinalizeLine8bit)
PicoDoHighPal555_8bit(sh, 0, est);
else
PicoDoHighPal555(sh, 0, est);
@ -1863,6 +1865,7 @@ void PicoDrawUpdateHighPal(void)
void PicoDrawSetOutFormat(pdso_t which, int use_32x_line_mode)
{
PicoDrawSetInternalBuf(NULL, 0);
switch (which)
{
case PDF_8BIT:
@ -1878,6 +1881,7 @@ void PicoDrawSetOutFormat(pdso_t which, int use_32x_line_mode)
default:
FinalizeLine = NULL;
PicoDrawSetOutBufMD(Pico.est.Draw2FB+8, 328);
break;
}
if (PicoIn.AHW & PAHW_32X)

View file

@ -69,6 +69,8 @@ static void draw_sprites(int scanline)
if (pv->reg[0] & 8)
xoff = 0;
if (!(PicoIn.opt & POPT_DIS_32C_BORDER))
xoff += 32;
sat = (unsigned char *)PicoMem.vram + ((pv->reg[5] & 0x7e) << 7);
if (pv->reg[1] & 2) {
@ -177,6 +179,8 @@ static void DrawDisplayM4(int scanline)
if (dx != 8)
cells++; // have hscroll, need to draw 1 cell more
dx += cellskip << 3;
if (!FinalizeLineM4 && !(PicoIn.opt & POPT_DIS_32C_BORDER))
dx += 32;
// low priority tiles
if (!(pv->debug_p & PVD_KILL_B))
@ -190,9 +194,11 @@ static void DrawDisplayM4(int scanline)
if (!(pv->debug_p & PVD_KILL_A))
draw_strip(nametab, dx, cells, tilex | 0x1000 | (ty << 16));
if (pv->reg[0] & 0x20)
// first column masked
((int *)Pico.est.HighCol)[2] = ((int *)Pico.est.HighCol)[3] = 0xe0e0e0e0;
if (pv->reg[0] & 0x20) {
// first column masked, caculate offset to start of line
dx = (dx&~0x1f) / 4;
((u32 *)Pico.est.HighCol)[dx+2] = ((u32 *)Pico.est.HighCol)[dx+3] = 0xe0e0e0e0;
}
}
void PicoFrameStartMode4(void)
@ -219,6 +225,7 @@ void PicoFrameStartMode4(void)
rendlines = lines;
}
Pico.est.HighCol = HighColBase + screen_offset * HighColIncrement;
Pico.est.DrawLineDest = (char *)DrawLineDestBase + screen_offset * DrawLineDestIncrement;
}
@ -243,6 +250,7 @@ void PicoLineMode4(int line)
if (PicoScanEnd != NULL)
skip_next_line = PicoScanEnd(line + screen_offset);
Pico.est.HighCol += HighColIncrement;
Pico.est.DrawLineDest = (char *)Pico.est.DrawLineDest + DrawLineDestIncrement;
}
@ -296,7 +304,8 @@ void PicoDrawSetOutputMode4(pdso_t which)
{
case PDF_8BIT: FinalizeLineM4 = FinalizeLine8bitM4; break;
case PDF_RGB555: FinalizeLineM4 = FinalizeLineRGB555M4; break;
default: FinalizeLineM4 = NULL; break;
default: FinalizeLineM4 = NULL;
PicoDrawSetInternalBuf(Pico.est.Draw2FB, 328); break;
}
}

View file

@ -666,6 +666,8 @@ extern int (*PicoScanBegin)(unsigned int num);
extern int (*PicoScanEnd)(unsigned int num);
#define MAX_LINE_SPRITES 27 // +1 last sprite width, +4 hdr; total 32
extern unsigned char HighLnSpr[240][4+MAX_LINE_SPRITES+1];
extern unsigned char *HighColBase;
extern int HighColIncrement;
extern void *DrawLineDestBase;
extern int DrawLineDestIncrement;
extern unsigned int VdpSATCache[128];