hyhoo.c, pastelg.c: added save state support (nw)

the 2 drivers look really similar, maybe merging could be explored..
This commit is contained in:
Osso13 2015-01-15 18:05:01 +01:00
parent 7d32bea42e
commit f7d888aa9d
6 changed files with 54 additions and 24 deletions

View File

@ -302,5 +302,5 @@ ROM_START( hyhoo2 )
ROM_END ROM_END
GAME( 1987, hyhoo, 0, hyhoo, hyhoo, driver_device, 0, ROT90, "Nichibutsu", "Hayaoshi Taisen Quiz Hyhoo (Japan)", 0 ) GAME( 1987, hyhoo, 0, hyhoo, hyhoo, driver_device, 0, ROT90, "Nichibutsu", "Hayaoshi Taisen Quiz Hyhoo (Japan)", GAME_SUPPORTS_SAVE )
GAME( 1987, hyhoo2, 0, hyhoo2, hyhoo2, driver_device, 0, ROT90, "Nichibutsu", "Hayaoshi Taisen Quiz Hyhoo 2 (Japan)", 0 ) GAME( 1987, hyhoo2, 0, hyhoo2, hyhoo2, driver_device, 0, ROT90, "Nichibutsu", "Hayaoshi Taisen Quiz Hyhoo 2 (Japan)", GAME_SUPPORTS_SAVE )

View File

@ -36,12 +36,16 @@ Memo:
#endif #endif
void pastelg_state::machine_start()
{
save_item(NAME(m_mux_data));
}
READ8_MEMBER(pastelg_state::pastelg_sndrom_r) READ8_MEMBER(pastelg_state::pastelg_sndrom_r)
{ {
UINT8 *ROM = memregion("voice")->base(); UINT8 *ROM = memregion("voice")->base();
return ROM[pastelg_blitter_src_addr_r(space) & 0x7fff]; return ROM[pastelg_blitter_src_addr_r() & 0x7fff];
} }
static ADDRESS_MAP_START( pastelg_map, AS_PROGRAM, 8, pastelg_state ) static ADDRESS_MAP_START( pastelg_map, AS_PROGRAM, 8, pastelg_state )
@ -66,7 +70,7 @@ static ADDRESS_MAP_START( pastelg_io_map, AS_IO, 8, pastelg_state )
AM_RANGE(0xa0, 0xa0) AM_DEVREADWRITE("nb1413m3", nb1413m3_device, inputport1_r, inputportsel_w) AM_RANGE(0xa0, 0xa0) AM_DEVREADWRITE("nb1413m3", nb1413m3_device, inputport1_r, inputportsel_w)
AM_RANGE(0xb0, 0xb0) AM_DEVREAD("nb1413m3", nb1413m3_device, inputport2_r) AM_WRITE(pastelg_romsel_w) AM_RANGE(0xb0, 0xb0) AM_DEVREAD("nb1413m3", nb1413m3_device, inputport2_r) AM_WRITE(pastelg_romsel_w)
AM_RANGE(0xc0, 0xc0) AM_READ(pastelg_sndrom_r) AM_RANGE(0xc0, 0xc0) AM_READ(pastelg_sndrom_r)
AM_RANGE(0xc0, 0xcf) AM_WRITE(pastelg_clut_w) AM_RANGE(0xc0, 0xcf) AM_WRITEONLY AM_SHARE("clut")
AM_RANGE(0xd0, 0xd0) AM_READ(pastelg_irq_ack_r) AM_DEVWRITE("dac", dac_device, write_unsigned8) AM_RANGE(0xd0, 0xd0) AM_READ(pastelg_irq_ack_r) AM_DEVWRITE("dac", dac_device, write_unsigned8)
AM_RANGE(0xe0, 0xe0) AM_READ_PORT("DSWC") AM_RANGE(0xe0, 0xe0) AM_READ_PORT("DSWC")
ADDRESS_MAP_END ADDRESS_MAP_END
@ -118,7 +122,7 @@ static ADDRESS_MAP_START( threeds_io_map, AS_IO, 8, pastelg_state )
AM_RANGE(0xf0, 0xf6) AM_WRITE(pastelg_blitter_w) AM_RANGE(0xf0, 0xf6) AM_WRITE(pastelg_blitter_w)
AM_RANGE(0xa0, 0xa0) AM_READWRITE(threeds_inputport1_r, threeds_inputportsel_w) AM_RANGE(0xa0, 0xa0) AM_READWRITE(threeds_inputport1_r, threeds_inputportsel_w)
AM_RANGE(0xb0, 0xb0) AM_READ(threeds_inputport2_r) AM_WRITE(threeds_output_w)//writes: bit 3 is coin lockout, bit 1 is coin counter AM_RANGE(0xb0, 0xb0) AM_READ(threeds_inputport2_r) AM_WRITE(threeds_output_w)//writes: bit 3 is coin lockout, bit 1 is coin counter
AM_RANGE(0xc0, 0xcf) AM_WRITE(pastelg_clut_w) AM_RANGE(0xc0, 0xcf) AM_WRITEONLY AM_SHARE("clut")
AM_RANGE(0xc0, 0xc0) AM_READ(threeds_rom_readback_r) AM_RANGE(0xc0, 0xc0) AM_READ(threeds_rom_readback_r)
AM_RANGE(0xd0, 0xd0) AM_READ(pastelg_irq_ack_r) AM_DEVWRITE("dac", dac_device, write_unsigned8) AM_RANGE(0xd0, 0xd0) AM_READ(pastelg_irq_ack_r) AM_DEVWRITE("dac", dac_device, write_unsigned8)
ADDRESS_MAP_END ADDRESS_MAP_END
@ -559,6 +563,6 @@ ROM_END
GAME( 1985, pastelg, 0, pastelg, pastelg, driver_device, 0, ROT0, "Nichibutsu", "Pastel Gal (Japan 851224)", 0 ) GAME( 1985, pastelg, 0, pastelg, pastelg, driver_device, 0, ROT0, "Nichibutsu", "Pastel Gal (Japan 851224)", GAME_SUPPORTS_SAVE )
GAME( 1985, threeds, 0, threeds, threeds, driver_device, 0, ROT0, "Nichibutsu", "Three Ds - Three Dealers Casino House", 0 ) GAME( 1985, threeds, 0, threeds, threeds, driver_device, 0, ROT0, "Nichibutsu", "Three Ds - Three Dealers Casino House", GAME_SUPPORTS_SAVE )
GAME( 1985, galds, threeds, threeds, galds, driver_device, 0, ROT0, "Nihon System Corp.", "Gals Ds - Three Dealers Casino House (bootleg?)", 0 ) GAME( 1985, galds, threeds, threeds, galds, driver_device, 0, ROT0, "Nihon System Corp.", "Gals Ds - Three Dealers Casino House (bootleg?)", GAME_SUPPORTS_SAVE )

