SMS/GG: timing improvements, more game fixes, add overscan option (dip) for GG games

This commit is contained in:
dinkc64 2015-03-05 23:10:21 +00:00
parent 355464abd8
commit e747176262
5 changed files with 819 additions and 786 deletions

File diff suppressed because it is too large Load Diff

View File

@ -43,6 +43,8 @@ static const uint32 atex[4] =
/* Bitplane to packed pixel LUT */
uint32 bp_lut[0x10000];
uint32 gg_overscanmode;
/* Macros to access memory 32-bits at a time (from MAME's drawgfx.c) */
#ifdef ALIGN_DWORD
@ -257,11 +259,12 @@ void render_line(int line)
INT32 extend = (vdp.extended && IS_GG) ? 16 : 0; // GG: in extended mode, the screen starts 16pixels lower than usual.
if((IS_GG) && ((line < 24 + extend) || (line > 167 + extend))) {
// Blank top and bottom borders for GG.
if((IS_GG) && ((!gg_overscanmode && ((line < 24 + extend) || (line > 167 + extend))) || (gg_overscanmode && line < 9))) {
// GG: Blank top and bottom borders.
// GG: If overscan mode is enabled, only blank the top 8 lines (which are the most corrupted).
} else
if(!(vdp.reg[1] & 0x40))
{ // Blank line (full width)
if(!(vdp.reg[1] & 0x40))
{ // Blank line with backdrop color (full width)
memset(linebuf, BACKDROP_COLOR, bitmap.width);
}
else

View File

@ -25,6 +25,7 @@ extern uint8 txt_lookup[256][2];
extern uint8 bp_expand[256][8];
extern uint8 lut[0x10000];
extern uint32 bp_lut[0x10000];
extern uint32 gg_overscanmode;
void render_shutdown(void);
void render_init(void);

View File

@ -31,7 +31,7 @@ void system_frame(int skip_render)
{
static int iline_table[] = {0xC0, 0xE0, 0xF0};
int lpf = (sms.display == DISPLAY_NTSC) ? 262 : 313;
int iline;
int iline, z80cnt = 0;;
INT32 nSoundBufferPos = 0;
/* Debounce pause key */
@ -49,6 +49,8 @@ void system_frame(int skip_render)
sms.paused = 0;
}
ZetNewFrame();
text_counter = 0;
/* End of frame, parse sprites for line 0 on line 261 (VCount=$FF) */
@ -57,9 +59,8 @@ void system_frame(int skip_render)
for(vdp.line = 0; vdp.line < lpf;)
{
ZetRun(227);
iline = iline_table[vdp.extended];
z80cnt = 0;
if(!skip_render)
{
@ -74,10 +75,12 @@ void system_frame(int skip_render)
vdp.left = vdp.reg[0x0A];
vdp.hint_pending = 1;
ZetRun(16);
if(vdp.reg[0x00] & 0x10)
{
{
if (!(ZetTotalCycles() % CYCLES_PER_LINE)) {
ZetRun(1);
z80cnt++;
}
ZetSetIRQLine(0, CPU_IRQSTATUS_ACK);
}
}
@ -87,13 +90,13 @@ void system_frame(int skip_render)
vdp.left = vdp.reg[0x0A];
}
ZetRun(228 - z80cnt);
if(vdp.line == iline)
{
vdp.status |= 0x80;
vdp.vint_pending = 1;
ZetRun(16);
if(vdp.reg[0x01] & 0x20)
{
ZetSetIRQLine(0, CPU_IRQSTATUS_ACK);

View File

@ -315,7 +315,7 @@ uint8 vdp_read(int offset)
return temp;
case 1: /* Status flags */
temp = vdp.status;
temp = vdp.status | 0x1f;
vdp.pending = 0;
vdp.status = 0;
vdp.vint_pending = 0;