trunk/src/mame/drivers/toki.c
| r243350 | r243351 | |
| 91 | 91 | AM_RANGE(0x060000, 0x06d7ff) AM_RAM |
| 92 | 92 | AM_RANGE(0x06d800, 0x06dfff) AM_RAM AM_SHARE("spriteram") |
| 93 | 93 | 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") |
| 97 | 97 | 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") |
| 99 | 99 | AM_RANGE(0x0c0000, 0x0c0001) AM_READ_PORT("DSW") |
| 100 | 100 | AM_RANGE(0x0c0002, 0x0c0003) AM_READ_PORT("INPUTS") |
| 101 | 101 | AM_RANGE(0x0c0004, 0x0c0005) AM_READ_PORT("SYSTEM") |
| r243350 | r243351 | |
| 106 | 106 | AM_RANGE(0x000000, 0x05ffff) AM_ROM |
| 107 | 107 | AM_RANGE(0x060000, 0x06dfff) AM_RAM |
| 108 | 108 | 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") |
| 112 | 112 | AM_RANGE(0x071000, 0x071001) AM_WRITENOP /* sprite related? seems another scroll register */ |
| 113 | 113 | /* gets written the same value as 75000a (bg2 scrollx) */ |
| 114 | 114 | AM_RANGE(0x071804, 0x071807) AM_WRITENOP /* sprite related, always 01be0100 */ |
| 115 | 115 | AM_RANGE(0x07180e, 0x071e45) AM_WRITEONLY AM_SHARE("spriteram") |
| 116 | 116 | AM_RANGE(0x072000, 0x072001) AM_READ(watchdog_reset16_r) /* probably */ |
| 117 | 117 | 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") |
| 119 | 119 | AM_RANGE(0x0c0000, 0x0c0001) AM_READ_PORT("DSW") |
| 120 | 120 | AM_RANGE(0x0c0002, 0x0c0003) AM_READ_PORT("INPUTS") |
| 121 | 121 | AM_RANGE(0x0c0004, 0x0c0005) AM_READ_PORT("SYSTEM") |
| r243350 | r243351 | |
| 826 | 826 | memcpy (&base[0x18000 + i * 0x800], &temp[0x1800 + i * 0x2000], 0x800); |
| 827 | 827 | } |
| 828 | 828 | } |
| 829 | |
| 830 | save_item(NAME(m_msm5205next)); |
| 831 | save_item(NAME(m_toggle)); |
| 829 | 832 | } |
| 830 | 833 | |
| 831 | 834 | DRIVER_INIT_MEMBER(toki_state,jujuba) |
| r243350 | r243351 | |
| 877 | 880 | |
| 878 | 881 | |
| 879 | 882 | // these 2 are both unique revisions |
| 880 | | GAME( 1989, toki, 0, toki, toki, toki_state, toki, ROT0, "TAD Corporation", "Toki (World, set 1)", 0 ) |
| 881 | | GAME( 1989, tokiu, toki, toki, toki, toki_state, toki, ROT0, "TAD Corporation (Fabtek license)", "Toki (US, set 1)", 0 ) |
| 883 | GAME( 1989, toki, 0, toki, toki, toki_state, toki, ROT0, "TAD Corporation", "Toki (World, set 1)", GAME_SUPPORTS_SAVE ) |
| 884 | GAME( 1989, tokiu, toki, toki, toki, toki_state, toki, ROT0, "TAD Corporation (Fabtek license)", "Toki (US, set 1)", GAME_SUPPORTS_SAVE ) |
| 882 | 885 | |
| 883 | 886 | // these 3 are all the same revision, only the region byte differs |
| 884 | | GAME( 1989, tokia, toki, toki, toki, toki_state, toki, ROT0, "TAD Corporation", "Toki (World, set 2)", 0 ) |
| 885 | | GAME( 1989, tokiua,toki, toki, toki, toki_state, toki, ROT0, "TAD Corporation (Fabtek license)", "Toki (US, set 2)", 0 ) |
| 886 | | GAME( 1989, juju, toki, toki, toki, toki_state, toki, ROT0, "TAD Corporation", "JuJu Densetsu (Japan)", 0 ) |
| 887 | GAME( 1989, tokia, toki, toki, toki, toki_state, toki, ROT0, "TAD Corporation", "Toki (World, set 2)", GAME_SUPPORTS_SAVE ) |
| 888 | GAME( 1989, tokiua,toki, toki, toki, toki_state, toki, ROT0, "TAD Corporation (Fabtek license)", "Toki (US, set 2)", GAME_SUPPORTS_SAVE ) |
| 889 | GAME( 1989, juju, toki, toki, toki, toki_state, toki, ROT0, "TAD Corporation", "JuJu Densetsu (Japan)", GAME_SUPPORTS_SAVE ) |
| 887 | 890 | |
| 888 | | GAME( 1990, tokib, toki, tokib, tokib, toki_state, tokib, ROT0, "bootleg (Datsu)", "Toki (Datsu bootleg)", 0 ) |
| 889 | | GAME( 1990, jujub, toki, tokib, tokib, toki_state, tokib, ROT0, "bootleg (Playmark)", "JuJu Densetsu (Playmark bootleg)", 0 ) |
| 891 | GAME( 1990, tokib, toki, tokib, tokib, toki_state, tokib, ROT0, "bootleg (Datsu)", "Toki (Datsu bootleg)", GAME_SUPPORTS_SAVE ) |
| 892 | GAME( 1990, jujub, toki, tokib, tokib, toki_state, tokib, ROT0, "bootleg (Playmark)", "JuJu Densetsu (Playmark bootleg)", GAME_SUPPORTS_SAVE ) |
| 890 | 893 | /* 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 */ |
| 891 | | GAME( 1989, jujuba, toki, toki, toki, toki_state, jujuba, ROT180, "bootleg", "JuJu Densetsu (Japan, bootleg)", GAME_IMPERFECT_SOUND ) // bootleg of tokia/juju revison |
| 894 | GAME( 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
| r243350 | r243351 | |
| 7 | 7 | public: |
| 8 | 8 | toki_state(const machine_config &mconfig, device_type type, const char *tag) |
| 9 | 9 | : 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"), |
| 15 | 10 | m_maincpu(*this, "maincpu"), |
| 16 | 11 | m_audiocpu(*this, "audiocpu"), |
| 17 | 12 | m_seibu_sound(*this, "seibu_sound"), |
| 18 | 13 | m_msm(*this, "msm"), |
| 19 | 14 | m_gfxdecode(*this, "gfxdecode"), |
| 20 | 15 | 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") { } |
| 22 | 22 | |
| 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 | | |
| 29 | 23 | required_device<cpu_device> m_maincpu; |
| 30 | 24 | required_device<cpu_device> m_audiocpu; |
| 31 | 25 | optional_device<seibu_sound_device> m_seibu_sound; |
| r243350 | r243351 | |
| 34 | 28 | required_device<screen_device> m_screen; |
| 35 | 29 | required_device<palette_device> m_palette; |
| 36 | 30 | |
| 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 | |
| 37 | 37 | int m_msm5205next; |
| 38 | 38 | int m_toggle; |
| 39 | |
| 39 | 40 | tilemap_t *m_background_layer; |
| 40 | 41 | tilemap_t *m_foreground_layer; |
| 41 | 42 | tilemap_t *m_text_layer; |
| 42 | 43 | |
| 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); |
| 46 | 46 | 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 | |
| 51 | 54 | DECLARE_DRIVER_INIT(tokib); |
| 52 | 55 | DECLARE_DRIVER_INIT(jujuba); |
| 53 | 56 | DECLARE_DRIVER_INIT(toki); |
| 57 | |
| 54 | 58 | TILE_GET_INFO_MEMBER(get_text_tile_info); |
| 55 | 59 | TILE_GET_INFO_MEMBER(get_back_tile_info); |
| 56 | 60 | TILE_GET_INFO_MEMBER(get_fore_tile_info); |
| 61 | |
| 57 | 62 | virtual void video_start(); |
| 63 | |
| 58 | 64 | UINT32 screen_update_toki(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 59 | 65 | UINT32 screen_update_tokib(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 60 | 66 | void toki_draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect); |
| 61 | 67 | void tokib_draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect); |
| 62 | | DECLARE_WRITE_LINE_MEMBER(toki_adpcm_int); |
| 63 | 68 | }; |
trunk/src/mame/video/toki.c
| r243350 | r243351 | |
| 29 | 29 | WRITE16_MEMBER(toki_state::toki_control_w) |
| 30 | 30 | { |
| 31 | 31 | m_screen->update_partial(m_screen->vpos() - 1); |
| 32 | | COMBINE_DATA(&m_scrollram16[offset]); |
| 32 | COMBINE_DATA(&m_scrollram[offset]); |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | TILE_GET_INFO_MEMBER(toki_state::get_text_tile_info) |
| r243350 | r243351 | |
| 48 | 48 | |
| 49 | 49 | TILE_GET_INFO_MEMBER(toki_state::get_back_tile_info) |
| 50 | 50 | { |
| 51 | | int tile = m_background1_videoram16[tile_index]; |
| 51 | int tile = m_background1_videoram[tile_index]; |
| 52 | 52 | int color = (tile >> 12) & 0xf; |
| 53 | 53 | |
| 54 | 54 | tile &= 0xfff; |
| r243350 | r243351 | |
| 61 | 61 | |
| 62 | 62 | TILE_GET_INFO_MEMBER(toki_state::get_fore_tile_info) |
| 63 | 63 | { |
| 64 | | int tile = m_background2_videoram16[tile_index]; |
| 64 | int tile = m_background2_videoram[tile_index]; |
| 65 | 65 | int color = (tile >> 12) & 0xf; |
| 66 | 66 | |
| 67 | 67 | tile &= 0xfff; |
| r243350 | r243351 | |
| 92 | 92 | |
| 93 | 93 | /*************************************/ |
| 94 | 94 | |
| 95 | | WRITE16_MEMBER(toki_state::toki_foreground_videoram16_w) |
| 95 | WRITE16_MEMBER(toki_state::foreground_videoram_w) |
| 96 | 96 | { |
| 97 | 97 | UINT16 *videoram = m_videoram; |
| 98 | 98 | COMBINE_DATA(&videoram[offset]); |
| 99 | 99 | m_text_layer->mark_tile_dirty(offset); |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | | WRITE16_MEMBER(toki_state::toki_background1_videoram16_w) |
| 102 | WRITE16_MEMBER(toki_state::background1_videoram_w) |
| 103 | 103 | { |
| 104 | | COMBINE_DATA(&m_background1_videoram16[offset]); |
| 104 | COMBINE_DATA(&m_background1_videoram[offset]); |
| 105 | 105 | m_background_layer->mark_tile_dirty(offset); |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | | WRITE16_MEMBER(toki_state::toki_background2_videoram16_w) |
| 108 | WRITE16_MEMBER(toki_state::background2_videoram_w) |
| 109 | 109 | { |
| 110 | | COMBINE_DATA(&m_background2_videoram16[offset]); |
| 110 | COMBINE_DATA(&m_background2_videoram[offset]); |
| 111 | 111 | m_foreground_layer->mark_tile_dirty(offset); |
| 112 | 112 | } |
| 113 | 113 | |
| r243350 | r243351 | |
| 249 | 249 | { |
| 250 | 250 | int background_y_scroll,foreground_y_scroll,background_x_scroll,foreground_x_scroll; |
| 251 | 251 | |
| 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); |
| 256 | 256 | |
| 257 | 257 | m_background_layer->set_scrollx(0, background_x_scroll ); |
| 258 | 258 | m_background_layer->set_scrolly(0, background_y_scroll ); |
| 259 | 259 | |
| 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); |
| 264 | 264 | |
| 265 | 265 | m_foreground_layer->set_scrollx(0, foreground_x_scroll ); |
| 266 | 266 | m_foreground_layer->set_scrolly(0, foreground_y_scroll ); |
| 267 | 267 | |
| 268 | | flip_screen_set((m_scrollram16[0x28]&0x8000)==0); |
| 268 | flip_screen_set((m_scrollram[0x28]&0x8000)==0); |
| 269 | 269 | |
| 270 | | if (m_scrollram16[0x28]&0x100) { |
| 270 | if (m_scrollram[0x28]&0x100) { |
| 271 | 271 | m_background_layer->draw(screen, bitmap, cliprect, TILEMAP_DRAW_OPAQUE,0); |
| 272 | 272 | m_foreground_layer->draw(screen, bitmap, cliprect, 0,0); |
| 273 | 273 | } else { |
| r243350 | r243351 | |
| 283 | 283 | { |
| 284 | 284 | m_foreground_layer->set_scroll_rows(1); |
| 285 | 285 | 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 ); |
| 290 | 290 | |
| 291 | | if (m_scrollram16[3]&0x2000) { |
| 291 | if (m_scrollram[3]&0x2000) { |
| 292 | 292 | m_background_layer->draw(screen, bitmap, cliprect, TILEMAP_DRAW_OPAQUE,0); |
| 293 | 293 | m_foreground_layer->draw(screen, bitmap, cliprect, 0,0); |
| 294 | 294 | } else { |