mirror of
https://github.com/holub/mame
synced 2025-07-05 18:08:04 +03:00
timelimt: halve maincpu nmi rate, fixed spriteram out of bounds access
This commit is contained in:
parent
e4963f1929
commit
f6c71a1f8e
@ -22,23 +22,25 @@ Notes:
|
||||
#include "machine/gen_latch.h"
|
||||
#include "machine/watchdog.h"
|
||||
#include "sound/ay8910.h"
|
||||
|
||||
#include "screen.h"
|
||||
#include "speaker.h"
|
||||
|
||||
|
||||
/***************************************************************************/
|
||||
|
||||
|
||||
void timelimt_state::machine_start()
|
||||
{
|
||||
m_nmi_state = false;
|
||||
m_nmi_enabled = false;
|
||||
|
||||
save_item(NAME(m_nmi_state));
|
||||
save_item(NAME(m_nmi_enabled));
|
||||
}
|
||||
|
||||
WRITE_LINE_MEMBER(timelimt_state::nmi_enable_w)
|
||||
{
|
||||
m_nmi_enabled = state;
|
||||
if (!m_nmi_enabled)
|
||||
m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE);
|
||||
m_nmi_enabled = bool(state);
|
||||
}
|
||||
|
||||
WRITE_LINE_MEMBER(timelimt_state::coin_lockout_w)
|
||||
@ -214,10 +216,14 @@ GFXDECODE_END
|
||||
|
||||
/***************************************************************************/
|
||||
|
||||
INTERRUPT_GEN_MEMBER(timelimt_state::irq)
|
||||
INTERRUPT_GEN_MEMBER(timelimt_state::main_nmi)
|
||||
{
|
||||
if (m_nmi_enabled)
|
||||
device.execute().set_input_line(INPUT_LINE_NMI, ASSERT_LINE);
|
||||
m_nmi_state = !m_nmi_state;
|
||||
|
||||
if (m_nmi_enabled && m_nmi_state)
|
||||
m_maincpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE);
|
||||
else if (!m_nmi_state)
|
||||
m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE);
|
||||
}
|
||||
|
||||
/***************************************************************************/
|
||||
@ -228,7 +234,7 @@ void timelimt_state::timelimt(machine_config &config)
|
||||
Z80(config, m_maincpu, 5000000); /* 5.000 MHz */
|
||||
m_maincpu->set_addrmap(AS_PROGRAM, &timelimt_state::main_map);
|
||||
m_maincpu->set_addrmap(AS_IO, &timelimt_state::main_io_map);
|
||||
m_maincpu->set_vblank_int("screen", FUNC(timelimt_state::irq));
|
||||
m_maincpu->set_vblank_int("screen", FUNC(timelimt_state::main_nmi));
|
||||
|
||||
Z80(config, m_audiocpu, 18432000/6); /* 3.072 MHz */
|
||||
m_audiocpu->set_addrmap(AS_PROGRAM, &timelimt_state::sound_map);
|
||||
|
@ -37,7 +37,8 @@ protected:
|
||||
required_shared_ptr<uint8_t> m_bg_videoram;
|
||||
required_shared_ptr<uint8_t> m_spriteram;
|
||||
|
||||
int m_nmi_enabled;
|
||||
bool m_nmi_enabled;
|
||||
bool m_nmi_state;
|
||||
int m_scrollx;
|
||||
int m_scrolly;
|
||||
tilemap_t *m_bg_tilemap;
|
||||
@ -60,7 +61,7 @@ protected:
|
||||
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
|
||||
INTERRUPT_GEN_MEMBER(irq);
|
||||
INTERRUPT_GEN_MEMBER(main_nmi);
|
||||
|
||||
void main_io_map(address_map &map);
|
||||
void main_map(address_map &map);
|
||||
|
@ -87,6 +87,9 @@ void timelimt_state::video_start()
|
||||
|
||||
m_fg_tilemap->set_transparent_pen(0);
|
||||
|
||||
m_scrollx = 0;
|
||||
m_scrolly = 0;
|
||||
|
||||
save_item(NAME(m_scrollx));
|
||||
save_item(NAME(m_scrolly));
|
||||
}
|
||||
@ -125,7 +128,7 @@ void timelimt_state::scroll_y_w(uint8_t data)
|
||||
|
||||
void timelimt_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
for( int offs = m_spriteram.bytes(); offs >= 0; offs -= 4 )
|
||||
for( int offs = m_spriteram.bytes() - 4; offs >= 0; offs -= 4 )
|
||||
{
|
||||
int sy = 240 - m_spriteram[offs];
|
||||
int sx = m_spriteram[offs+3];
|
||||
|
Loading…
Reference in New Issue
Block a user