mirror of
https://github.com/holub/mame
synced 2025-07-01 16:19:38 +03:00
scotrsht,c: added save state support (nw)
This commit is contained in:
parent
3a695ba459
commit
65d6d0e2d3
@ -45,31 +45,31 @@ WRITE8_MEMBER(scotrsht_state::ctrl_w)
|
||||
flip_screen_set(data & 0x08);
|
||||
}
|
||||
|
||||
INTERRUPT_GEN_MEMBER(scotrsht_state::scotrsht_interrupt)
|
||||
INTERRUPT_GEN_MEMBER(scotrsht_state::interrupt)
|
||||
{
|
||||
if (m_irq_enable)
|
||||
device.execute().set_input_line(0, HOLD_LINE);
|
||||
m_maincpu->set_input_line(0, HOLD_LINE);
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(scotrsht_state::scotrsht_soundlatch_w)
|
||||
WRITE8_MEMBER(scotrsht_state::soundlatch_w)
|
||||
{
|
||||
soundlatch_byte_w(space, 0, data);
|
||||
m_audiocpu->set_input_line(0, HOLD_LINE);
|
||||
}
|
||||
|
||||
static ADDRESS_MAP_START( scotrsht_map, AS_PROGRAM, 8, scotrsht_state )
|
||||
AM_RANGE(0x0000, 0x07ff) AM_RAM_WRITE(scotrsht_colorram_w) AM_SHARE("colorram")
|
||||
AM_RANGE(0x0800, 0x0fff) AM_RAM_WRITE(scotrsht_videoram_w) AM_SHARE("videoram")
|
||||
AM_RANGE(0x0000, 0x07ff) AM_RAM_WRITE(colorram_w) AM_SHARE("colorram")
|
||||
AM_RANGE(0x0800, 0x0fff) AM_RAM_WRITE(videoram_w) AM_SHARE("videoram")
|
||||
AM_RANGE(0x1000, 0x10bf) AM_RAM AM_SHARE("spriteram") /* sprites */
|
||||
AM_RANGE(0x10c0, 0x1fff) AM_RAM /* work ram */
|
||||
AM_RANGE(0x2000, 0x201f) AM_RAM AM_SHARE("scroll") /* scroll registers */
|
||||
AM_RANGE(0x2040, 0x2040) AM_WRITENOP
|
||||
AM_RANGE(0x2041, 0x2041) AM_WRITENOP
|
||||
AM_RANGE(0x2042, 0x2042) AM_WRITENOP /* it should be -> bit 2 = scroll direction like in jailbrek, but it's not used */
|
||||
AM_RANGE(0x2043, 0x2043) AM_WRITE(scotrsht_charbank_w)
|
||||
AM_RANGE(0x2043, 0x2043) AM_WRITE(charbank_w)
|
||||
AM_RANGE(0x2044, 0x2044) AM_WRITE(ctrl_w)
|
||||
AM_RANGE(0x3000, 0x3000) AM_WRITE(scotrsht_palettebank_w)
|
||||
AM_RANGE(0x3100, 0x3100) AM_WRITE(scotrsht_soundlatch_w)
|
||||
AM_RANGE(0x3000, 0x3000) AM_WRITE(palettebank_w)
|
||||
AM_RANGE(0x3100, 0x3100) AM_WRITE(soundlatch_w)
|
||||
AM_RANGE(0x3200, 0x3200) AM_WRITENOP /* it writes 0, 1 */
|
||||
AM_RANGE(0x3100, 0x3100) AM_READ_PORT("DSW2")
|
||||
AM_RANGE(0x3200, 0x3200) AM_READ_PORT("DSW3")
|
||||
@ -182,7 +182,7 @@ static MACHINE_CONFIG_START( scotrsht, scotrsht_state )
|
||||
/* basic machine hardware */
|
||||
MCFG_CPU_ADD("maincpu", M6809, 18432000/6) /* 3.072 MHz */
|
||||
MCFG_CPU_PROGRAM_MAP(scotrsht_map)
|
||||
MCFG_CPU_VBLANK_INT_DRIVER("screen", scotrsht_state, scotrsht_interrupt)
|
||||
MCFG_CPU_VBLANK_INT_DRIVER("screen", scotrsht_state, interrupt)
|
||||
|
||||
MCFG_CPU_ADD("audiocpu", Z80, 18432000/6) /* 3.072 MHz */
|
||||
MCFG_CPU_PROGRAM_MAP(scotrsht_sound_map)
|
||||
@ -194,7 +194,7 @@ static MACHINE_CONFIG_START( scotrsht, scotrsht_state )
|
||||
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
|
||||
MCFG_SCREEN_SIZE(32*8, 32*8)
|
||||
MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
|
||||
MCFG_SCREEN_UPDATE_DRIVER(scotrsht_state, screen_update_scotrsht)
|
||||
MCFG_SCREEN_UPDATE_DRIVER(scotrsht_state, screen_update)
|
||||
MCFG_SCREEN_PALETTE("palette")
|
||||
|
||||
MCFG_GFXDECODE_ADD("gfxdecode", "palette", scotrsht)
|
||||
@ -240,4 +240,4 @@ ROM_START( scotrsht )
|
||||
ROM_LOAD( "gx545_6301_8f.bin", 0x0400, 0x0100, CRC(c1c7cf58) SHA1(08452228bf13e43ce4a05806f79e9cd1542416f1) ) /* sprites lookup */
|
||||
ROM_END
|
||||
|
||||
GAME( 1985, scotrsht, 0, scotrsht, scotrsht, driver_device, 0, ROT90,"Konami", "Scooter Shooter", 0 )
|
||||
GAME( 1985, scotrsht, 0, scotrsht, scotrsht, driver_device, 0, ROT90,"Konami", "Scooter Shooter", GAME_SUPPORTS_SAVE )
|
||||
|
@ -3,37 +3,45 @@ class scotrsht_state : public driver_device
|
||||
public:
|
||||
scotrsht_state(const machine_config &mconfig, device_type type, const char *tag)
|
||||
: driver_device(mconfig, type, tag),
|
||||
m_colorram(*this, "colorram"),
|
||||
m_videoram(*this, "videoram"),
|
||||
m_spriteram(*this, "spriteram"),
|
||||
m_scroll(*this, "scroll"),
|
||||
m_maincpu(*this, "maincpu"),
|
||||
m_audiocpu(*this, "audiocpu"),
|
||||
m_gfxdecode(*this, "gfxdecode"),
|
||||
m_palette(*this, "palette") { }
|
||||
m_palette(*this, "palette"),
|
||||
m_colorram(*this, "colorram"),
|
||||
m_videoram(*this, "videoram"),
|
||||
m_spriteram(*this, "spriteram"),
|
||||
m_scroll(*this, "scroll") { }
|
||||
|
||||
int m_irq_enable;
|
||||
required_shared_ptr<UINT8> m_colorram;
|
||||
required_shared_ptr<UINT8> m_videoram;
|
||||
required_shared_ptr<UINT8> m_spriteram;
|
||||
required_shared_ptr<UINT8> m_scroll;
|
||||
tilemap_t *m_bg_tilemap;
|
||||
int m_charbank;
|
||||
int m_palette_bank;
|
||||
DECLARE_WRITE8_MEMBER(ctrl_w);
|
||||
DECLARE_WRITE8_MEMBER(scotrsht_soundlatch_w);
|
||||
DECLARE_WRITE8_MEMBER(scotrsht_videoram_w);
|
||||
DECLARE_WRITE8_MEMBER(scotrsht_colorram_w);
|
||||
DECLARE_WRITE8_MEMBER(scotrsht_charbank_w);
|
||||
DECLARE_WRITE8_MEMBER(scotrsht_palettebank_w);
|
||||
TILE_GET_INFO_MEMBER(scotrsht_get_bg_tile_info);
|
||||
virtual void video_start();
|
||||
DECLARE_PALETTE_INIT(scotrsht);
|
||||
UINT32 screen_update_scotrsht(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
INTERRUPT_GEN_MEMBER(scotrsht_interrupt);
|
||||
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect );
|
||||
required_device<cpu_device> m_maincpu;
|
||||
required_device<cpu_device> m_audiocpu;
|
||||
required_device<gfxdecode_device> m_gfxdecode;
|
||||
required_device<palette_device> m_palette;
|
||||
|
||||
required_shared_ptr<UINT8> m_colorram;
|
||||
required_shared_ptr<UINT8> m_videoram;
|
||||
required_shared_ptr<UINT8> m_spriteram;
|
||||
required_shared_ptr<UINT8> m_scroll;
|
||||
|
||||
tilemap_t *m_bg_tilemap;
|
||||
|
||||
int m_irq_enable;
|
||||
int m_charbank;
|
||||
int m_palette_bank;
|
||||
|
||||
DECLARE_WRITE8_MEMBER(ctrl_w);
|
||||
DECLARE_WRITE8_MEMBER(soundlatch_w);
|
||||
DECLARE_WRITE8_MEMBER(videoram_w);
|
||||
DECLARE_WRITE8_MEMBER(colorram_w);
|
||||
DECLARE_WRITE8_MEMBER(charbank_w);
|
||||
DECLARE_WRITE8_MEMBER(palettebank_w);
|
||||
|
||||
TILE_GET_INFO_MEMBER(get_bg_tile_info);
|
||||
|
||||
INTERRUPT_GEN_MEMBER(interrupt);
|
||||
|
||||
virtual void video_start();
|
||||
DECLARE_PALETTE_INIT(scotrsht);
|
||||
|
||||
UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect );
|
||||
};
|
||||
|
@ -34,19 +34,19 @@ PALETTE_INIT_MEMBER(scotrsht_state, scotrsht)
|
||||
}
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(scotrsht_state::scotrsht_videoram_w)
|
||||
WRITE8_MEMBER(scotrsht_state::videoram_w)
|
||||
{
|
||||
m_videoram[offset] = data;
|
||||
m_bg_tilemap->mark_tile_dirty(offset);
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(scotrsht_state::scotrsht_colorram_w)
|
||||
WRITE8_MEMBER(scotrsht_state::colorram_w)
|
||||
{
|
||||
m_colorram[offset] = data;
|
||||
m_bg_tilemap->mark_tile_dirty(offset);
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(scotrsht_state::scotrsht_charbank_w)
|
||||
WRITE8_MEMBER(scotrsht_state::charbank_w)
|
||||
{
|
||||
if (m_charbank != (data & 0x01))
|
||||
{
|
||||
@ -57,7 +57,7 @@ WRITE8_MEMBER(scotrsht_state::scotrsht_charbank_w)
|
||||
/* other bits unknown */
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(scotrsht_state::scotrsht_palettebank_w)
|
||||
WRITE8_MEMBER(scotrsht_state::palettebank_w)
|
||||
{
|
||||
if (m_palette_bank != ((data & 0x70) >> 4))
|
||||
{
|
||||
@ -72,7 +72,7 @@ WRITE8_MEMBER(scotrsht_state::scotrsht_palettebank_w)
|
||||
}
|
||||
|
||||
|
||||
TILE_GET_INFO_MEMBER(scotrsht_state::scotrsht_get_bg_tile_info)
|
||||
TILE_GET_INFO_MEMBER(scotrsht_state::get_bg_tile_info)
|
||||
{
|
||||
int attr = m_colorram[tile_index];
|
||||
int code = m_videoram[tile_index] + (m_charbank << 9) + ((attr & 0x40) << 2);
|
||||
@ -90,18 +90,15 @@ TILE_GET_INFO_MEMBER(scotrsht_state::scotrsht_get_bg_tile_info)
|
||||
/* Same as Jailbreak + palette bank */
|
||||
void scotrsht_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect )
|
||||
{
|
||||
UINT8 *spriteram = m_spriteram;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < m_spriteram.bytes(); i += 4)
|
||||
for (int i = 0; i < m_spriteram.bytes(); i += 4)
|
||||
{
|
||||
int attr = spriteram[i + 1]; // attributes = ?tyxcccc
|
||||
int code = spriteram[i] + ((attr & 0x40) << 2);
|
||||
int attr = m_spriteram[i + 1]; // attributes = ?tyxcccc
|
||||
int code = m_spriteram[i] + ((attr & 0x40) << 2);
|
||||
int color = (attr & 0x0f) + m_palette_bank * 16;
|
||||
int flipx = attr & 0x10;
|
||||
int flipy = attr & 0x20;
|
||||
int sx = spriteram[i + 2] - ((attr & 0x80) << 1);
|
||||
int sy = spriteram[i + 3];
|
||||
int sx = m_spriteram[i + 2] - ((attr & 0x80) << 1);
|
||||
int sy = m_spriteram[i + 3];
|
||||
|
||||
if (flip_screen())
|
||||
{
|
||||
@ -119,16 +116,18 @@ void scotrsht_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprec
|
||||
|
||||
void scotrsht_state::video_start()
|
||||
{
|
||||
m_bg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(scotrsht_state::scotrsht_get_bg_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 32);
|
||||
m_bg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(scotrsht_state::get_bg_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 32);
|
||||
|
||||
m_bg_tilemap->set_scroll_cols(64);
|
||||
|
||||
save_item(NAME(m_irq_enable));
|
||||
save_item(NAME(m_charbank));
|
||||
save_item(NAME(m_palette_bank));
|
||||
}
|
||||
|
||||
UINT32 scotrsht_state::screen_update_scotrsht(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
UINT32 scotrsht_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
int col;
|
||||
|
||||
for (col = 0; col < 32; col++)
|
||||
for (int col = 0; col < 32; col++)
|
||||
m_bg_tilemap->set_scrolly(col, m_scroll[col]);
|
||||
|
||||
m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
|
||||
|
Loading…
Reference in New Issue
Block a user