1 // license:BSD-3-Clause 2 // copyright-holders:Nicola Salmoria 3 /*************************************************************************** 4 5 Galaxian hardware family (old) 6 7 This include file is used by the following drivers: 8 - dambustr.cpp 9 - galaxold.cpp 10 - scramble.cpp 11 - scobra.cpp 12 13 ***************************************************************************/ 14 #ifndef MAME_INCLUDES_GALAXOLD_H 15 #define MAME_INCLUDES_GALAXOLD_H 16 17 #pragma once 18 19 #include "machine/7474.h" 20 #include "machine/timer.h" 21 #include "emupal.h" 22 #include "screen.h" 23 #include "tilemap.h" 24 25 /* star circuit */ 26 #define STAR_COUNT 252 27 struct star_gold 28 { 29 int x, y, color; 30 }; 31 32 class galaxold_state : public driver_device 33 { 34 public: galaxold_state(const machine_config & mconfig,device_type type,const char * tag)35 galaxold_state(const machine_config &mconfig, device_type type, const char *tag) 36 : driver_device(mconfig, type, tag) 37 , m_maincpu(*this, "maincpu") 38 , m_audiocpu(*this, "audiocpu") 39 , m_7474_9m_1(*this, "7474_9m_1") 40 , m_7474_9m_2(*this, "7474_9m_2") 41 , m_gfxdecode(*this, "gfxdecode") 42 , m_screen(*this, "screen") 43 , m_palette(*this, "palette") 44 , m_videoram(*this,"videoram") 45 , m_spriteram(*this,"spriteram") 46 , m_spriteram2(*this,"spriteram2") 47 , m_attributesram(*this,"attributesram") 48 , m_bulletsram(*this,"bulletsram") 49 , m_rockclim_videoram(*this,"rockclim_vram") 50 , m_racknrol_tiles_bank(*this,"racknrol_tbank") 51 , m_leds(*this, "led%u", 0U) 52 , m_leftclip(2) 53 { } 54 55 /* devices */ 56 required_device<cpu_device> m_maincpu; 57 optional_device<cpu_device> m_audiocpu; 58 optional_device<ttl7474_device> m_7474_9m_1; 59 optional_device<ttl7474_device> m_7474_9m_2; 60 required_device<gfxdecode_device> m_gfxdecode; 61 required_device<screen_device> m_screen; 62 required_device<palette_device> m_palette; 63 64 /* memory pointers */ 65 required_shared_ptr<uint8_t> m_videoram; 66 required_shared_ptr<uint8_t> m_spriteram; 67 optional_shared_ptr<uint8_t> m_spriteram2; 68 required_shared_ptr<uint8_t> m_attributesram; 69 optional_shared_ptr<uint8_t> m_bulletsram; 70 optional_shared_ptr<uint8_t> m_rockclim_videoram; 71 optional_shared_ptr<uint8_t> m_racknrol_tiles_bank; 72 output_finder<2> m_leds; 73 74 int m_irq_line; 75 uint8_t m__4in1_bank; 76 tilemap_t *m_bg_tilemap; 77 tilemap_t *m_rockclim_tilemap; 78 int m_spriteram2_present; 79 uint8_t m_gfxbank[5]; 80 uint8_t m_flipscreen_x; 81 uint8_t m_flipscreen_y; 82 uint8_t m_color_mask; 83 tilemap_t *m_dambustr_tilemap2; 84 std::unique_ptr<uint8_t[]> m_dambustr_videoram2; 85 int m_leftclip; 86 87 void (galaxold_state::*m_modify_charcode)(uint16_t *code, uint8_t x); /* function to call to do character banking */ 88 void (galaxold_state::*m_modify_spritecode)(uint8_t *spriteram, int*, int*, int*, int); /* function to call to do sprite banking */ 89 void (galaxold_state::*m_modify_color)(uint8_t *color); /* function to call to do modify how the color codes map to the PROM */ 90 void (galaxold_state::*m_modify_ypos)(uint8_t*); /* function to call to do modify how vertical positioning bits are connected */ 91 92 uint8_t m_timer_adjusted; 93 uint8_t m_darkplnt_bullet_color; 94 void (galaxold_state::*m_draw_bullets)(bitmap_ind16 &,const rectangle &, int, int, int); /* function to call to draw a bullet */ 95 96 uint8_t m_background_enable; 97 uint8_t m_background_red; 98 uint8_t m_background_green; 99 uint8_t m_background_blue; 100 void (galaxold_state::*m_draw_background)(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); /* function to call to draw the background */ 101 uint16_t m_rockclim_v; 102 uint16_t m_rockclim_h; 103 int m_dambustr_bg_split_line; 104 int m_dambustr_bg_color_1; 105 int m_dambustr_bg_color_2; 106 int m_dambustr_bg_priority; 107 int m_dambustr_char_bank; 108 std::unique_ptr<bitmap_ind16> m_dambustr_tmpbitmap; 109 110 void (galaxold_state::*m_draw_stars)(bitmap_ind16 &, const rectangle &); /* function to call to draw the star layer */ 111 int m_stars_colors_start; 112 int32_t m_stars_scrollpos; 113 uint8_t m_stars_on; 114 uint8_t m_stars_blink_state; 115 emu_timer *m_stars_blink_timer; 116 emu_timer *m_stars_scroll_timer; 117 struct star_gold m_stars[STAR_COUNT]; 118 119 uint8_t drivfrcg_port0_r(); 120 uint8_t scrambler_protection_2_r(); 121 uint8_t scramb2_protection_r(); 122 uint8_t scramb2_port0_r(offs_t offset); 123 uint8_t scramb2_port1_r(offs_t offset); 124 uint8_t scramb2_port2_r(offs_t offset); 125 uint8_t hexpoola_data_port_r(); 126 uint8_t bullsdrtg_data_port_r(); 127 void galaxold_nmi_enable_w(uint8_t data); 128 void galaxold_coin_lockout_w(uint8_t data); 129 void galaxold_coin_counter_w(offs_t offset, uint8_t data); 130 void galaxold_coin_counter_1_w(uint8_t data); 131 void galaxold_coin_counter_2_w(uint8_t data); 132 void galaxold_leds_w(offs_t offset, uint8_t data); 133 uint8_t scramblb_protection_1_r(); 134 uint8_t scramblb_protection_2_r(); 135 void _4in1_bank_w(uint8_t data); 136 void racknrol_tiles_bank_w(offs_t offset, uint8_t data); 137 void galaxold_videoram_w(offs_t offset, uint8_t data); 138 uint8_t galaxold_videoram_r(offs_t offset); 139 void galaxold_attributesram_w(offs_t offset, uint8_t data); 140 void galaxold_flip_screen_x_w(uint8_t data); 141 void galaxold_flip_screen_y_w(uint8_t data); 142 void hotshock_flip_screen_w(uint8_t data); 143 void scrambold_background_enable_w(uint8_t data); 144 void scrambold_background_red_w(uint8_t data); 145 void scrambold_background_green_w(uint8_t data); 146 void scrambold_background_blue_w(uint8_t data); 147 void galaxold_stars_enable_w(uint8_t data); 148 void darkplnt_bullet_color_w(uint8_t data); 149 void galaxold_gfxbank_w(offs_t offset, uint8_t data); 150 void rockclim_videoram_w(offs_t offset, uint8_t data); 151 void rockclim_scroll_w(offs_t offset, uint8_t data); 152 void guttang_rombank_w(uint8_t data); 153 uint8_t rockclim_videoram_r(offs_t offset); 154 void dambustr_bg_split_line_w(uint8_t data); 155 void dambustr_bg_color_w(uint8_t data); 156 DECLARE_WRITE_LINE_MEMBER(galaxold_7474_9m_2_q_callback); 157 DECLARE_WRITE_LINE_MEMBER(galaxold_7474_9m_1_callback); rescueb_a002_r()158 uint8_t rescueb_a002_r() { return 0xfc; } 159 template <int Mask> DECLARE_READ_LINE_MEMBER(_4in1_fake_port_r); 160 template <int Mask> DECLARE_READ_LINE_MEMBER(vpool_lives_r); 161 template <int Mask> DECLARE_CUSTOM_INPUT_MEMBER(ckongg_coinage_r); 162 template <int Mask> DECLARE_CUSTOM_INPUT_MEMBER(dkongjrm_coinage_r); 163 164 void init_bullsdrtg(); 165 void init_ladybugg(); 166 void init_4in1(); 167 void init_guttangt(); 168 void init_ckonggx(); 169 170 TILE_GET_INFO_MEMBER(drivfrcg_get_tile_info); 171 TILE_GET_INFO_MEMBER(racknrol_get_tile_info); 172 TILE_GET_INFO_MEMBER(dambustr_get_tile_info2); 173 TILE_GET_INFO_MEMBER(get_tile_info); 174 TILE_GET_INFO_MEMBER(rockclim_get_tile_info); 175 TILE_GET_INFO_MEMBER(harem_get_tile_info); 176 177 DECLARE_MACHINE_RESET(galaxold); 178 DECLARE_MACHINE_RESET(devilfsg); 179 DECLARE_MACHINE_RESET(hunchbkg); 180 181 void galaxold_palette(palette_device &palette); 182 void rockclim_palette(palette_device &palette) const; 183 void scrambold_palette(palette_device &palette); 184 void stratgyx_palette(palette_device &palette); 185 void darkplnt_palette(palette_device &palette) const; 186 void minefld_palette(palette_device &palette); 187 void rescue_palette(palette_device &palette); 188 void mariner_palette(palette_device &palette); 189 void dambustr_palette(palette_device &palette); 190 void turtles_palette(palette_device &palette); 191 192 DECLARE_VIDEO_START(galaxold); 193 DECLARE_VIDEO_START(drivfrcg); 194 DECLARE_VIDEO_START(racknrol); 195 DECLARE_VIDEO_START(mooncrst); 196 DECLARE_VIDEO_START(scrambold); 197 DECLARE_VIDEO_START(newsin7); 198 DECLARE_VIDEO_START(pisces); 199 DECLARE_VIDEO_START(dkongjrm); 200 DECLARE_VIDEO_START(dkongjrmc); 201 DECLARE_VIDEO_START(rockclim); 202 DECLARE_VIDEO_START(galaxold_plain); 203 DECLARE_VIDEO_START(ozon1); 204 DECLARE_VIDEO_START(bongo); 205 DECLARE_VIDEO_START(ckongs); 206 DECLARE_VIDEO_START(darkplnt); 207 DECLARE_VIDEO_START(rescue); 208 DECLARE_VIDEO_START(minefld); 209 DECLARE_VIDEO_START(stratgyx); 210 DECLARE_VIDEO_START(mariner); 211 DECLARE_VIDEO_START(mimonkey); 212 DECLARE_VIDEO_START(scorpion); 213 DECLARE_VIDEO_START(ad2083); 214 DECLARE_VIDEO_START(dambustr); 215 DECLARE_VIDEO_START(harem); 216 DECLARE_VIDEO_START(bagmanmc); 217 218 uint32_t screen_update_galaxold(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); 219 uint32_t screen_update_dambustr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); 220 221 INTERRUPT_GEN_MEMBER(hunchbks_vh_interrupt); 222 TIMER_CALLBACK_MEMBER(stars_blink_callback); 223 TIMER_CALLBACK_MEMBER(stars_scroll_callback); 224 TIMER_DEVICE_CALLBACK_MEMBER(galaxold_interrupt_timer); 225 uint8_t hunchbkg_intack(); 226 227 void state_save_register(); 228 void video_start_common(); 229 void pisces_modify_spritecode(uint8_t *spriteram, int *code, int *flipx, int *flipy, int offs); 230 void mooncrst_modify_spritecode(uint8_t *spriteram, int *code, int *flipx, int *flipy, int offs); 231 void rockclim_draw_background(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); 232 void rockclim_modify_spritecode(uint8_t *spriteram, int *code, int *flipx, int *flipy, int offs); 233 void harem_modify_spritecode(uint8_t *spriteram, int *code, int *flipx, int *flipy, int offs); 234 void mooncrst_modify_charcode(uint16_t *code, uint8_t x); 235 void pisces_modify_charcode(uint16_t *code, uint8_t x); 236 void mimonkey_modify_charcode(uint16_t *code, uint8_t x); 237 void mariner_modify_charcode(uint16_t *code, uint8_t x); 238 void dambustr_modify_charcode(uint16_t *code, uint8_t x); 239 void mshuttle_modify_spritecode(uint8_t *spriteram, int *code, int *flipx, int *flipy, int offs); 240 void mimonkey_modify_spritecode(uint8_t *spriteram, int *code, int *flipx, int *flipy, int offs); 241 void batman2_modify_spritecode(uint8_t *spriteram, int *code, int *flipx, int *flipy, int offs); 242 void dkongjrm_modify_spritecode(uint8_t *spriteram, int *code, int *flipx, int *flipy, int offs); 243 void dkongjrmc_modify_spritecode(uint8_t *spriteram, int *code, int *flipx, int *flipy, int offs); 244 void ad2083_modify_spritecode(uint8_t *spriteram, int *code, int *flipx, int *flipy, int offs); 245 void dambustr_modify_spritecode(uint8_t *spriteram, int *code, int *flipx, int *flipy, int offs); 246 void drivfrcg_modify_color(uint8_t *color); 247 void galaxold_draw_bullets(bitmap_ind16 &bitmap, const rectangle &cliprect, int offs, int x, int y); 248 void scrambold_draw_bullets(bitmap_ind16 &bitmap, const rectangle &cliprect, int offs, int x, int y); 249 void darkplnt_draw_bullets(bitmap_ind16 &bitmap, const rectangle &cliprect, int offs, int x, int y); 250 void dambustr_draw_bullets(bitmap_ind16 &bitmap, const rectangle &cliprect, int offs, int x, int y); 251 void galaxold_draw_background(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); 252 void scrambold_draw_background(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); 253 void ad2083_draw_background(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); 254 void stratgyx_draw_background(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); 255 void minefld_draw_background(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); 256 void rescue_draw_background(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); 257 void mariner_draw_background(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); 258 void dambustr_draw_background(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); 259 void dambustr_draw_upper_background(bitmap_ind16 &bitmap, const rectangle &cliprect); 260 void galaxold_init_stars(int colors_offset); 261 void plot_star(bitmap_ind16 &bitmap, int x, int y, int color, const rectangle &cliprect); 262 void noop_draw_stars(bitmap_ind16 &bitmap, const rectangle &cliprect); 263 void galaxold_draw_stars(bitmap_ind16 &bitmap, const rectangle &cliprect); 264 void scrambold_draw_stars(bitmap_ind16 &bitmap, const rectangle &cliprect); 265 void rescue_draw_stars(bitmap_ind16 &bitmap, const rectangle &cliprect); 266 void mariner_draw_stars(bitmap_ind16 &bitmap, const rectangle &cliprect); 267 void start_stars_blink_timer(double ra, double rb, double c); 268 void start_stars_scroll_timer(); 269 void draw_bullets_common(bitmap_ind16 &bitmap, const rectangle &cliprect); 270 void draw_sprites(bitmap_ind16 &bitmap, uint8_t *spriteram, size_t spriteram_size); 271 void bagmanmc_modify_charcode(uint16_t *code, uint8_t x); 272 void bagmanmc_modify_spritecode(uint8_t *spriteram, int *code, int *flipx, int *flipy, int offs); 273 void machine_reset_common(int line); 274 void galaxian(machine_config &config); 275 void galaxold_base(machine_config &config); 276 void ckongg(machine_config &config); 277 void _4in1(machine_config &config); 278 void bongo(machine_config &config); 279 void racknrol(machine_config &config); 280 void hunchbkg(machine_config &config); 281 void videotron(machine_config &config); 282 void hexpoola(machine_config &config); 283 void dkongjrm(machine_config &config); 284 void tazzmang(machine_config &config); 285 void scrambleo(machine_config &config); 286 void scrambler(machine_config &config); 287 void spcwarp(machine_config &config); 288 void dkongjrmc(machine_config &config); 289 void bagmanmc(machine_config &config); 290 void bullsdrtg(machine_config &config); 291 void drivfrcg(machine_config &config); 292 void rockclim(machine_config &config); 293 void scramblb(machine_config &config); 294 void porter(machine_config &config); 295 void scramb2(machine_config &config); 296 void scramb3(machine_config &config); 297 void ozon1(machine_config &config); 298 void mooncrst(machine_config &config); 299 void guttang(machine_config &config); 300 void ckongmc(machine_config &config); 301 void galaxian_audio(machine_config &config); 302 void mooncrst_audio(machine_config &config); 303 void _4in1_map(address_map &map); 304 void bagmanmc_map(address_map &map); 305 void bongo_map(address_map &map); 306 void bongo_io(address_map &map); 307 void bullsdrtg_data_map(address_map &map); 308 void ckongg_map(address_map &map); 309 void ckongmc_map(address_map &map); 310 void dkongjrm_map(address_map &map); 311 void dkongjrmc_map(address_map &map); 312 void drivfrcg_program(address_map &map); 313 void drivfrcg_io(address_map &map); 314 void galaxold_map(address_map &map); 315 void guttang_map(address_map &map); 316 void hexpoola_data(address_map &map); 317 void hexpoola_io(address_map &map); 318 void hunchbkg_map(address_map &map); 319 void hunchbkg_data(address_map &map); 320 void hustlerb3_map(address_map &map); 321 void mooncrst_map(address_map &map); 322 void ozon1_io_map(address_map &map); 323 void ozon1_map(address_map &map); 324 void racknrol_map(address_map &map); 325 void racknrol_io(address_map &map); 326 void rockclim_map(address_map &map); 327 void scramb_common_map(address_map &map); 328 void scramb2_map(address_map &map); 329 void scramb3_map(address_map &map); 330 void scramblb_map(address_map &map); 331 void scrambleo_map(address_map &map); 332 void scrambler_map(address_map &map); 333 void spcwarp_map(address_map &map); 334 void tazzmang_map(address_map &map); 335 336 protected: machine_start()337 virtual void machine_start() override { m_leds.resolve(); } 338 }; 339 340 #define galaxold_coin_counter_0_w galaxold_coin_counter_w 341 342 #endif 343