Previous 199869 Revisions Next

r34839 Wednesday 4th February, 2015 at 18:31:41 UTC by Osso
toki.c: added save state support (nw)
[src/mame/drivers]toki.c
[src/mame/includes]toki.h
[src/mame/video]toki.c

trunk/src/mame/drivers/toki.c
r243350r243351
9191   AM_RANGE(0x060000, 0x06d7ff) AM_RAM
9292   AM_RANGE(0x06d800, 0x06dfff) AM_RAM AM_SHARE("spriteram")
9393   AM_RANGE(0x06e000, 0x06e7ff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette")
94   AM_RANGE(0x06e800, 0x06efff) AM_RAM_WRITE(toki_background1_videoram16_w) AM_SHARE("bg1_vram16")
95   AM_RANGE(0x06f000, 0x06f7ff) AM_RAM_WRITE(toki_background2_videoram16_w) AM_SHARE("bg2_vram16")
96   AM_RANGE(0x06f800, 0x06ffff) AM_RAM_WRITE(toki_foreground_videoram16_w) AM_SHARE("videoram")
94   AM_RANGE(0x06e800, 0x06efff) AM_RAM_WRITE(background1_videoram_w) AM_SHARE("bg1_vram")
95   AM_RANGE(0x06f000, 0x06f7ff) AM_RAM_WRITE(background2_videoram_w) AM_SHARE("bg2_vram")
96   AM_RANGE(0x06f800, 0x06ffff) AM_RAM_WRITE(foreground_videoram_w) AM_SHARE("videoram")
9797   AM_RANGE(0x080000, 0x08000d) AM_DEVREADWRITE("seibu_sound", seibu_sound_device, main_word_r, main_word_w)
98   AM_RANGE(0x0a0000, 0x0a005f) AM_WRITE(toki_control_w) AM_SHARE("scrollram16")
98   AM_RANGE(0x0a0000, 0x0a005f) AM_WRITE(toki_control_w) AM_SHARE("scrollram")
9999   AM_RANGE(0x0c0000, 0x0c0001) AM_READ_PORT("DSW")
100100   AM_RANGE(0x0c0002, 0x0c0003) AM_READ_PORT("INPUTS")
101101   AM_RANGE(0x0c0004, 0x0c0005) AM_READ_PORT("SYSTEM")
r243350r243351
106106   AM_RANGE(0x000000, 0x05ffff) AM_ROM
107107   AM_RANGE(0x060000, 0x06dfff) AM_RAM
108108   AM_RANGE(0x06e000, 0x06e7ff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette")
109   AM_RANGE(0x06e800, 0x06efff) AM_RAM_WRITE(toki_background1_videoram16_w) AM_SHARE("bg1_vram16")
110   AM_RANGE(0x06f000, 0x06f7ff) AM_RAM_WRITE(toki_background2_videoram16_w) AM_SHARE("bg2_vram16")
111   AM_RANGE(0x06f800, 0x06ffff) AM_RAM_WRITE(toki_foreground_videoram16_w) AM_SHARE("videoram")
109   AM_RANGE(0x06e800, 0x06efff) AM_RAM_WRITE(background1_videoram_w) AM_SHARE("bg1_vram")
110   AM_RANGE(0x06f000, 0x06f7ff) AM_RAM_WRITE(background2_videoram_w) AM_SHARE("bg2_vram")
111   AM_RANGE(0x06f800, 0x06ffff) AM_RAM_WRITE(foreground_videoram_w) AM_SHARE("videoram")
112112   AM_RANGE(0x071000, 0x071001) AM_WRITENOP    /* sprite related? seems another scroll register */
113113            /* gets written the same value as 75000a (bg2 scrollx) */
114114   AM_RANGE(0x071804, 0x071807) AM_WRITENOP    /* sprite related, always 01be0100 */
115115   AM_RANGE(0x07180e, 0x071e45) AM_WRITEONLY AM_SHARE("spriteram")
116116   AM_RANGE(0x072000, 0x072001) AM_READ(watchdog_reset16_r)   /* probably */
117117   AM_RANGE(0x075000, 0x075001) AM_WRITE(tokib_soundcommand16_w)
118   AM_RANGE(0x075004, 0x07500b) AM_WRITEONLY AM_SHARE("scrollram16")
118   AM_RANGE(0x075004, 0x07500b) AM_WRITEONLY AM_SHARE("scrollram")
119119   AM_RANGE(0x0c0000, 0x0c0001) AM_READ_PORT("DSW")
120120   AM_RANGE(0x0c0002, 0x0c0003) AM_READ_PORT("INPUTS")
121121   AM_RANGE(0x0c0004, 0x0c0005) AM_READ_PORT("SYSTEM")
r243350r243351
826826         memcpy (&base[0x18000 + i * 0x800], &temp[0x1800 + i * 0x2000], 0x800);
827827      }
828828   }
829   
830   save_item(NAME(m_msm5205next));
831   save_item(NAME(m_toggle));
829832}
830833
831834DRIVER_INIT_MEMBER(toki_state,jujuba)
r243350r243351
877880
878881
879882// these 2 are both unique revisions
880GAME( 1989, toki,  0,    toki,  toki, toki_state,  toki,  ROT0, "TAD Corporation", "Toki (World, set 1)", 0 )
881GAME( 1989, tokiu, toki, toki,  toki, toki_state,  toki,  ROT0, "TAD Corporation (Fabtek license)", "Toki (US, set 1)", 0 )
883GAME( 1989, toki,  0,    toki,  toki, toki_state,  toki,  ROT0, "TAD Corporation", "Toki (World, set 1)", GAME_SUPPORTS_SAVE )
884GAME( 1989, tokiu, toki, toki,  toki, toki_state,  toki,  ROT0, "TAD Corporation (Fabtek license)", "Toki (US, set 1)", GAME_SUPPORTS_SAVE )
882885
883886// these 3 are all the same revision, only the region byte differs
884GAME( 1989, tokia, toki, toki,  toki, toki_state,  toki,  ROT0, "TAD Corporation", "Toki (World, set 2)", 0 )
885GAME( 1989, tokiua,toki, toki,  toki, toki_state,  toki,  ROT0, "TAD Corporation (Fabtek license)", "Toki (US, set 2)", 0 )
886GAME( 1989, juju,  toki, toki,  toki, toki_state,  toki,  ROT0, "TAD Corporation", "JuJu Densetsu (Japan)", 0 )
887GAME( 1989, tokia, toki, toki,  toki, toki_state,  toki,  ROT0, "TAD Corporation", "Toki (World, set 2)", GAME_SUPPORTS_SAVE )
888GAME( 1989, tokiua,toki, toki,  toki, toki_state,  toki,  ROT0, "TAD Corporation (Fabtek license)", "Toki (US, set 2)", GAME_SUPPORTS_SAVE )
889GAME( 1989, juju,  toki, toki,  toki, toki_state,  toki,  ROT0, "TAD Corporation", "JuJu Densetsu (Japan)", GAME_SUPPORTS_SAVE )
887890
888GAME( 1990, tokib,  toki, tokib, tokib, toki_state, tokib, ROT0, "bootleg (Datsu)", "Toki (Datsu bootleg)", 0 )
889GAME( 1990, jujub,  toki, tokib, tokib, toki_state, tokib, ROT0, "bootleg (Playmark)", "JuJu Densetsu (Playmark bootleg)", 0 )
891GAME( 1990, tokib,  toki, tokib, tokib, toki_state, tokib, ROT0, "bootleg (Datsu)", "Toki (Datsu bootleg)", GAME_SUPPORTS_SAVE )
892GAME( 1990, jujub,  toki, tokib, tokib, toki_state, tokib, ROT0, "bootleg (Playmark)", "JuJu Densetsu (Playmark bootleg)", GAME_SUPPORTS_SAVE )
890893/* Sound hardware seems to have been slightly modified, the coins are handled ok, but there is no music and bad sfx.  Program roms have a slight bitswap, Flipscreen also seems to be ignored */
891GAME( 1989, jujuba, toki, toki,  toki, toki_state,  jujuba, ROT180, "bootleg", "JuJu Densetsu (Japan, bootleg)", GAME_IMPERFECT_SOUND ) // bootleg of tokia/juju revison
894GAME( 1989, jujuba, toki, toki,  toki, toki_state,  jujuba, ROT180, "bootleg", "JuJu Densetsu (Japan, bootleg)", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE ) // bootleg of tokia/juju revison
trunk/src/mame/includes/toki.h
r243350r243351
77public:
88   toki_state(const machine_config &mconfig, device_type type, const char *tag)
99      : driver_device(mconfig, type, tag),
10         m_spriteram(*this, "spriteram") ,
11      m_background1_videoram16(*this, "bg1_vram16"),
12      m_background2_videoram16(*this, "bg2_vram16"),
13      m_videoram(*this, "videoram"),
14      m_scrollram16(*this, "scrollram16"),
1510      m_maincpu(*this, "maincpu"),
1611      m_audiocpu(*this, "audiocpu"),
1712      m_seibu_sound(*this, "seibu_sound"),
1813      m_msm(*this, "msm"),
1914      m_gfxdecode(*this, "gfxdecode"),
2015      m_screen(*this, "screen"),
21      m_palette(*this, "palette") { }
16      m_palette(*this, "palette"),
17      m_spriteram(*this, "spriteram") ,
18      m_background1_videoram(*this, "bg1_vram"),
19      m_background2_videoram(*this, "bg2_vram"),
20      m_videoram(*this, "videoram"),
21      m_scrollram(*this, "scrollram") { }
2222
23   required_device<buffered_spriteram16_device> m_spriteram;
24   required_shared_ptr<UINT16> m_background1_videoram16;
25   required_shared_ptr<UINT16> m_background2_videoram16;
26   required_shared_ptr<UINT16> m_videoram;
27   required_shared_ptr<UINT16> m_scrollram16;
28
2923   required_device<cpu_device> m_maincpu;
3024   required_device<cpu_device> m_audiocpu;
3125   optional_device<seibu_sound_device> m_seibu_sound;
r243350r243351
3428   required_device<screen_device> m_screen;
3529   required_device<palette_device> m_palette;
3630
31   required_device<buffered_spriteram16_device> m_spriteram;
32   required_shared_ptr<UINT16> m_background1_videoram;
33   required_shared_ptr<UINT16> m_background2_videoram;
34   required_shared_ptr<UINT16> m_videoram;
35   required_shared_ptr<UINT16> m_scrollram;
36
3737   int m_msm5205next;
3838   int m_toggle;
39
3940   tilemap_t *m_background_layer;
4041   tilemap_t *m_foreground_layer;
4142   tilemap_t *m_text_layer;
4243
43   DECLARE_WRITE16_MEMBER(tokib_soundcommand16_w);
44   DECLARE_READ16_MEMBER(pip16_r);
45   DECLARE_WRITE8_MEMBER(toki_adpcm_data_w);
44   DECLARE_WRITE16_MEMBER(tokib_soundcommand_w);
45   DECLARE_READ16_MEMBER(pip_r);
4646   DECLARE_WRITE16_MEMBER(toki_control_w);
47   DECLARE_WRITE16_MEMBER(toki_foreground_videoram16_w);
48   DECLARE_WRITE16_MEMBER(toki_background1_videoram16_w);
49   DECLARE_WRITE16_MEMBER(toki_background2_videoram16_w);
50   DECLARE_WRITE8_MEMBER(toki_adpcm_control_w);
47   DECLARE_WRITE16_MEMBER(foreground_videoram_w);
48   DECLARE_WRITE16_MEMBER(background1_videoram_w);
49   DECLARE_WRITE16_MEMBER(background2_videoram_w);
50   DECLARE_WRITE8_MEMBER(tokib_adpcm_control_w);
51   DECLARE_WRITE8_MEMBER(tokib_adpcm_data_w);
52   DECLARE_WRITE_LINE_MEMBER(tokib_adpcm_int);
53
5154   DECLARE_DRIVER_INIT(tokib);
5255   DECLARE_DRIVER_INIT(jujuba);
5356   DECLARE_DRIVER_INIT(toki);
57
5458   TILE_GET_INFO_MEMBER(get_text_tile_info);
5559   TILE_GET_INFO_MEMBER(get_back_tile_info);
5660   TILE_GET_INFO_MEMBER(get_fore_tile_info);
61
5762   virtual void video_start();
63
5864   UINT32 screen_update_toki(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
5965   UINT32 screen_update_tokib(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
6066   void toki_draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect);
6167   void tokib_draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect);
62   DECLARE_WRITE_LINE_MEMBER(toki_adpcm_int);
6368};
trunk/src/mame/video/toki.c
r243350r243351
2929WRITE16_MEMBER(toki_state::toki_control_w)
3030{
3131   m_screen->update_partial(m_screen->vpos() - 1);
32   COMBINE_DATA(&m_scrollram16[offset]);
32   COMBINE_DATA(&m_scrollram[offset]);
3333}
3434
3535TILE_GET_INFO_MEMBER(toki_state::get_text_tile_info)
r243350r243351
4848
4949TILE_GET_INFO_MEMBER(toki_state::get_back_tile_info)
5050{
51   int tile = m_background1_videoram16[tile_index];
51   int tile = m_background1_videoram[tile_index];
5252   int color = (tile >> 12) & 0xf;
5353
5454   tile &= 0xfff;
r243350r243351
6161
6262TILE_GET_INFO_MEMBER(toki_state::get_fore_tile_info)
6363{
64   int tile = m_background2_videoram16[tile_index];
64   int tile = m_background2_videoram[tile_index];
6565   int color = (tile >> 12) & 0xf;
6666
6767   tile &= 0xfff;
r243350r243351
9292
9393/*************************************/
9494
95WRITE16_MEMBER(toki_state::toki_foreground_videoram16_w)
95WRITE16_MEMBER(toki_state::foreground_videoram_w)
9696{
9797   UINT16 *videoram = m_videoram;
9898   COMBINE_DATA(&videoram[offset]);
9999   m_text_layer->mark_tile_dirty(offset);
100100}
101101
102WRITE16_MEMBER(toki_state::toki_background1_videoram16_w)
102WRITE16_MEMBER(toki_state::background1_videoram_w)
103103{
104   COMBINE_DATA(&m_background1_videoram16[offset]);
104   COMBINE_DATA(&m_background1_videoram[offset]);
105105   m_background_layer->mark_tile_dirty(offset);
106106}
107107
108WRITE16_MEMBER(toki_state::toki_background2_videoram16_w)
108WRITE16_MEMBER(toki_state::background2_videoram_w)
109109{
110   COMBINE_DATA(&m_background2_videoram16[offset]);
110   COMBINE_DATA(&m_background2_videoram[offset]);
111111   m_foreground_layer->mark_tile_dirty(offset);
112112}
113113
r243350r243351
249249{
250250   int background_y_scroll,foreground_y_scroll,background_x_scroll,foreground_x_scroll;
251251
252   background_x_scroll=((m_scrollram16[0x06] &0x7f) << 1)
253                           |((m_scrollram16[0x06] &0x80) >> 7)
254                           |((m_scrollram16[0x05] &0x10) << 4);
255   background_y_scroll=((m_scrollram16[0x0d]&0x10)<<4)+((m_scrollram16[0x0e]&0x7f)<<1)+((m_scrollram16[0x0e]&0x80)>>7);
252   background_x_scroll=((m_scrollram[0x06] &0x7f) << 1)
253                           |((m_scrollram[0x06] &0x80) >> 7)
254                           |((m_scrollram[0x05] &0x10) << 4);
255   background_y_scroll=((m_scrollram[0x0d]&0x10)<<4)+((m_scrollram[0x0e]&0x7f)<<1)+((m_scrollram[0x0e]&0x80)>>7);
256256
257257   m_background_layer->set_scrollx(0, background_x_scroll );
258258   m_background_layer->set_scrolly(0, background_y_scroll );
259259
260   foreground_x_scroll= ((m_scrollram16[0x16] &0x7f) << 1)
261                           |((m_scrollram16[0x16] &0x80) >> 7)
262                           |((m_scrollram16[0x15] &0x10) << 4);
263   foreground_y_scroll=((m_scrollram16[0x1d]&0x10)<<4)+((m_scrollram16[0x1e]&0x7f)<<1)+((m_scrollram16[0x1e]&0x80)>>7);
260   foreground_x_scroll= ((m_scrollram[0x16] &0x7f) << 1)
261                           |((m_scrollram[0x16] &0x80) >> 7)
262                           |((m_scrollram[0x15] &0x10) << 4);
263   foreground_y_scroll=((m_scrollram[0x1d]&0x10)<<4)+((m_scrollram[0x1e]&0x7f)<<1)+((m_scrollram[0x1e]&0x80)>>7);
264264
265265   m_foreground_layer->set_scrollx(0, foreground_x_scroll );
266266   m_foreground_layer->set_scrolly(0, foreground_y_scroll );
267267
268   flip_screen_set((m_scrollram16[0x28]&0x8000)==0);
268   flip_screen_set((m_scrollram[0x28]&0x8000)==0);
269269
270   if (m_scrollram16[0x28]&0x100) {
270   if (m_scrollram[0x28]&0x100) {
271271      m_background_layer->draw(screen, bitmap, cliprect, TILEMAP_DRAW_OPAQUE,0);
272272      m_foreground_layer->draw(screen, bitmap, cliprect, 0,0);
273273   } else {
r243350r243351
283283{
284284   m_foreground_layer->set_scroll_rows(1);
285285   m_background_layer->set_scroll_rows(1);
286   m_background_layer->set_scrolly(0, m_scrollram16[0]+1 );
287   m_background_layer->set_scrollx(0, m_scrollram16[1]-0x103 );
288   m_foreground_layer->set_scrolly(0, m_scrollram16[2]+1 );
289   m_foreground_layer->set_scrollx(0, m_scrollram16[3]-0x101 );
286   m_background_layer->set_scrolly(0, m_scrollram[0]+1 );
287   m_background_layer->set_scrollx(0, m_scrollram[1]-0x103 );
288   m_foreground_layer->set_scrolly(0, m_scrollram[2]+1 );
289   m_foreground_layer->set_scrollx(0, m_scrollram[3]-0x101 );
290290
291   if (m_scrollram16[3]&0x2000) {
291   if (m_scrollram[3]&0x2000) {
292292      m_background_layer->draw(screen, bitmap, cliprect, TILEMAP_DRAW_OPAQUE,0);
293293      m_foreground_layer->draw(screen, bitmap, cliprect, 0,0);
294294   } else {


Previous 199869 Revisions Next


© 1997-2024 The MAME Team