1 // license:BSD-3-Clause 2 // copyright-holders:Takahiro Nogi. Bryan McPhail, Nicola Salmoria, Aaron Giles 3 /*************************************************************************** 4 5 Game Driver for Video System Mahjong series and Pipe Dream. 6 7 Driver by Takahiro Nogi <nogi@kt.rim.or.jp> 2001/02/04 - 8 and Bryan McPhail, Nicola Salmoria, Aaron Giles 9 10 ***************************************************************************/ 11 #ifndef MAME_INCLUDES_FROMANCE_H 12 #define MAME_INCLUDES_FROMANCE_H 13 14 #pragma once 15 16 #include "machine/gen_latch.h" 17 #include "sound/msm5205.h" 18 #include "video/vsystem_gga.h" 19 #include "video/vsystem_spr2.h" 20 #include "emupal.h" 21 #include "screen.h" 22 #include "tilemap.h" 23 24 class fromance_state : public driver_device 25 { 26 public: fromance_state(const machine_config & mconfig,device_type type,const char * tag)27 fromance_state(const machine_config &mconfig, device_type type, const char *tag) : 28 driver_device(mconfig, type, tag), 29 m_maincpu(*this, "maincpu"), 30 m_subcpu(*this, "sub"), 31 m_spriteram(*this, "spriteram"), 32 m_gfxdecode(*this, "gfxdecode"), 33 m_screen(*this, "screen"), 34 m_palette(*this, "palette"), 35 m_gga(*this, "gga"), 36 m_spr_old(*this, "vsystem_spr_old"), 37 m_videoram(*this, "videoram"), 38 m_sublatch(*this, "sublatch"), 39 m_msm(*this, "msm") 40 { } 41 42 void nekkyoku(machine_config &config); 43 void fromance(machine_config &config); 44 void idolmj(machine_config &config); 45 46 void init_common(); 47 48 void fromance_gga_data_w(offs_t offset, uint8_t data); 49 50 protected: 51 required_device<cpu_device> m_maincpu; 52 required_device<cpu_device> m_subcpu; 53 optional_shared_ptr<uint8_t> m_spriteram; 54 required_device<gfxdecode_device> m_gfxdecode; 55 required_device<screen_device> m_screen; 56 required_device<palette_device> m_palette; 57 required_device<vsystem_gga_device> m_gga; 58 optional_device<vsystem_spr2_device> m_spr_old; // only used by pipe dream, split this state up and clean things... 59 60 void fromance_gfxreg_w(uint8_t data); 61 uint8_t fromance_videoram_r(offs_t offset); 62 void fromance_videoram_w(offs_t offset, uint8_t data); 63 void fromance_scroll_w(offs_t offset, uint8_t data); 64 65 uint32_t m_scrolly_ofs; 66 uint32_t m_scrollx_ofs; 67 uint32_t m_scrollx[2]; 68 uint32_t m_scrolly[2]; 69 uint8_t m_gfxreg; 70 uint8_t m_flipscreen; 71 uint8_t m_flipscreen_old; 72 uint8_t m_selected_videoram; 73 uint8_t m_selected_paletteram; 74 75 DECLARE_VIDEO_START(hatris); 76 DECLARE_VIDEO_START(pipedrm); 77 78 uint32_t screen_update_fromance(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); 79 uint32_t screen_update_pipedrm(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); 80 81 private: 82 /* memory pointers (used by pipedrm) */ 83 optional_shared_ptr<uint8_t> m_videoram; 84 85 optional_device<generic_latch_8_device> m_sublatch; 86 optional_device<msm5205_device> m_msm; 87 88 /* video-related */ 89 tilemap_t *m_bg_tilemap; 90 tilemap_t *m_fg_tilemap; 91 std::unique_ptr<uint8_t[]> m_local_videoram[2]; 92 std::unique_ptr<uint8_t[]> m_local_paletteram; 93 94 emu_timer *m_crtc_timer; 95 96 /* misc */ 97 uint8_t m_portselect; 98 uint8_t m_adpcm_reset; 99 uint8_t m_adpcm_data; 100 uint8_t m_vclk_left; 101 102 /* devices */ 103 uint8_t fromance_busycheck_main_r(); 104 uint8_t fromance_busycheck_sub_r(); 105 void fromance_rombank_w(uint8_t data); 106 void fromance_adpcm_w(uint8_t data); 107 void fromance_portselect_w(uint8_t data); 108 uint8_t fromance_keymatrix_r(); 109 void fromance_coinctr_w(uint8_t data); 110 uint8_t fromance_paletteram_r(offs_t offset); 111 void fromance_paletteram_w(offs_t offset, uint8_t data); 112 void fromance_adpcm_reset_w(uint8_t data); 113 TILE_GET_INFO_MEMBER(get_fromance_bg_tile_info); 114 TILE_GET_INFO_MEMBER(get_fromance_fg_tile_info); 115 TILE_GET_INFO_MEMBER(get_nekkyoku_bg_tile_info); 116 TILE_GET_INFO_MEMBER(get_nekkyoku_fg_tile_info); 117 DECLARE_MACHINE_START(fromance); 118 DECLARE_MACHINE_RESET(fromance); 119 DECLARE_VIDEO_START(nekkyoku); 120 DECLARE_VIDEO_START(fromance); 121 TIMER_CALLBACK_MEMBER(crtc_interrupt_gen); 122 inline void get_fromance_tile_info(tile_data &tileinfo, int tile_index, int layer); 123 inline void get_nekkyoku_tile_info(tile_data &tileinfo, int tile_index, int layer); 124 void crtc_refresh(); 125 DECLARE_WRITE_LINE_MEMBER(fromance_adpcm_int); 126 void fromance_main_map(address_map &map); 127 void fromance_sub_io_map(address_map &map); 128 void fromance_sub_map(address_map &map); 129 void idolmj_sub_io_map(address_map &map); 130 void nekkyoku_main_map(address_map &map); 131 void nekkyoku_sub_io_map(address_map &map); 132 void nekkyoku_sub_map(address_map &map); 133 }; 134 135 #endif // MAME_INCLUDES_FROMANCE_H 136