Previous 199869 Revisions Next

r36637 Wednesday 25th March, 2015 at 18:29:56 UTC by Osso
rmhaihai.c: added save state support (nw)
[src/mame/drivers]rmhaihai.c

trunk/src/mame/drivers/rmhaihai.c
r245148r245149
3939public:
4040   rmhaihai_state(const machine_config &mconfig, device_type type, const char *tag)
4141      : driver_device(mconfig, type, tag),
42      m_colorram(*this, "colorram"),
43      m_videoram(*this, "videoram"),
4442      m_maincpu(*this, "maincpu"),
4543      m_msm(*this, "msm"),
46      m_gfxdecode(*this, "gfxdecode") { }
44      m_gfxdecode(*this, "gfxdecode"),
45      m_colorram(*this, "colorram"),
46      m_videoram(*this, "videoram") { }
4747
48   int m_gfxbank;
48   required_device<cpu_device> m_maincpu;
49   required_device<msm5205_device> m_msm;
50   required_device<gfxdecode_device> m_gfxdecode;
51
4952   required_shared_ptr<UINT8> m_colorram;
5053   required_shared_ptr<UINT8> m_videoram;
54
5155   tilemap_t *m_bg_tilemap;
5256   int m_keyboard_cmd;
57   int m_gfxbank;
58
5359   DECLARE_WRITE8_MEMBER(rmhaihai_videoram_w);
5460   DECLARE_WRITE8_MEMBER(rmhaihai_colorram_w);
5561   DECLARE_READ8_MEMBER(keyboard_r);
r245148r245149
5864   DECLARE_WRITE8_MEMBER(ctrl_w);
5965   DECLARE_WRITE8_MEMBER(themj_rombank_w);
6066   DECLARE_WRITE8_MEMBER(adpcm_w);
67
6168   DECLARE_DRIVER_INIT(rmhaihai);
62   TILE_GET_INFO_MEMBER(get_bg_tile_info);
6369   virtual void video_start();
70   DECLARE_MACHINE_START(themj);
6471   DECLARE_MACHINE_RESET(themj);
65   UINT32 screen_update_rmhaihai(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
66   required_device<cpu_device> m_maincpu;
67   required_device<msm5205_device> m_msm;
68   required_device<gfxdecode_device> m_gfxdecode;
72
73   UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
74   
75   TILE_GET_INFO_MEMBER(get_bg_tile_info);
6976};
7077
7178
r245148r245149
95102{
96103   m_bg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(rmhaihai_state::get_bg_tile_info),this), TILEMAP_SCAN_ROWS,
97104      8, 8, 64, 32);
105     
106   save_item(NAME(m_keyboard_cmd));
107   save_item(NAME(m_gfxbank));
98108}
99109
100UINT32 rmhaihai_state::screen_update_rmhaihai(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
110UINT32 rmhaihai_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
101111{
102112   m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
103113   return 0;
r245148r245149
190200
191201WRITE8_MEMBER(rmhaihai_state::themj_rombank_w)
192202{
193   UINT8 *rom = memregion("maincpu")->base() + 0x10000;
194   int bank = data & 0x03;
195logerror("banksw %d\n",bank);
196   membank("bank1")->set_base(rom + bank*0x4000);
197   membank("bank2")->set_base(rom + bank*0x4000 + 0x2000);
203   logerror("banksw %d\n", data & 0x03);
204   membank("bank1")->set_entry(data & 0x03);
205   membank("bank2")->set_entry(data & 0x03);
198206}
199207
208MACHINE_START_MEMBER(rmhaihai_state,themj)
209{
210   membank("bank1")->configure_entries(0, 4, memregion("maincpu")->base() + 0x10000, 0x4000);
211   membank("bank2")->configure_entries(0, 4, memregion("maincpu")->base() + 0x12000, 0x4000);
212}
213
200214MACHINE_RESET_MEMBER(rmhaihai_state,themj)
201215{
202   themj_rombank_w(m_maincpu->space(AS_IO), 0, 0);
216   membank("bank1")->set_entry(0);
217   membank("bank2")->set_entry(0);
203218}
204219
205220
r245148r245149
465480   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
466481   MCFG_SCREEN_SIZE(64*8, 32*8)
467482   MCFG_SCREEN_VISIBLE_AREA(4*8, 60*8-1, 2*8, 30*8-1)
468   MCFG_SCREEN_UPDATE_DRIVER(rmhaihai_state, screen_update_rmhaihai)
483   MCFG_SCREEN_UPDATE_DRIVER(rmhaihai_state, screen_update)
469484   MCFG_SCREEN_PALETTE("palette")
470485
471486   MCFG_GFXDECODE_ADD("gfxdecode", "palette", rmhaihai)
r245148r245149
503518   MCFG_CPU_PROGRAM_MAP(themj_map)
504519   MCFG_CPU_IO_MAP(themj_io_map)
505520
521   MCFG_MACHINE_START_OVERRIDE(rmhaihai_state,themj)
506522   MCFG_MACHINE_RESET_OVERRIDE(rmhaihai_state,themj)
507523
508524   /* video hardware */
r245148r245149
678694}
679695
680696
681GAME( 1985, rmhaihai, 0,        rmhaihai, rmhaihai, rmhaihai_state, rmhaihai, ROT0, "Alba",  "Real Mahjong Haihai (Japan)", 0 )
682GAME( 1985, rmhaihib, rmhaihai, rmhaihai, rmhaihib, rmhaihai_state, rmhaihai, ROT0, "Alba",  "Real Mahjong Haihai [BET] (Japan)", 0 )
683GAME( 1986, rmhaijin, 0,        rmhaihai, rmhaihai, rmhaihai_state, rmhaihai, ROT0, "Alba",  "Real Mahjong Haihai Jinji Idou Hen (Japan)", 0 )
684GAME( 1986, rmhaisei, 0,        rmhaisei, rmhaihai, rmhaihai_state, rmhaihai, ROT0, "Visco", "Real Mahjong Haihai Seichouhen (Japan)", 0 )
685GAME( 1987, themj,    0,        themj,    rmhaihai, rmhaihai_state, rmhaihai, ROT0, "Visco", "The Mah-jong (Japan)", 0 )
697GAME( 1985, rmhaihai, 0,        rmhaihai, rmhaihai, rmhaihai_state, rmhaihai, ROT0, "Alba",  "Real Mahjong Haihai (Japan)", GAME_SUPPORTS_SAVE )
698GAME( 1985, rmhaihib, rmhaihai, rmhaihai, rmhaihib, rmhaihai_state, rmhaihai, ROT0, "Alba",  "Real Mahjong Haihai [BET] (Japan)", GAME_SUPPORTS_SAVE )
699GAME( 1986, rmhaijin, 0,        rmhaihai, rmhaihai, rmhaihai_state, rmhaihai, ROT0, "Alba",  "Real Mahjong Haihai Jinji Idou Hen (Japan)", GAME_SUPPORTS_SAVE )
700GAME( 1986, rmhaisei, 0,        rmhaisei, rmhaihai, rmhaihai_state, rmhaihai, ROT0, "Visco", "Real Mahjong Haihai Seichouhen (Japan)", GAME_SUPPORTS_SAVE )
701GAME( 1987, themj,    0,        themj,    rmhaihai, rmhaihai_state, rmhaihai, ROT0, "Visco", "The Mah-jong (Japan)", GAME_SUPPORTS_SAVE )


Previous 199869 Revisions Next


© 1997-2024 The MAME Team