Popeye: NMI disable is latched from A9 (which corresponds to bit 0 of the I register) when RFSH goes from high to low. [smf]

This commit is contained in:
smf- 2018-02-24 01:44:21 +00:00
parent a58e057b8d
commit b718c5b447
2 changed files with 21 additions and 10 deletions

View File

@ -122,6 +122,7 @@ void tnx1_state::driver_start()
save_item(NAME(m_prot0));
save_item(NAME(m_prot1));
save_item(NAME(m_prot_shift));
save_item(NAME(m_nmi_enabled));
}
void tnx1_state::decrypt_rom()
@ -152,16 +153,23 @@ void tpp2_state::decrypt_rom()
memcpy(rom,&buffer[0],len);
}
INTERRUPT_GEN_MEMBER(tnx1_state::popeye_interrupt)
WRITE8_MEMBER(tnx1_state::refresh_w)
{
m_nmi_enabled = ((offset >> 8) & 1) != 0;
}
WRITE_LINE_MEMBER(tnx1_state::screen_vblank)
{
if (state)
{
std::copy(&m_dmasource[0], &m_dmasource[m_dmasource.bytes()], m_sprite_ram.begin());
std::copy(&m_dmasource[0], &m_dmasource[3], m_background_scroll);
m_palette_bank = m_dmasource[3];
m_field ^= 1;
/* NMIs are enabled by the I register?? How can that be? */
if (device.state().state_int(Z80_I) & 1) /* skyskipr: 0/1, popeye: 2/3 but also 0/1 */
device.execute().set_input_line(INPUT_LINE_NMI, PULSE_LINE);
if (m_nmi_enabled)
m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE);
}
}
@ -478,7 +486,7 @@ MACHINE_CONFIG_START(tnx1_state::config)
MCFG_CPU_ADD("maincpu", Z80, XTAL(8'000'000)/2) /* 4 MHz */
MCFG_CPU_PROGRAM_MAP(maincpu_program_map)
MCFG_CPU_IO_MAP(maincpu_io_map)
MCFG_CPU_VBLANK_INT_DRIVER("screen", tnx1_state, popeye_interrupt)
MCFG_Z80_SET_REFRESH_CALLBACK(WRITE8(tnx1_state, refresh_w))
/* video hardware */
MCFG_SCREEN_ADD("screen", RASTER)
@ -488,6 +496,7 @@ MACHINE_CONFIG_START(tnx1_state::config)
MCFG_SCREEN_VISIBLE_AREA(0*16, 32*16-1, 2*16, 30*16-1)
MCFG_SCREEN_UPDATE_DRIVER(tnx1_state, screen_update)
MCFG_SCREEN_PALETTE("palette")
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(tnx1_state, screen_vblank))
MCFG_GFXDECODE_ADD("gfxdecode", "palette", popeye)
MCFG_PALETTE_ADD("palette", 16+16*2+8*4)

View File

@ -51,7 +51,9 @@ protected:
uint8_t m_prot1;
uint8_t m_prot_shift;
uint8_t m_dswbit;
bool m_nmi_enabled;
DECLARE_WRITE8_MEMBER(refresh_w);
DECLARE_READ8_MEMBER(protection_r);
DECLARE_WRITE8_MEMBER(protection_w);
DECLARE_WRITE8_MEMBER(popeye_videoram_w);
@ -63,7 +65,7 @@ protected:
virtual void video_start() override;
virtual DECLARE_PALETTE_INIT(palette_init);
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(popeye_interrupt);
DECLARE_WRITE_LINE_MEMBER(screen_vblank);
void update_palette();
virtual void decrypt_rom();
virtual void draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect);