Merge pull request #5684 from AmatCoder/AmatCoder-snes-3

[snes] Run HTOTAL double only if needed
This commit is contained in:
R. Belmont 2019-09-25 17:00:50 -04:00 committed by GitHub
commit 21ad25e4c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 11 deletions

View File

@ -1987,7 +1987,7 @@ static const uint16_t vram_fgr_shiftab[4] = { 0, 5, 6, 7 };
void snes_ppu_device::set_latch_hv(int16_t x, int16_t y)
{
m_beam.latch_vert = y;
m_beam.latch_horz = x;
m_beam.latch_horz = x / m_htmult;
m_stat78 |= 0x40; // indicate we latched
// printf("latched @ H %d V %d\n", m_beam.latch_horz, m_beam.latch_vert);
@ -2012,12 +2012,12 @@ void snes_ppu_device::dynamic_res_change()
if ((m_stat78 & 0x10) == SNES_NTSC)
{
refresh = HZ_TO_ATTOSECONDS(DOTCLK_NTSC) * SNES_HTOTAL * SNES_VTOTAL_NTSC;
screen().configure(SNES_HTOTAL * 2, SNES_VTOTAL_NTSC * m_interlace, visarea, refresh);
screen().configure(SNES_HTOTAL * m_htmult, SNES_VTOTAL_NTSC * m_interlace, visarea, refresh);
}
else
{
refresh = HZ_TO_ATTOSECONDS(DOTCLK_PAL) * SNES_HTOTAL * SNES_VTOTAL_PAL;
screen().configure(SNES_HTOTAL * 2, SNES_VTOTAL_PAL * m_interlace, visarea, refresh);
screen().configure(SNES_HTOTAL * m_htmult, SNES_VTOTAL_PAL * m_interlace, visarea, refresh);
}
}
@ -2312,7 +2312,7 @@ uint8_t snes_ppu_device::read(address_space &space, uint32_t offset, uint8_t wri
return m_ppu1_open_bus;
}
case SLHV: /* Software latch for H/V counter */
set_latch_hv(screen().hpos() / m_htmult, screen().vpos());
set_latch_hv(screen().hpos(), screen().vpos());
return m_openbus_cb(space, 0); /* Return value is meaningless */
case ROAMDATA: /* Read data from OAM (DR) */

View File

@ -230,14 +230,12 @@ TIMER_CALLBACK_MEMBER(snes_state::snes_hblank_tick)
/* draw a scanline */
if (m_ppu->current_vert() <= m_ppu->last_visible_line())
{
if (m_screen->vpos() > 0)
{
/* Do HDMA */
if (SNES_CPU_REG(HDMAEN))
hdma(cpu0space);
/* Do HDMA */
if (SNES_CPU_REG(HDMAEN))
hdma(cpu0space);
m_screen->update_partial((m_ppu->interlace() == 2) ? (m_ppu->current_vert() * m_ppu->interlace()) : m_ppu->current_vert() - 1);
}
if (m_screen->vpos() > 0)
m_screen->update_partial((m_ppu->interlace() == 2) ? (m_ppu->current_vert() * m_ppu->interlace()) : m_ppu->current_vert());
}
// signal hblank