1 // license:BSD-3-Clause 2 // copyright-holders:Nicola Salmoria 3 #ifndef MAME_INCLUDES_PACMAN_H 4 #define MAME_INCLUDES_PACMAN_H 5 6 #pragma once 7 8 #include "machine/74259.h" 9 #include "machine/gen_latch.h" 10 #include "machine/watchdog.h" 11 #include "sound/namco.h" 12 #include "emupal.h" 13 #include "tilemap.h" 14 15 /************************************************************************* 16 17 Namco PuckMan 18 19 **************************************************************************/ 20 21 class pacman_state : public driver_device 22 { 23 public: pacman_state(const machine_config & mconfig,device_type type,const char * tag)24 pacman_state(const machine_config &mconfig, device_type type, const char *tag) 25 : driver_device(mconfig, type, tag) 26 , m_maincpu(*this, "maincpu") 27 , m_mainlatch(*this, "mainlatch") 28 , m_namco_sound(*this, "namco") 29 , m_watchdog(*this, "watchdog") 30 , m_spriteram(*this, "spriteram") 31 , m_spriteram2(*this, "spriteram2") 32 , m_s2650_spriteram(*this, "s2650_spriteram") 33 , m_videoram(*this, "videoram") 34 , m_colorram(*this, "colorram") 35 , m_s2650games_tileram(*this, "s2650_tileram") 36 , m_rocktrv2_prot_data(*this, "rocktrv2_prot") 37 , m_gfxdecode(*this, "gfxdecode") 38 , m_palette(*this, "palette") 39 { } 40 41 protected: 42 void _8bpm_portmap(address_map &map); 43 void alibaba_map(address_map &map); 44 void bigbucks_map(address_map &map); 45 void bigbucks_portmap(address_map &map); 46 void birdiy_map(address_map &map); 47 void crushs_map(address_map &map); 48 void crushs_portmap(address_map &map); 49 void dremshpr_map(address_map &map); 50 void dremshpr_portmap(address_map &map); 51 void drivfrcp_portmap(address_map &map); 52 void mschamp_map(address_map &map); 53 void mschamp_portmap(address_map &map); 54 void mspacman_map(address_map &map); 55 void nmouse_portmap(address_map &map); 56 void numcrash_map(address_map &map); 57 void pacman_map(address_map &map); 58 void pengojpm_map(address_map &map); 59 void piranha_portmap(address_map &map); 60 void porky_portmap(address_map &map); 61 void rocktrv2_map(address_map &map); 62 void s2650games_dataport(address_map &map); 63 void s2650games_map(address_map &map); 64 void superabc_map(address_map &map); 65 void vanvan_portmap(address_map &map); 66 void woodpek_map(address_map &map); 67 void writeport(address_map &map); 68 69 required_device<cpu_device> m_maincpu; 70 optional_device<ls259_device> m_mainlatch; 71 optional_device<namco_device> m_namco_sound; 72 required_device<watchdog_timer_device> m_watchdog; 73 optional_shared_ptr<uint8_t> m_spriteram; 74 optional_shared_ptr<uint8_t> m_spriteram2; 75 optional_shared_ptr<uint8_t> m_s2650_spriteram; 76 required_shared_ptr<uint8_t> m_videoram; 77 optional_shared_ptr<uint8_t> m_colorram; 78 optional_shared_ptr<uint8_t> m_s2650games_tileram; 79 optional_shared_ptr<uint8_t> m_rocktrv2_prot_data; 80 required_device<gfxdecode_device> m_gfxdecode; 81 required_device<palette_device> m_palette; 82 83 uint8_t m_cannonb_bit_to_read; 84 int m_mystery; 85 uint8_t m_counter; 86 int m_bigbucks_bank; 87 uint8_t m_rocktrv2_question_bank; 88 tilemap_t *m_bg_tilemap; 89 uint8_t m_charbank; 90 uint8_t m_spritebank; 91 uint8_t m_palettebank; 92 uint8_t m_colortablebank; 93 uint8_t m_flipscreen; 94 uint8_t m_bgpriority; 95 int m_xoffsethack; 96 uint8_t m_inv_spr; 97 uint8_t m_maketrax_counter; 98 uint8_t m_maketrax_offset; 99 int m_maketrax_disable_protection; 100 101 uint8_t m_irq_mask; 102 103 void pacman_interrupt_vector_w(uint8_t data); 104 void piranha_interrupt_vector_w(uint8_t data); 105 void nmouse_interrupt_vector_w(uint8_t data); 106 DECLARE_WRITE_LINE_MEMBER(coin_counter_w); 107 DECLARE_WRITE_LINE_MEMBER(coin_lockout_global_w); 108 void alibaba_sound_w(offs_t offset, uint8_t data); 109 uint8_t alibaba_mystery_1_r(); 110 uint8_t alibaba_mystery_2_r(); 111 void maketrax_protection_w(uint8_t data); 112 uint8_t mbrush_prot_r(offs_t offset); 113 uint8_t maketrax_special_port2_r(offs_t offset); 114 uint8_t maketrax_special_port3_r(offs_t offset); 115 uint8_t mschamp_kludge_r(); 116 void bigbucks_bank_w(uint8_t data); 117 uint8_t bigbucks_question_r(offs_t offset); 118 void porky_banking_w(uint8_t data); 119 uint8_t drivfrcp_port1_r(); 120 uint8_t _8bpm_port1_r(); 121 uint8_t porky_port1_r(); 122 uint8_t rocktrv2_prot1_data_r(); 123 uint8_t rocktrv2_prot2_data_r(); 124 uint8_t rocktrv2_prot3_data_r(); 125 uint8_t rocktrv2_prot4_data_r(); 126 void rocktrv2_prot_data_w(offs_t offset, uint8_t data); 127 void rocktrv2_question_bank_w(uint8_t data); 128 uint8_t rocktrv2_question_r(offs_t offset); 129 uint8_t pacman_read_nop(); 130 uint8_t mspacman_disable_decode_r_0x0038(offs_t offset); 131 uint8_t mspacman_disable_decode_r_0x03b0(offs_t offset); 132 uint8_t mspacman_disable_decode_r_0x1600(offs_t offset); 133 uint8_t mspacman_disable_decode_r_0x2120(offs_t offset); 134 uint8_t mspacman_disable_decode_r_0x3ff0(offs_t offset); 135 uint8_t mspacman_disable_decode_r_0x8000(offs_t offset); 136 uint8_t mspacman_disable_decode_r_0x97f0(offs_t offset); 137 void mspacman_disable_decode_w(uint8_t data); 138 uint8_t mspacman_enable_decode_r_0x3ff8(offs_t offset); 139 void mspacman_enable_decode_w(uint8_t data); 140 DECLARE_WRITE_LINE_MEMBER(irq_mask_w); 141 uint8_t mspacii_protection_r(offs_t offset); 142 uint8_t cannonbp_protection_r(offs_t offset); 143 void pacman_videoram_w(offs_t offset, uint8_t data); 144 void pacman_colorram_w(offs_t offset, uint8_t data); 145 DECLARE_WRITE_LINE_MEMBER(flipscreen_w); 146 DECLARE_WRITE_LINE_MEMBER(pengo_palettebank_w); 147 DECLARE_WRITE_LINE_MEMBER(pengo_colortablebank_w); 148 DECLARE_WRITE_LINE_MEMBER(pengo_gfxbank_w); 149 void s2650games_videoram_w(offs_t offset, uint8_t data); 150 void s2650games_colorram_w(offs_t offset, uint8_t data); 151 void s2650games_scroll_w(offs_t offset, uint8_t data); 152 void s2650games_tilesbank_w(offs_t offset, uint8_t data); 153 void jrpacman_videoram_w(offs_t offset, uint8_t data); 154 DECLARE_WRITE_LINE_MEMBER(jrpacman_charbank_w); 155 DECLARE_WRITE_LINE_MEMBER(jrpacman_spritebank_w); 156 void jrpacman_scroll_w(uint8_t data); 157 DECLARE_WRITE_LINE_MEMBER(jrpacman_bgpriority_w); 158 void superabc_bank_w(uint8_t data); 159 160 public: 161 void init_maketrax(); 162 void init_drivfrcp(); 163 void init_mspacmbe(); 164 void init_ponpoko(); 165 void init_eyes(); 166 void init_woodpek(); 167 void init_cannonbp(); 168 void init_jumpshot(); 169 void init_mspacii(); 170 void init_pacplus(); 171 void init_rocktrv2(); 172 void init_superabc(); 173 void init_8bpm(); 174 void init_porky(); 175 void init_mspacman(); 176 void init_mschamp(); 177 void init_mbrush(); 178 void init_pengomc1(); 179 180 protected: 181 TILEMAP_MAPPER_MEMBER(pacman_scan_rows); 182 TILE_GET_INFO_MEMBER(pacman_get_tile_info); 183 TILE_GET_INFO_MEMBER(s2650_get_tile_info); 184 TILEMAP_MAPPER_MEMBER(jrpacman_scan_rows); 185 TILE_GET_INFO_MEMBER(jrpacman_get_tile_info); 186 DECLARE_VIDEO_START(pacman); 187 void pacman_palette(palette_device &palette) const; 188 DECLARE_VIDEO_START(birdiy); 189 DECLARE_VIDEO_START(s2650games); 190 DECLARE_MACHINE_RESET(mschamp); 191 DECLARE_MACHINE_RESET(superabc); 192 DECLARE_MACHINE_RESET(maketrax); 193 DECLARE_VIDEO_START(pengo); 194 DECLARE_VIDEO_START(jrpacman); 195 uint32_t screen_update_pacman(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); 196 uint32_t screen_update_s2650games(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); 197 DECLARE_WRITE_LINE_MEMBER(vblank_irq); 198 INTERRUPT_GEN_MEMBER(periodic_irq); 199 DECLARE_WRITE_LINE_MEMBER(rocktrv2_vblank_irq); 200 DECLARE_WRITE_LINE_MEMBER(vblank_nmi); 201 DECLARE_WRITE_LINE_MEMBER(s2650_interrupt); 202 203 private: 204 void init_save_state(); 205 void jrpacman_mark_tile_dirty( int offset ); 206 void eyes_decode(uint8_t *data); 207 void mspacman_install_patches(uint8_t *ROM); 208 209 public: 210 void birdiy(machine_config &config); 211 void rocktrv2(machine_config &config); 212 void mspacman(machine_config &config); 213 void dremshpr(machine_config &config); 214 void mschamp(machine_config &config); 215 void nmouse(machine_config &config); 216 void vanvan(machine_config &config); 217 void s2650games(machine_config &config); 218 void woodpek(machine_config &config); 219 void crushs(machine_config &config); 220 void superabc(machine_config &config); 221 void numcrash(machine_config &config); 222 void crush4(machine_config &config); 223 void bigbucks(machine_config &config); 224 void porky(machine_config &config); 225 void pacman(machine_config &config, bool latch = true); 226 void _8bpm(machine_config &config); 227 void crush2(machine_config &config); 228 void korosuke(machine_config &config); 229 void alibaba(machine_config &config); 230 void drivfrcp(machine_config &config); 231 void pengojpm(machine_config &config); 232 void piranha(machine_config &config); 233 234 private: 235 // pacplus.c 236 uint8_t pacplus_decrypt(int addr, uint8_t e); 237 void pacplus_decode(); 238 239 // jumpshot.c 240 uint8_t jumpshot_decrypt(int addr, uint8_t e); 241 void jumpshot_decode(); 242 }; 243 244 245 class epospm_state : public pacman_state 246 { 247 public: 248 using pacman_state::pacman_state; 249 250 void acitya(machine_config &config); 251 void theglobp(machine_config &config); 252 void eeekkp(machine_config &config); 253 254 protected: 255 uint8_t epos_decryption_w(offs_t offset); 256 DECLARE_MACHINE_START(theglobp); 257 DECLARE_MACHINE_RESET(theglobp); 258 DECLARE_MACHINE_START(eeekkp); 259 DECLARE_MACHINE_RESET(eeekkp); 260 DECLARE_MACHINE_START(acitya); 261 DECLARE_MACHINE_RESET(acitya); 262 263 void epos_map(address_map &map); 264 void epos_portmap(address_map &map); 265 }; 266 267 class clubpacm_state : public pacman_state 268 { 269 public: clubpacm_state(const machine_config & mconfig,device_type type,const char * tag)270 clubpacm_state(const machine_config &mconfig, device_type type, const char *tag) 271 : pacman_state(mconfig, type, tag) 272 , m_sublatch(*this, "sublatch") 273 , m_players(*this, "P%u", 1) 274 { } 275 276 void clubpacm(machine_config &config); 277 278 DECLARE_CUSTOM_INPUT_MEMBER(clubpacm_input_r); 279 280 void init_clubpacma(); 281 282 protected: 283 void clubpacm_map(address_map &map); 284 285 required_device<generic_latch_8_device> m_sublatch; 286 required_ioport_array<2> m_players; 287 }; 288 289 #endif // MAME_INCLUDES_PACMAN_H 290