View File

@ -10,15 +10,15 @@ public:
hyhoo_state(const machine_config &mconfig, device_type type, const char *tag) hyhoo_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag), : driver_device(mconfig, type, tag),
m_clut(*this, "clut"),
m_maincpu(*this, "maincpu"), m_maincpu(*this, "maincpu"),
m_nb1413m3(*this, "nb1413m3"), m_nb1413m3(*this, "nb1413m3"),
m_screen(*this, "screen") { } m_screen(*this, "screen"),
m_clut(*this, "clut") { }
required_shared_ptr<UINT8> m_clut;
required_device<cpu_device> m_maincpu; required_device<cpu_device> m_maincpu;
required_device<nb1413m3_device> m_nb1413m3; required_device<nb1413m3_device> m_nb1413m3;
required_device<screen_device> m_screen; required_device<screen_device> m_screen;
required_shared_ptr<UINT8> m_clut;
int m_blitter_destx; int m_blitter_destx;
int m_blitter_desty; int m_blitter_desty;
@ -32,10 +32,14 @@ public:
int m_highcolorflag; int m_highcolorflag;
int m_flipscreen; int m_flipscreen;
bitmap_rgb32 m_tmpbitmap; bitmap_rgb32 m_tmpbitmap;
DECLARE_WRITE8_MEMBER(hyhoo_blitter_w); DECLARE_WRITE8_MEMBER(hyhoo_blitter_w);
DECLARE_WRITE8_MEMBER(hyhoo_romsel_w); DECLARE_WRITE8_MEMBER(hyhoo_romsel_w);
DECLARE_CUSTOM_INPUT_MEMBER(nb1413m3_busyflag_r); DECLARE_CUSTOM_INPUT_MEMBER(nb1413m3_busyflag_r);
virtual void video_start(); virtual void video_start();
UINT32 screen_update_hyhoo(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); UINT32 screen_update_hyhoo(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
void hyhoo_gfxdraw(); void hyhoo_gfxdraw();

View File

@ -12,11 +12,13 @@ public:
: driver_device(mconfig, type, tag) , : driver_device(mconfig, type, tag) ,
m_maincpu(*this, "maincpu"), m_maincpu(*this, "maincpu"),
m_nb1413m3(*this, "nb1413m3"), m_nb1413m3(*this, "nb1413m3"),
m_screen(*this, "screen") { } m_screen(*this, "screen"),
m_clut(*this, "clut") { }
required_device<cpu_device> m_maincpu; required_device<cpu_device> m_maincpu;
required_device<nb1413m3_device> m_nb1413m3; required_device<nb1413m3_device> m_nb1413m3;
required_device<screen_device> m_screen; required_device<screen_device> m_screen;
required_shared_ptr<UINT8> m_clut;
UINT8 m_mux_data; UINT8 m_mux_data;
int m_blitter_destx; int m_blitter_destx;
@ -31,25 +33,28 @@ public:
int m_blitter_direction_y; int m_blitter_direction_y;
int m_palbank; int m_palbank;
UINT8 *m_videoram; UINT8 *m_videoram;
UINT8 *m_clut;
int m_flipscreen_old; int m_flipscreen_old;
DECLARE_READ8_MEMBER(pastelg_sndrom_r); DECLARE_READ8_MEMBER(pastelg_sndrom_r);
DECLARE_READ8_MEMBER(pastelg_irq_ack_r); DECLARE_READ8_MEMBER(pastelg_irq_ack_r);
DECLARE_READ8_MEMBER(threeds_inputport1_r); DECLARE_READ8_MEMBER(threeds_inputport1_r);
DECLARE_READ8_MEMBER(threeds_inputport2_r); DECLARE_READ8_MEMBER(threeds_inputport2_r);
DECLARE_WRITE8_MEMBER(threeds_inputportsel_w); DECLARE_WRITE8_MEMBER(threeds_inputportsel_w);
DECLARE_WRITE8_MEMBER(pastelg_clut_w);
DECLARE_WRITE8_MEMBER(pastelg_blitter_w); DECLARE_WRITE8_MEMBER(pastelg_blitter_w);
DECLARE_WRITE8_MEMBER(threeds_romsel_w); DECLARE_WRITE8_MEMBER(threeds_romsel_w);
DECLARE_WRITE8_MEMBER(threeds_output_w); DECLARE_WRITE8_MEMBER(threeds_output_w);
DECLARE_READ8_MEMBER(threeds_rom_readback_r); DECLARE_READ8_MEMBER(threeds_rom_readback_r);
DECLARE_WRITE8_MEMBER(pastelg_romsel_w); DECLARE_WRITE8_MEMBER(pastelg_romsel_w);
DECLARE_CUSTOM_INPUT_MEMBER(nb1413m3_busyflag_r); DECLARE_CUSTOM_INPUT_MEMBER(nb1413m3_busyflag_r);
DECLARE_CUSTOM_INPUT_MEMBER(nb1413m3_hackbusyflag_r); DECLARE_CUSTOM_INPUT_MEMBER(nb1413m3_hackbusyflag_r);
virtual void machine_start();
virtual void video_start(); virtual void video_start();
DECLARE_PALETTE_INIT(pastelg); DECLARE_PALETTE_INIT(pastelg);
UINT32 screen_update_pastelg(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_pastelg(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
int pastelg_blitter_src_addr_r(address_space &space); int pastelg_blitter_src_addr_r();
void pastelg_vramflip(); void pastelg_vramflip();
void pastelg_gfxdraw(); void pastelg_gfxdraw();
@ -57,5 +62,3 @@ protected:
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
}; };
/*----------- defined in video/pastelg.c -----------*/
int pastelg_blitter_src_addr_r(address_space &space);

View File

@ -226,6 +226,18 @@ void hyhoo_state::hyhoo_gfxdraw()
void hyhoo_state::video_start() void hyhoo_state::video_start()
{ {
m_screen->register_screen_bitmap(m_tmpbitmap); m_screen->register_screen_bitmap(m_tmpbitmap);
save_item(NAME(m_blitter_destx));
save_item(NAME(m_blitter_desty));
save_item(NAME(m_blitter_sizex));
save_item(NAME(m_blitter_sizey));
save_item(NAME(m_blitter_src_addr));
save_item(NAME(m_blitter_direction_x));
save_item(NAME(m_blitter_direction_y));
save_item(NAME(m_gfxrom));
save_item(NAME(m_dispflag));
save_item(NAME(m_highcolorflag));
save_item(NAME(m_flipscreen));
save_item(NAME(m_tmpbitmap));
} }

View File

@ -42,16 +42,11 @@ PALETTE_INIT_MEMBER(pastelg_state, pastelg)
} }
} }
WRITE8_MEMBER(pastelg_state::pastelg_clut_w)
{
m_clut[offset] = data;
}
/****************************************************************************** /******************************************************************************
******************************************************************************/ ******************************************************************************/
int pastelg_state::pastelg_blitter_src_addr_r(address_space &space) int pastelg_state::pastelg_blitter_src_addr_r()
{ {
return m_blitter_src_addr; return m_blitter_src_addr;
} }
@ -288,7 +283,19 @@ void pastelg_state::video_start()
int height = m_screen->height(); int height = m_screen->height();
m_videoram = auto_alloc_array_clear(machine(), UINT8, width * height); m_videoram = auto_alloc_array_clear(machine(), UINT8, width * height);
m_clut = auto_alloc_array(machine(), UINT8, 0x10);
save_item(NAME(m_blitter_desty));
save_item(NAME(m_blitter_sizex));
save_item(NAME(m_blitter_sizey));
save_item(NAME(m_blitter_src_addr));
save_item(NAME(m_gfxrom));
save_item(NAME(m_dispflag));
save_item(NAME(m_flipscreen));
save_item(NAME(m_blitter_direction_x));
save_item(NAME(m_blitter_direction_y));
save_item(NAME(m_palbank));
save_pointer(NAME(m_videoram), width*height);
save_item(NAME(m_flipscreen_old));
} }
/****************************************************************************** /******************************************************************************