1 // license:BSD-3-Clause 2 // copyright-holders:Nicola Salmoria, Phil Stroffolino, Mirko Buffoni 3 #ifndef MAME_INCLUDES_SYSTEM16_H 4 #define MAME_INCLUDES_SYSTEM16_H 5 6 #pragma once 7 8 #include "machine/74157.h" 9 #include "machine/gen_latch.h" 10 #include "sound/msm5205.h" 11 #include "sound/upd7759.h" 12 #include "video/sega16sp.h" 13 #include "video/segaic16.h" 14 #include "screen.h" 15 #include "tilemap.h" 16 17 class segas1x_bootleg_state : public sega_16bit_common_base 18 { 19 public: segas1x_bootleg_state(const machine_config & mconfig,device_type type,const char * tag)20 segas1x_bootleg_state(const machine_config &mconfig, device_type type, const char *tag) 21 : sega_16bit_common_base(mconfig, type, tag) 22 , m_textram(*this, "textram") 23 , m_bg0_tileram(*this, "bg0_tileram") 24 , m_bg1_tileram(*this, "bg1_tileram") 25 , m_tileram(*this, "tileram") 26 , m_goldnaxeb2_bgpage(*this, "gab2_bgpage") 27 , m_goldnaxeb2_fgpage(*this, "gab2_fgpage") 28 , m_sprites_region(*this, "sprites") 29 , m_soundcpu_region(*this, "soundcpu") 30 , m_soundbank(*this, "soundbank") 31 , m_okibank(*this, "okibank") 32 , m_screen(*this, "screen") 33 , m_sprites(*this, "sprites") 34 , m_maincpu(*this, "maincpu") 35 , m_soundcpu(*this, "soundcpu") 36 , m_msm(*this, "5205") 37 , m_upd7759(*this, "7759") 38 , m_gfxdecode(*this, "gfxdecode") 39 , m_soundlatch(*this, "soundlatch") 40 , m_adpcm_select(*this, "adpcm_select") 41 , m_decrypted_opcodes(*this, "decrypted_opcodes") 42 , m_leds(*this, "led%u", 0U) 43 { } 44 45 void z80_ym2151(machine_config &config); 46 void z80_ym2151_upd7759(machine_config &config); 47 void datsu_ym2151_msm5205(machine_config &config); 48 void datsu_2x_ym2203_msm5205(machine_config &config); 49 void system16_base(machine_config &config); 50 void goldnaxeb_base(machine_config &config); 51 void passshtb(machine_config &config); 52 void goldnaxeb2(machine_config &config); 53 void beautyb(machine_config &config); 54 void goldnaxeb1(machine_config &config); 55 void mwalkbl(machine_config &config); 56 void eswatbl2(machine_config &config); 57 void ddcrewbl(machine_config &config); 58 void shdancbla(machine_config &config); 59 void astormbl(machine_config &config); 60 void astormb2(machine_config &config); 61 void passsht4b(machine_config &config); 62 void wb3bb(machine_config &config); 63 void wb3bble(machine_config &config); 64 void shdancbl(machine_config &config); 65 void shinobi_datsu(machine_config &config); 66 void bayrouteb1(machine_config &config); 67 void tetrisbl(machine_config &config); 68 void eswatbl(machine_config &config); 69 void dduxbl(machine_config &config); 70 void bayrouteb2(machine_config &config); 71 void tturfbl(machine_config &config); 72 void altbeastbl(machine_config &config); 73 void system18(machine_config &config); 74 75 void init_passsht(); 76 void init_wb3bbl(); 77 void init_wb3bble(); 78 void init_fpointbl(); 79 void init_eswatbl(); 80 void init_astormbl(); 81 void init_sys18bl_oki(); 82 void init_astormb2(); 83 void init_shdancbl(); 84 void init_dduxbl(); 85 void init_altbeastbl(); 86 void init_goldnaxeb2(); 87 void init_bayrouteb1(); 88 void init_beautyb(); 89 void init_bayrouteb2(); 90 void init_shinobl(); 91 void init_tturfbl(); 92 void init_goldnaxeb1(); 93 void init_ddcrewbl(); 94 void init_common(); 95 96 private: 97 void sound_command_nmi_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); 98 void sound_command_irq_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); 99 uint8_t sound_command_irq_r(); 100 void soundbank_msm_w(uint8_t data); 101 void sys16_coinctrl_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); 102 uint16_t passht4b_service_r(); 103 uint16_t passht4b_io1_r(); 104 uint16_t passht4b_io2_r(); 105 uint16_t passht4b_io3_r(); 106 void sys16_tilebank_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); 107 void ddcrewbl_spritebank_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); 108 void tturfbl_msm5205_data_w(uint8_t data); 109 uint8_t tturfbl_soundbank_r(offs_t offset); 110 void tturfbl_soundbank_w(uint8_t data); 111 void s16bl_bgpage_w(uint16_t data); 112 void s16bl_fgpage_w(uint16_t data); 113 void s16bl_fgscrollx_bank_w(uint16_t data); 114 void s16bl_fgscrollx_w(uint16_t data); 115 void s16bl_fgscrolly_w(uint16_t data); 116 void s16bl_bgscrollx_w(uint16_t data); 117 void s16bl_bgscrolly_w(uint16_t data); 118 template<int Page> void datsu_page_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); 119 void goldnaxeb2_fgscrollx_w(uint16_t data); 120 void goldnaxeb2_bgscrollx_w(uint16_t data); 121 void goldnaxeb2_fgscrolly_w(uint16_t data); 122 void goldnaxeb2_bgscrolly_w(uint16_t data); 123 void goldnaxeb2_fgpage_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); 124 void goldnaxeb2_bgpage_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); 125 void eswat_tilebank0_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); 126 void altbeastbl_gfx_w(offs_t offset, uint16_t data); 127 uint16_t beautyb_unkx_r(); 128 void wb3bble_refreshenable_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); 129 void sys18_refreshenable_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); 130 void sys18_tilebank_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); 131 uint8_t system18_bank_r(offs_t offset); 132 void sys18_soundbank_w(uint8_t data); 133 void shdancbl_msm5205_data_w(uint8_t data); 134 uint8_t shdancbl_soundbank_r(offs_t offset); 135 void shdancbl_bankctrl_w(uint8_t data); 136 void sys18bl_okibank_w(uint8_t data); 137 void sys16_tileram_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); 138 void sys16_textram_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); 139 void s16a_bootleg_bgscrolly_w(uint16_t data); 140 void s16a_bootleg_bgscrollx_w(uint16_t data); 141 void s16a_bootleg_fgscrolly_w(uint16_t data); 142 void s16a_bootleg_fgscrollx_w(uint16_t data); 143 void s16a_bootleg_tilemapselect_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); 144 void upd7759_bank_w(uint8_t data); 145 146 DECLARE_MACHINE_RESET(ddcrewbl); 147 TILEMAP_MAPPER_MEMBER(sys16_bg_map); 148 TILEMAP_MAPPER_MEMBER(sys16_text_map); 149 TILE_GET_INFO_MEMBER(get_bg_tile_info); 150 TILE_GET_INFO_MEMBER(get_fg_tile_info); 151 TILE_GET_INFO_MEMBER(get_bg2_tile_info); 152 TILE_GET_INFO_MEMBER(get_fg2_tile_info); 153 TILE_GET_INFO_MEMBER(get_text_tile_info); 154 TILE_GET_INFO_MEMBER(get_s16a_bootleg_tile_infotxt); 155 TILE_GET_INFO_MEMBER(get_s16a_bootleg_tile_info0); 156 TILE_GET_INFO_MEMBER(get_s16a_bootleg_tile_info1); 157 DECLARE_VIDEO_START(system16); 158 DECLARE_VIDEO_START(system18old); 159 DECLARE_VIDEO_START(s16a_bootleg_shinobi); 160 DECLARE_VIDEO_START(s16a_bootleg_passsht); 161 DECLARE_VIDEO_START(s16a_bootleg_wb3bl); 162 DECLARE_VIDEO_START(s16a_bootleg); 163 uint32_t screen_update_system16(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); 164 uint32_t screen_update_system18old(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); 165 uint32_t screen_update_s16a_bootleg(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); 166 uint32_t screen_update_s16a_bootleg_passht4b(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); 167 void setup_system16_bootleg_spritebanking( ); 168 void update_page( ); 169 void set_tile_bank( int data ); 170 void set_fg_page( int data ); 171 void set_bg_page( int data ); 172 void datsu_set_pages( ); 173 DECLARE_WRITE_LINE_MEMBER(tturfbl_msm5205_callback); 174 DECLARE_WRITE_LINE_MEMBER(datsu_msm5205_callback); 175 DECLARE_WRITE_LINE_MEMBER(shdancbl_msm5205_callback); 176 DECLARE_WRITE_LINE_MEMBER(sound_cause_nmi); 177 178 void astormbl_map(address_map &map); 179 void bayrouteb1_map(address_map &map); 180 void bayrouteb2_map(address_map &map); 181 void beautyb_map(address_map &map); 182 void ddcrewbl_map(address_map &map); 183 void dduxbl_map(address_map &map); 184 void decrypted_opcodes_map(address_map &map); 185 void eswatbl2_map(address_map &map); 186 void eswatbl_map(address_map &map); 187 void goldnaxeb1_map(address_map &map); 188 void goldnaxeb2_map(address_map &map); 189 void mwalkbl_map(address_map &map); 190 void passht4b_map(address_map &map); 191 void passshtb_map(address_map &map); 192 void pcm_map(address_map &map); 193 void shdancbl_map(address_map &map); 194 void shdancbl_sound_io_map(address_map &map); 195 void shdancbl_sound_map(address_map &map); 196 void shdancbla_map(address_map &map); 197 void shdancbla_sound_map(address_map &map); 198 void shinobi_datsu_sound_map(address_map &map); 199 void shinobib_map(address_map &map); 200 void sound_18_io_map(address_map &map); 201 void sound_18_map(address_map &map); 202 void sound_7759_io_map(address_map &map); 203 void sound_7759_map(address_map &map); 204 void sound_io_map(address_map &map); 205 void sound_map(address_map &map); 206 void sys18bl_oki_map(address_map &map); 207 void sys18bl_sound_map(address_map &map); 208 void tetrisbl_map(address_map &map); 209 void tturfbl_map(address_map &map); 210 void tturfbl_sound_io_map(address_map &map); 211 void tturfbl_sound_map(address_map &map); 212 void wb3bbl_map(address_map &map); 213 void wb3bble_map(address_map &map); 214 void wb3bble_decrypted_opcodes_map(address_map &map); 215 machine_start()216 virtual void machine_start() override { m_leds.resolve(); } 217 218 required_shared_ptr<uint16_t> m_textram; 219 optional_shared_ptr<uint16_t> m_bg0_tileram; 220 optional_shared_ptr<uint16_t> m_bg1_tileram; 221 optional_shared_ptr<uint16_t> m_tileram; 222 optional_shared_ptr<uint16_t> m_goldnaxeb2_bgpage; 223 optional_shared_ptr<uint16_t> m_goldnaxeb2_fgpage; 224 225 optional_memory_region m_sprites_region; 226 optional_memory_region m_soundcpu_region; 227 optional_memory_bank m_soundbank; 228 optional_memory_bank m_okibank; 229 230 required_device<screen_device> m_screen; 231 optional_device<sega_16bit_sprite_device> m_sprites; 232 233 uint16_t m_coinctrl; 234 235 /* game specific */ 236 int m_passht4b_io1_val; 237 int m_passht4b_io2_val; 238 int m_passht4b_io3_val; 239 240 int m_beautyb_unkx; 241 242 int m_shinobl_kludge; 243 244 int m_eswat_tilebank0; 245 246 247 /* video-related */ 248 tilemap_t *m_background[2]; 249 tilemap_t *m_foreground[2]; 250 tilemap_t *m_text_layer; 251 tilemap_t *m_bg_tilemaps[2]; 252 tilemap_t *m_text_tilemap; 253 double m_weights[2][3][6]; 254 255 int m_spritebank_type; 256 int m_back_yscroll; 257 int m_fore_yscroll; 258 int m_text_yscroll; 259 260 int m_bg1_trans; // alien syn + sys18 261 262 int m_tile_bank[2]; 263 int m_bg_page[2][4]; 264 int m_fg_page[2][4]; 265 266 uint16_t m_datsu_page[4]; 267 268 int m_old_bg_page[2][4]; 269 int m_old_fg_page[2][4]; 270 int m_old_tile_bank[2]; 271 272 int m_bg_scrollx; 273 int m_bg_scrolly; 274 int m_fg_scrollx; 275 int m_fg_scrolly; 276 uint16_t m_tilemapselect; 277 278 int m_textlayer_lo_min; 279 int m_textlayer_lo_max; 280 int m_textlayer_hi_min; 281 int m_textlayer_hi_max; 282 283 int m_tilebank_switch; 284 285 286 /* sound-related */ 287 int m_sample_buffer; 288 int m_sample_select; 289 290 uint8_t *m_soundbank_ptr; /* Pointer to currently selected portion of ROM */ 291 292 /* sys18 */ 293 uint8_t *m_sound_bank; 294 uint16_t *m_splittab_bg_x; 295 uint16_t *m_splittab_bg_y; 296 uint16_t *m_splittab_fg_x; 297 uint16_t *m_splittab_fg_y; 298 int m_sound_info[4*2]; 299 int m_refreshenable; 300 int m_system18; 301 302 uint8_t *m_decrypted_region; // goldnaxeb1 & bayrouteb1 303 304 /* devices */ 305 required_device<cpu_device> m_maincpu; 306 optional_device<cpu_device> m_soundcpu; 307 optional_device<msm5205_device> m_msm; 308 optional_device<upd7759_device> m_upd7759; 309 required_device<gfxdecode_device> m_gfxdecode; 310 optional_device<generic_latch_8_device> m_soundlatch; 311 optional_device<ls157_device> m_adpcm_select; 312 optional_shared_ptr<uint16_t> m_decrypted_opcodes; 313 output_finder<2> m_leds; 314 }; 315 316 #endif // MAME_INCLUDES_SYSTEM16_H 317