1 // license:BSD-3-Clause 2 // copyright-holders:David Haywood, Roberto Fresca, Vas Crabb 3 #ifndef MAME_INCLUDES_GOLDSTAR_H 4 #define MAME_INCLUDES_GOLDSTAR_H 5 6 #pragma once 7 8 #include "machine/ds2401.h" 9 #include "machine/i8255.h" 10 #include "machine/ticket.h" 11 #include "emupal.h" 12 #include "tilemap.h" 13 14 15 class goldstar_state : public driver_device 16 { 17 public: goldstar_state(const machine_config & mconfig,device_type type,const char * tag)18 goldstar_state(const machine_config &mconfig, device_type type, const char *tag) : 19 driver_device(mconfig, type, tag), 20 m_fg_vidram(*this, "fg_vidram"), 21 m_fg_atrram(*this, "fg_atrram"), 22 m_bg_vidram(*this, "bg_vidram"), 23 m_bg_atrram(*this, "bg_atrram"), 24 m_reel1_ram(*this, "reel1_ram"), 25 m_reel2_ram(*this, "reel2_ram"), 26 m_reel3_ram(*this, "reel3_ram"), 27 m_reel1_scroll(*this, "reel1_scroll"), 28 m_reel2_scroll(*this, "reel2_scroll"), 29 m_reel3_scroll(*this, "reel3_scroll"), 30 m_decrypted_opcodes(*this, "decrypted_opcodes"), 31 m_maincpu(*this, "maincpu"), 32 m_ppi(*this, "ppi8255_%u", 0U), 33 m_gfxdecode(*this, "gfxdecode"), 34 m_palette(*this, "palette"), 35 m_lamps(*this, "lamp%u", 0U) 36 { } 37 38 void protection_w(uint8_t data); 39 uint8_t protection_r(); 40 void p1_lamps_w(uint8_t data); 41 void p2_lamps_w(uint8_t data); 42 void ncb3_port81_w(uint8_t data); 43 void cm_coincount_w(uint8_t data); 44 void goldstar_fg_vidram_w(offs_t offset, uint8_t data); 45 void goldstar_fg_atrram_w(offs_t offset, uint8_t data); 46 void goldstar_reel1_ram_w(offs_t offset, uint8_t data); 47 void goldstar_reel2_ram_w(offs_t offset, uint8_t data); 48 void goldstar_reel3_ram_w(offs_t offset, uint8_t data); 49 void goldstar_fa00_w(uint8_t data); 50 void ay8910_outputa_w(uint8_t data); 51 void ay8910_outputb_w(uint8_t data); 52 void init_chryangl(); 53 void init_goldstar(); 54 void init_jkrmast(); 55 void init_pkrmast(); 56 void init_crazybonb(); 57 void init_cmast91(); 58 void init_wcherry(); 59 void init_super9(); 60 void init_ladylinrb(); 61 void init_ladylinrc(); 62 void init_ladylinrd(); 63 void init_ladylinre(); 64 DECLARE_VIDEO_START(goldstar); 65 void cm_palette(palette_device &palette) const; 66 DECLARE_VIDEO_START(cherrym); 67 void cmast91_palette(palette_device &palette) const; 68 void lucky8_palette(palette_device &palette) const; 69 void nfm_palette(palette_device &palette) const; 70 uint32_t screen_update_goldstar(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); 71 uint32_t screen_update_cmast91(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); 72 73 void ladylinr(machine_config &config); 74 void ladylinrb(machine_config &config); 75 void wcherry(machine_config &config); 76 void crazybon(machine_config &config); 77 void crazybonb(machine_config &config); 78 void pkrmast(machine_config &config); 79 void moonlght(machine_config &config); 80 void kkotnoli(machine_config &config); 81 void cmast91(machine_config &config); 82 void super9(machine_config &config); 83 void goldfrui(machine_config &config); 84 void goldstar(machine_config &config); 85 void goldstbl(machine_config &config); 86 void bonusch_portmap(address_map &map); 87 void feverch_portmap(address_map &map); 88 void cm_map(address_map &map); 89 void cmast91_portmap(address_map &map); 90 void crazybon_portmap(address_map &map); 91 void flaming7_map(address_map &map); 92 void goldstar_map(address_map &map); 93 void goldstar_readport(address_map &map); 94 void kkotnoli_map(address_map &map); 95 void ladylinr_map(address_map &map); 96 void lucky8_map(address_map &map); 97 void common_decrypted_opcodes_map(address_map &map); 98 void super972_decrypted_opcodes_map(address_map &map); 99 void mbstar_map(address_map &map); 100 void megaline_portmap(address_map &map); 101 void ncb3_readwriteport(address_map &map); 102 void nfm_map(address_map &map); 103 void pkrmast_portmap(address_map &map); 104 void ramdac_map(address_map &map); 105 void wcat3_map(address_map &map); 106 void wcherry_map(address_map &map); 107 void wcherry_readwriteport(address_map &map); 108 109 protected: machine_start()110 virtual void machine_start() override { m_lamps.resolve(); } 111 TILE_GET_INFO_MEMBER(get_goldstar_fg_tile_info); 112 TILE_GET_INFO_MEMBER(get_cherrym_fg_tile_info); 113 TILE_GET_INFO_MEMBER(get_goldstar_reel1_tile_info); 114 TILE_GET_INFO_MEMBER(get_goldstar_reel2_tile_info); 115 TILE_GET_INFO_MEMBER(get_goldstar_reel3_tile_info); 116 117 int m_dataoffset; 118 119 required_shared_ptr<uint8_t> m_fg_vidram; 120 required_shared_ptr<uint8_t> m_fg_atrram; 121 122 optional_shared_ptr<uint8_t> m_bg_vidram; 123 optional_shared_ptr<uint8_t> m_bg_atrram; 124 125 optional_shared_ptr<uint8_t> m_reel1_ram; 126 optional_shared_ptr<uint8_t> m_reel2_ram; 127 optional_shared_ptr<uint8_t> m_reel3_ram; 128 129 optional_shared_ptr<uint8_t> m_reel1_scroll; 130 optional_shared_ptr<uint8_t> m_reel2_scroll; 131 optional_shared_ptr<uint8_t> m_reel3_scroll; 132 133 optional_shared_ptr<uint8_t> m_decrypted_opcodes; 134 135 tilemap_t *m_reel1_tilemap; 136 tilemap_t *m_reel2_tilemap; 137 tilemap_t *m_reel3_tilemap; 138 139 int m_bgcolor; 140 tilemap_t *m_fg_tilemap; 141 tilemap_t *m_bg_tilemap; 142 uint8_t m_cmaster_girl_num; 143 uint8_t m_cmaster_girl_pal; 144 uint8_t m_cm_enable_reg; 145 uint8_t m_cm_girl_scroll; 146 147 required_device<cpu_device> m_maincpu; 148 optional_device_array<i8255_device, 3> m_ppi; 149 required_device<gfxdecode_device> m_gfxdecode; 150 required_device<palette_device> m_palette; 151 output_finder<16> m_lamps; 152 }; 153 154 155 class cmaster_state : public goldstar_state 156 { 157 public: cmaster_state(const machine_config & mconfig,device_type type,const char * tag)158 cmaster_state(const machine_config &mconfig, device_type type, const char *tag) : 159 goldstar_state(mconfig, type, tag) 160 { 161 } 162 163 void outport0_w(uint8_t data); 164 void girl_scroll_w(uint8_t data); 165 void background_col_w(uint8_t data); 166 167 void init_cm(); 168 void init_cmv4(); 169 void init_tonypok(); 170 void init_schery97(); 171 void init_schery97a(); 172 void init_skill98(); 173 void init_po33(); 174 void init_match133(); 175 void init_nfb96_a(); 176 void init_nfb96_b(); 177 void init_nfb96_c1(); 178 void init_nfb96_c1_2(); 179 void init_nfb96_c2(); 180 void init_nfb96_d(); 181 void init_nfb96_dk(); 182 void init_nfb96_g(); 183 void init_nfb96sea(); 184 void init_fb2010(); 185 void init_rp35(); 186 void init_rp36(); 187 void init_rp36c3(); 188 void init_rp96sub(); 189 void init_tcl(); 190 void init_super7(); 191 void init_chthree(); 192 void init_wcat3a(); 193 194 uint32_t screen_update_amcoe1a(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); 195 196 void cm(machine_config &config); 197 void cm97(machine_config &config); 198 void cmasterc(machine_config &config); 199 void amcoe1a(machine_config &config); 200 void nfm(machine_config &config); 201 void amcoe2(machine_config &config); 202 void amcoe1(machine_config &config); 203 void chryangl(machine_config &config); 204 void ss2001(machine_config &config); 205 void amcoe1_portmap(address_map &map); 206 void amcoe2_portmap(address_map &map); 207 void cm_portmap(address_map &map); 208 void cm97_portmap(address_map &map); 209 void chryangl_decrypted_opcodes_map(address_map &map); 210 void ss2001_portmap(address_map &map); 211 212 protected: 213 // installed by various driver init handlers to get stuff to work fixedval_r()214 template <uint8_t V> uint8_t fixedval_r() { return V; } 215 }; 216 217 218 class wingco_state : public goldstar_state 219 { 220 public: wingco_state(const machine_config & mconfig,device_type type,const char * tag)221 wingco_state(const machine_config &mconfig, device_type type, const char *tag) : 222 goldstar_state(mconfig, type, tag), 223 m_fl7w4_id(*this, "fl7w4_id") 224 { 225 } 226 227 void magodds_outb850_w(uint8_t data); 228 void magodds_outb860_w(uint8_t data); 229 void fl7w4_outc802_w(uint8_t data); 230 void system_outputa_w(uint8_t data); 231 void system_outputb_w(uint8_t data); 232 void system_outputc_w(uint8_t data); 233 234 void init_lucky8a(); 235 void init_lucky8f(); 236 void init_lucky8l(); 237 void init_magoddsc(); 238 void init_flaming7(); 239 void init_flam7_tw(); 240 void init_luckylad(); 241 void init_super972(); 242 void init_wcat3(); 243 244 DECLARE_VIDEO_START(bingowng); 245 DECLARE_VIDEO_START(magical); 246 void magodds_palette(palette_device &palette) const; 247 uint32_t screen_update_bingowng(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); 248 uint32_t screen_update_magical(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); 249 uint32_t screen_update_mbstar(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); 250 251 DECLARE_WRITE_LINE_MEMBER(masked_irq); 252 253 void bingowng(machine_config &config); 254 void flaming7(machine_config &config); 255 void lucky8(machine_config &config); 256 void lucky8f(machine_config &config); 257 void lucky8k(machine_config &config); 258 void luckylad(machine_config &config); 259 void super972(machine_config &config); 260 void wcat3(machine_config &config); 261 void magodds(machine_config &config); 262 void flam7_w4(machine_config &config); 263 void bingownga(machine_config &config); 264 void mbstar(machine_config &config); 265 void flam7_tw(machine_config &config); 266 void magodds_map(address_map &map); 267 268 protected: 269 TILE_GET_INFO_MEMBER(get_magical_fg_tile_info); 270 271 private: 272 optional_device<ds2401_device> m_fl7w4_id; 273 274 uint8_t m_nmi_enable; 275 uint8_t m_vidreg; 276 277 int m_tile_bank; 278 }; 279 280 281 class cb3_state : public goldstar_state 282 { 283 public: cb3_state(const machine_config & mconfig,device_type type,const char * tag)284 cb3_state(const machine_config &mconfig, device_type type, const char *tag) : 285 goldstar_state(mconfig, type, tag) 286 { 287 } 288 289 void init_cb3(); 290 void init_cb3e(); 291 void init_cherrys(); 292 void init_chrygld(); 293 void init_chry10(); 294 295 void cherrys(machine_config &config); 296 void chryangla(machine_config &config); 297 void chrygld(machine_config &config); 298 void cb3c(machine_config &config); 299 void cb3e(machine_config &config); 300 void ncb3(machine_config &config); 301 void eldoradd(machine_config &config); 302 void ncb3_map(address_map &map); 303 void chryangla_map(address_map &map); 304 void chryangla_decrypted_opcodes_map(address_map &map); 305 306 protected: 307 void do_blockswaps(uint8_t *rom); 308 void dump_to_file(uint8_t *rom); 309 310 uint8_t cb3_decrypt(uint8_t cipherText, uint16_t address); 311 uint8_t chry10_decrypt(uint8_t cipherText); 312 }; 313 314 315 class sanghopm_state : public goldstar_state 316 { 317 public: sanghopm_state(const machine_config & mconfig,device_type type,const char * tag)318 sanghopm_state(const machine_config &mconfig, device_type type, const char *tag) : 319 goldstar_state(mconfig, type, tag), 320 m_reel1_attrram(*this, "reel1_attrram"), 321 m_reel2_attrram(*this, "reel2_attrram"), 322 m_reel3_attrram(*this, "reel3_attrram") 323 { 324 } 325 326 void enable_w(uint8_t data); 327 void coincount_w(uint8_t data); 328 329 void fg_vidram_w(offs_t offset, uint8_t data); 330 void fg_atrram_w(offs_t offset, uint8_t data); 331 void bg_vidram_w(offs_t offset, uint8_t data); 332 void bg_atrram_w(offs_t offset, uint8_t data); 333 void reel1_attrram_w(offs_t offset, uint8_t data); 334 void reel2_attrram_w(offs_t offset, uint8_t data); 335 void reel3_attrram_w(offs_t offset, uint8_t data); 336 337 DECLARE_VIDEO_START(sangho); 338 uint32_t screen_update_sangho(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); 339 340 void star100(machine_config &config); 341 void star100_map(address_map &map); 342 void star100_readport(address_map &map); 343 protected: 344 TILE_GET_INFO_MEMBER(get_fg_tile_info); 345 TILE_GET_INFO_MEMBER(get_bg_tile_info); 346 TILE_GET_INFO_MEMBER(get_reel1_tile_info); 347 TILE_GET_INFO_MEMBER(get_reel2_tile_info); 348 TILE_GET_INFO_MEMBER(get_reel3_tile_info); 349 350 private: 351 required_shared_ptr<uint8_t> m_reel1_attrram; 352 required_shared_ptr<uint8_t> m_reel2_attrram; 353 required_shared_ptr<uint8_t> m_reel3_attrram; 354 355 uint8_t m_enable_reg; 356 }; 357 358 359 class unkch_state : public goldstar_state 360 { 361 public: unkch_state(const machine_config & mconfig,device_type type,const char * tag)362 unkch_state(const machine_config &mconfig, device_type type, const char *tag) : 363 goldstar_state(mconfig, type, tag), 364 m_reel1_attrram(*this, "reel1_attrram"), 365 m_reel2_attrram(*this, "reel2_attrram"), 366 m_reel3_attrram(*this, "reel3_attrram"), 367 m_ticket_dispenser(*this, "tickets") 368 { 369 } 370 371 void coincount_w(uint8_t data); 372 void unkcm_0x02_w(uint8_t data); 373 void unkcm_0x03_w(uint8_t data); 374 375 void reel1_attrram_w(offs_t offset, uint8_t data); 376 void reel2_attrram_w(offs_t offset, uint8_t data); 377 void reel3_attrram_w(offs_t offset, uint8_t data); 378 379 void init_unkch1(); 380 void init_unkch3(); 381 void init_unkch4(); 382 383 DECLARE_VIDEO_START(unkch); 384 uint32_t screen_update_unkch(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); 385 386 DECLARE_WRITE_LINE_MEMBER(vblank_irq); 387 388 void megaline(machine_config &config); 389 void unkch(machine_config &config); 390 void bonusch(machine_config &config); 391 void feverch(machine_config &config); 392 void bonusch_map(address_map &map); 393 void feverch_map(address_map &map); 394 void megaline_map(address_map &map); 395 void unkch_map(address_map &map); 396 void unkch_portmap(address_map &map); 397 protected: 398 TILE_GET_INFO_MEMBER(get_reel1_tile_info); 399 TILE_GET_INFO_MEMBER(get_reel2_tile_info); 400 TILE_GET_INFO_MEMBER(get_reel3_tile_info); 401 402 private: 403 required_shared_ptr<uint8_t> m_reel1_attrram; 404 required_shared_ptr<uint8_t> m_reel2_attrram; 405 required_shared_ptr<uint8_t> m_reel3_attrram; 406 407 uint8_t m_vblank_irq_enable; 408 uint8_t m_vidreg; 409 410 optional_device<ticket_dispenser_device> m_ticket_dispenser; 411 }; 412 413 #endif // MAME_INCLUDES_GOLDSTAR_H 414