mirror of
https://github.com/holub/mame
synced 2025-07-05 09:57:47 +03:00
sanremo.cpp: output_finder, save state support (nw)
This commit is contained in:
parent
6f28659d1a
commit
dad267593a
@ -115,23 +115,30 @@ public:
|
||||
: driver_device(mconfig, type, tag),
|
||||
m_videoram(*this, "videoram"),
|
||||
m_maincpu(*this, "maincpu"),
|
||||
m_gfxdecode(*this, "gfxdecode") { }
|
||||
m_gfxdecode(*this, "gfxdecode"),
|
||||
m_lamps(*this, "lamp%u", 0U) { }
|
||||
|
||||
void sanremo(machine_config &config);
|
||||
|
||||
protected:
|
||||
virtual void video_start() override;
|
||||
|
||||
private:
|
||||
required_shared_ptr<uint8_t> m_videoram;
|
||||
required_device<cpu_device> m_maincpu;
|
||||
required_device<gfxdecode_device> m_gfxdecode;
|
||||
output_finder<7> m_lamps;
|
||||
|
||||
uint8_t m_attrram[0x800];
|
||||
tilemap_t *m_bg_tilemap;
|
||||
DECLARE_WRITE8_MEMBER(sanremo_videoram_w);
|
||||
TILE_GET_INFO_MEMBER(get_sanremo_tile_info);
|
||||
uint8_t m_banksel;
|
||||
|
||||
DECLARE_WRITE8_MEMBER(videoram_w);
|
||||
TILE_GET_INFO_MEMBER(get_tile_info);
|
||||
DECLARE_WRITE8_MEMBER(banksel_w);
|
||||
DECLARE_WRITE8_MEMBER(lamps_w);
|
||||
int banksel;
|
||||
virtual void video_start() override;
|
||||
DECLARE_PALETTE_INIT(sanremo);
|
||||
uint32_t screen_update_sanremo(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
required_device<cpu_device> m_maincpu;
|
||||
required_device<gfxdecode_device> m_gfxdecode;
|
||||
void sanremo(machine_config &config);
|
||||
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
void sanremo_map(address_map &map);
|
||||
void sanremo_portmap(address_map &map);
|
||||
};
|
||||
@ -142,14 +149,14 @@ public:
|
||||
*********************************************/
|
||||
|
||||
|
||||
WRITE8_MEMBER(sanremo_state::sanremo_videoram_w)
|
||||
WRITE8_MEMBER(sanremo_state::videoram_w)
|
||||
{
|
||||
m_videoram[offset] = data;
|
||||
m_attrram[offset] = banksel;
|
||||
m_attrram[offset] = m_banksel;
|
||||
m_bg_tilemap->mark_tile_dirty(offset);
|
||||
}
|
||||
|
||||
TILE_GET_INFO_MEMBER(sanremo_state::get_sanremo_tile_info)
|
||||
TILE_GET_INFO_MEMBER(sanremo_state::get_tile_info)
|
||||
{
|
||||
int code = m_videoram[tile_index];
|
||||
int bank = m_attrram[tile_index];
|
||||
@ -159,11 +166,15 @@ TILE_GET_INFO_MEMBER(sanremo_state::get_sanremo_tile_info)
|
||||
|
||||
void sanremo_state::video_start()
|
||||
{
|
||||
m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(sanremo_state::get_sanremo_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 48, 40);
|
||||
m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(sanremo_state::get_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 48, 40);
|
||||
|
||||
m_lamps.resolve();
|
||||
|
||||
save_item(NAME(m_attrram));
|
||||
save_item(NAME(m_banksel));
|
||||
}
|
||||
|
||||
uint32_t sanremo_state::screen_update_sanremo(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
uint32_t sanremo_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
|
||||
return 0;
|
||||
@ -199,13 +210,8 @@ WRITE8_MEMBER(sanremo_state::lamps_w)
|
||||
-x-- ---- BET
|
||||
x--- ---- (always on)
|
||||
*/
|
||||
output().set_lamp_value(0, (data >> 0) & 1); /* DISCARD 1 */
|
||||
output().set_lamp_value(1, (data >> 1) & 1); /* DISCARD 2 */
|
||||
output().set_lamp_value(2, (data >> 2) & 1); /* DISCARD 3 */
|
||||
output().set_lamp_value(3, (data >> 3) & 1); /* DISCARD 4 */
|
||||
output().set_lamp_value(4, (data >> 4) & 1); /* DISCARD 5 */
|
||||
output().set_lamp_value(5, (data >> 5) & 1); /* START */
|
||||
output().set_lamp_value(6, (data >> 6) & 1); /* BET */
|
||||
for (int n = 0; n < 7; n++)
|
||||
m_lamps[n] = BIT(data, n);
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(sanremo_state::banksel_w)
|
||||
@ -216,7 +222,7 @@ WRITE8_MEMBER(sanremo_state::banksel_w)
|
||||
---x xxxx GFX banks selector
|
||||
xxx- ---- unknown
|
||||
*/
|
||||
banksel = data & 0x1f;
|
||||
m_banksel = data & 0x1f;
|
||||
}
|
||||
|
||||
|
||||
@ -227,7 +233,7 @@ WRITE8_MEMBER(sanremo_state::banksel_w)
|
||||
void sanremo_state::sanremo_map(address_map &map)
|
||||
{
|
||||
map(0x0000, 0x7fff).rom();
|
||||
map(0x8000, 0x87ff).ram().w(this, FUNC(sanremo_state::sanremo_videoram_w)).share("videoram"); // 2x 76C28 (1x accessed directly, latched bank written to other like subsino etc.)
|
||||
map(0x8000, 0x87ff).ram().w(this, FUNC(sanremo_state::videoram_w)).share("videoram"); // 2x 76C28 (1x accessed directly, latched bank written to other like subsino etc.)
|
||||
map(0xc000, 0xc7ff).ram().share("nvram"); // battery backed UM6116
|
||||
}
|
||||
|
||||
@ -363,7 +369,7 @@ MACHINE_CONFIG_START(sanremo_state::sanremo)
|
||||
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
|
||||
MCFG_SCREEN_SIZE(70*8, 41*8)
|
||||
MCFG_SCREEN_VISIBLE_AREA(0, 48*8-1, 0, 38*8-1)
|
||||
MCFG_SCREEN_UPDATE_DRIVER(sanremo_state, screen_update_sanremo)
|
||||
MCFG_SCREEN_UPDATE_DRIVER(sanremo_state, screen_update)
|
||||
MCFG_SCREEN_PALETTE("palette")
|
||||
|
||||
MCFG_MC6845_ADD("crtc", MC6845, "screen", CRTC_CLOCK)
|
||||
@ -414,5 +420,5 @@ ROM_END
|
||||
* Game Drivers *
|
||||
*********************************************/
|
||||
|
||||
// YEAR NAME PARENT MACHINE INPUT STATE INIT ROT COMPANY FULLNAME FLAGS LAYOUT
|
||||
GAMEL( 1996, number1, 0, sanremo, number1, sanremo_state, 0, ROT0, "San Remo Games", "Number One", 0, layout_sanremo )
|
||||
// YEAR NAME PARENT MACHINE INPUT STATE INIT ROT COMPANY FULLNAME FLAGS LAYOUT
|
||||
GAMEL( 1996, number1, 0, sanremo, number1, sanremo_state, 0, ROT0, "San Remo Games", "Number One", MACHINE_SUPPORTS_SAVE, layout_sanremo )
|
||||
|
Loading…
Reference in New Issue
Block a user