mirror of
https://github.com/holub/mame
synced 2025-04-23 00:39:36 +03:00
seicross.c: added save state support (nw)
This commit is contained in:
parent
ae15cc2745
commit
8b4df6d6d8
@ -60,6 +60,12 @@ void seicross_state::nvram_init(nvram_device &nvram, void *data, size_t size)
|
||||
memcpy(data, init, sizeof(init));
|
||||
}
|
||||
|
||||
void seicross_state::machine_start()
|
||||
{
|
||||
save_item(NAME(m_portb));
|
||||
save_item(NAME(m_irq_mask));
|
||||
}
|
||||
|
||||
void seicross_state::machine_reset()
|
||||
{
|
||||
/* start with the protection mcu halted */
|
||||
@ -68,12 +74,12 @@ void seicross_state::machine_reset()
|
||||
|
||||
|
||||
|
||||
READ8_MEMBER(seicross_state::friskyt_portB_r)
|
||||
READ8_MEMBER(seicross_state::portB_r)
|
||||
{
|
||||
return (m_portb & 0x9f) | (ioport("DEBUG")->read_safe(0) & 0x60);
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(seicross_state::friskyt_portB_w)
|
||||
WRITE8_MEMBER(seicross_state::portB_w)
|
||||
{
|
||||
//logerror("PC %04x: 8910 port B = %02x\n", space.device().safe_pc(), data);
|
||||
/* bit 0 is IRQ enable */
|
||||
@ -98,10 +104,10 @@ static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8, seicross_state )
|
||||
AM_RANGE(0x0000, 0x77ff) AM_ROM
|
||||
AM_RANGE(0x7800, 0x7fff) AM_RAM AM_SHARE("share1")
|
||||
AM_RANGE(0x8820, 0x887f) AM_RAM AM_SHARE("spriteram")
|
||||
AM_RANGE(0x9000, 0x93ff) AM_RAM_WRITE(seicross_videoram_w) AM_SHARE("videoram") /* video RAM */
|
||||
AM_RANGE(0x9000, 0x93ff) AM_RAM_WRITE(videoram_w) AM_SHARE("videoram") /* video RAM */
|
||||
AM_RANGE(0x9800, 0x981f) AM_RAM AM_SHARE("row_scroll")
|
||||
AM_RANGE(0x9880, 0x989f) AM_WRITEONLY AM_SHARE("spriteram2")
|
||||
AM_RANGE(0x9c00, 0x9fff) AM_RAM_WRITE(seicross_colorram_w) AM_SHARE("colorram")
|
||||
AM_RANGE(0x9c00, 0x9fff) AM_RAM_WRITE(colorram_w) AM_SHARE("colorram")
|
||||
AM_RANGE(0xa000, 0xa000) AM_READ_PORT("IN0") /* IN0 */
|
||||
AM_RANGE(0xa800, 0xa800) AM_READ_PORT("IN1") /* IN1 */
|
||||
AM_RANGE(0xb000, 0xb000) AM_READ_PORT("TEST") /* test */
|
||||
@ -390,7 +396,7 @@ static MACHINE_CONFIG_START( no_nvram, seicross_state )
|
||||
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */ /* frames per second, vblank duration */)
|
||||
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(seicross_state, screen_update_seicross)
|
||||
MCFG_SCREEN_UPDATE_DRIVER(seicross_state, screen_update)
|
||||
MCFG_SCREEN_PALETTE("palette")
|
||||
|
||||
MCFG_GFXDECODE_ADD("gfxdecode", "palette", seicross)
|
||||
@ -401,8 +407,8 @@ static MACHINE_CONFIG_START( no_nvram, seicross_state )
|
||||
MCFG_SPEAKER_STANDARD_MONO("mono")
|
||||
|
||||
MCFG_SOUND_ADD("aysnd", AY8910, 1536000)
|
||||
MCFG_AY8910_PORT_B_READ_CB(READ8(seicross_state, friskyt_portB_r))
|
||||
MCFG_AY8910_PORT_B_WRITE_CB(WRITE8(seicross_state, friskyt_portB_w))
|
||||
MCFG_AY8910_PORT_B_READ_CB(READ8(seicross_state, portB_r))
|
||||
MCFG_AY8910_PORT_B_WRITE_CB(WRITE8(seicross_state, portB_w))
|
||||
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
|
||||
|
||||
MCFG_DAC_ADD("dac")
|
||||
@ -600,9 +606,9 @@ DRIVER_INIT_MEMBER(seicross_state,friskytb)
|
||||
}
|
||||
|
||||
|
||||
GAME( 1981, friskyt, 0, nvram, friskyt, driver_device, 0, ROT0, "Nichibutsu", "Frisky Tom (set 1)", GAME_NO_COCKTAIL )
|
||||
GAME( 1981, friskyta, friskyt, nvram, friskyt, driver_device, 0, ROT0, "Nichibutsu", "Frisky Tom (set 2)", GAME_NO_COCKTAIL )
|
||||
GAME( 1981, friskytb, friskyt, nvram, friskyt, seicross_state, friskytb, ROT0, "Nichibutsu", "Frisky Tom (set 3, encrypted)", GAME_NO_COCKTAIL ) // protection mcu runs encrypted opcodes
|
||||
GAME( 1982, radrad, 0, no_nvram, radrad, driver_device, 0, ROT0, "Nichibutsu USA", "Radical Radial", GAME_NO_COCKTAIL )
|
||||
GAME( 1984, seicross, 0, no_nvram, seicross, driver_device, 0, ROT90, "Nichibutsu / Alice", "Seicross", GAME_NO_COCKTAIL )
|
||||
GAME( 1984, sectrzon, seicross, no_nvram, seicross, driver_device, 0, ROT90, "Nichibutsu / Alice", "Sector Zone", GAME_NO_COCKTAIL )
|
||||
GAME( 1981, friskyt, 0, nvram, friskyt, driver_device, 0, ROT0, "Nichibutsu", "Frisky Tom (set 1)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE )
|
||||
GAME( 1981, friskyta, friskyt, nvram, friskyt, driver_device, 0, ROT0, "Nichibutsu", "Frisky Tom (set 2)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE )
|
||||
GAME( 1981, friskytb, friskyt, nvram, friskyt, seicross_state, friskytb, ROT0, "Nichibutsu", "Frisky Tom (set 3, encrypted)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE ) // protection mcu runs encrypted opcodes
|
||||
GAME( 1982, radrad, 0, no_nvram, radrad, driver_device, 0, ROT0, "Nichibutsu USA", "Radical Radial", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE )
|
||||
GAME( 1984, seicross, 0, no_nvram, seicross, driver_device, 0, ROT90, "Nichibutsu / Alice", "Seicross", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE )
|
||||
GAME( 1984, sectrzon, seicross, no_nvram, seicross, driver_device, 0, ROT90, "Nichibutsu / Alice", "Sector Zone", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE )
|
||||
|
@ -5,16 +5,22 @@ class seicross_state : public driver_device
|
||||
public:
|
||||
seicross_state(const machine_config &mconfig, device_type type, const char *tag)
|
||||
: driver_device(mconfig, type, tag),
|
||||
m_spriteram(*this, "spriteram"),
|
||||
m_videoram(*this, "videoram"),
|
||||
m_row_scroll(*this, "row_scroll"),
|
||||
m_spriteram2(*this, "spriteram2"),
|
||||
m_colorram(*this, "colorram"),
|
||||
m_maincpu(*this, "maincpu"),
|
||||
m_mcu(*this, "mcu"),
|
||||
m_nvram(*this, "nvram"),
|
||||
m_gfxdecode(*this, "gfxdecode"),
|
||||
m_palette(*this, "palette") { }
|
||||
m_palette(*this, "palette"),
|
||||
m_spriteram(*this, "spriteram"),
|
||||
m_videoram(*this, "videoram"),
|
||||
m_row_scroll(*this, "row_scroll"),
|
||||
m_spriteram2(*this, "spriteram2"),
|
||||
m_colorram(*this, "colorram") { }
|
||||
|
||||
required_device<cpu_device> m_maincpu;
|
||||
required_device<cpu_device> m_mcu;
|
||||
optional_device<nvram_device> m_nvram;
|
||||
required_device<gfxdecode_device> m_gfxdecode;
|
||||
required_device<palette_device> m_palette;
|
||||
|
||||
required_shared_ptr<UINT8> m_spriteram;
|
||||
required_shared_ptr<UINT8> m_videoram;
|
||||
@ -24,25 +30,25 @@ public:
|
||||
|
||||
UINT8 m_portb;
|
||||
tilemap_t *m_bg_tilemap;
|
||||
void nvram_init(nvram_device &nvram, void *data, size_t size);
|
||||
|
||||
UINT8 m_irq_mask;
|
||||
DECLARE_WRITE8_MEMBER(seicross_videoram_w);
|
||||
DECLARE_WRITE8_MEMBER(seicross_colorram_w);
|
||||
DECLARE_READ8_MEMBER(friskyt_portB_r);
|
||||
DECLARE_WRITE8_MEMBER(friskyt_portB_w);
|
||||
|
||||
DECLARE_WRITE8_MEMBER(videoram_w);
|
||||
DECLARE_WRITE8_MEMBER(colorram_w);
|
||||
DECLARE_READ8_MEMBER(portB_r);
|
||||
DECLARE_WRITE8_MEMBER(portB_w);
|
||||
|
||||
TILE_GET_INFO_MEMBER(get_bg_tile_info);
|
||||
|
||||
INTERRUPT_GEN_MEMBER(vblank_irq);
|
||||
|
||||
virtual void machine_start();
|
||||
virtual void machine_reset();
|
||||
virtual void video_start();
|
||||
DECLARE_PALETTE_INIT(seicross);
|
||||
UINT32 screen_update_seicross(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
INTERRUPT_GEN_MEMBER(vblank_irq);
|
||||
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect );
|
||||
required_device<cpu_device> m_maincpu;
|
||||
required_device<cpu_device> m_mcu;
|
||||
optional_device<nvram_device> m_nvram;
|
||||
required_device<gfxdecode_device> m_gfxdecode;
|
||||
required_device<palette_device> m_palette;
|
||||
|
||||
DECLARE_DRIVER_INIT(friskytb);
|
||||
|
||||
UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect );
|
||||
|
||||
void nvram_init(nvram_device &nvram, void *data, size_t size);
|
||||
};
|
||||
|
@ -54,13 +54,13 @@ PALETTE_INIT_MEMBER(seicross_state, seicross)
|
||||
}
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(seicross_state::seicross_videoram_w)
|
||||
WRITE8_MEMBER(seicross_state::videoram_w)
|
||||
{
|
||||
m_videoram[offset] = data;
|
||||
m_bg_tilemap->mark_tile_dirty(offset);
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(seicross_state::seicross_colorram_w)
|
||||
WRITE8_MEMBER(seicross_state::colorram_w)
|
||||
{
|
||||
/* bit 5 of the address is not used for color memory. There is just */
|
||||
/* 512k of memory; every two consecutive rows share the same memory */
|
||||
@ -94,44 +94,42 @@ void seicross_state::video_start()
|
||||
|
||||
void seicross_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect )
|
||||
{
|
||||
UINT8 *spriteram = m_spriteram;
|
||||
UINT8 *spriteram_2 = m_spriteram2;
|
||||
int offs;
|
||||
|
||||
for (offs = m_spriteram.bytes() - 4; offs >= 0; offs -= 4)
|
||||
{
|
||||
int x = spriteram[offs + 3];
|
||||
int x = m_spriteram[offs + 3];
|
||||
m_gfxdecode->gfx(1)->transpen(bitmap,cliprect,
|
||||
(spriteram[offs] & 0x3f) + ((spriteram[offs + 1] & 0x10) << 2) + 128,
|
||||
spriteram[offs + 1] & 0x0f,
|
||||
spriteram[offs] & 0x40,spriteram[offs] & 0x80,
|
||||
x,240-spriteram[offs + 2],0);
|
||||
(m_spriteram[offs] & 0x3f) + ((m_spriteram[offs + 1] & 0x10) << 2) + 128,
|
||||
m_spriteram[offs + 1] & 0x0f,
|
||||
m_spriteram[offs] & 0x40,m_spriteram[offs] & 0x80,
|
||||
x,240-m_spriteram[offs + 2],0);
|
||||
if(x>0xf0)
|
||||
m_gfxdecode->gfx(1)->transpen(bitmap,cliprect,
|
||||
(spriteram[offs] & 0x3f) + ((spriteram[offs + 1] & 0x10) << 2) + 128,
|
||||
spriteram[offs + 1] & 0x0f,
|
||||
spriteram[offs] & 0x40,spriteram[offs] & 0x80,
|
||||
x-256,240-spriteram[offs + 2],0);
|
||||
(m_spriteram[offs] & 0x3f) + ((m_spriteram[offs + 1] & 0x10) << 2) + 128,
|
||||
m_spriteram[offs + 1] & 0x0f,
|
||||
m_spriteram[offs] & 0x40,m_spriteram[offs] & 0x80,
|
||||
x-256,240-m_spriteram[offs + 2],0);
|
||||
}
|
||||
|
||||
for (offs = m_spriteram2.bytes() - 4; offs >= 0; offs -= 4)
|
||||
{
|
||||
int x = spriteram_2[offs + 3];
|
||||
int x = m_spriteram2[offs + 3];
|
||||
m_gfxdecode->gfx(1)->transpen(bitmap,cliprect,
|
||||
(spriteram_2[offs] & 0x3f) + ((spriteram_2[offs + 1] & 0x10) << 2),
|
||||
spriteram_2[offs + 1] & 0x0f,
|
||||
spriteram_2[offs] & 0x40,spriteram_2[offs] & 0x80,
|
||||
x,240-spriteram_2[offs + 2],0);
|
||||
(m_spriteram2[offs] & 0x3f) + ((m_spriteram2[offs + 1] & 0x10) << 2),
|
||||
m_spriteram2[offs + 1] & 0x0f,
|
||||
m_spriteram2[offs] & 0x40,m_spriteram2[offs] & 0x80,
|
||||
x,240-m_spriteram2[offs + 2],0);
|
||||
if(x>0xf0)
|
||||
m_gfxdecode->gfx(1)->transpen(bitmap,cliprect,
|
||||
(spriteram_2[offs] & 0x3f) + ((spriteram_2[offs + 1] & 0x10) << 2),
|
||||
spriteram_2[offs + 1] & 0x0f,
|
||||
spriteram_2[offs] & 0x40,spriteram_2[offs] & 0x80,
|
||||
x-256,240-spriteram_2[offs + 2],0);
|
||||
(m_spriteram2[offs] & 0x3f) + ((m_spriteram2[offs + 1] & 0x10) << 2),
|
||||
m_spriteram2[offs + 1] & 0x0f,
|
||||
m_spriteram2[offs] & 0x40,m_spriteram2[offs] & 0x80,
|
||||
x-256,240-m_spriteram2[offs + 2],0);
|
||||
}
|
||||
}
|
||||
|
||||
UINT32 seicross_state::screen_update_seicross(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
UINT32 seicross_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
int col;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user