1 // license:BSD-3-Clause 2 // copyright-holders:David Graves, Bryan McPhail, Brad Oliver, Andrew Prime, Brian Troha, Nicola Salmoria 3 #ifndef MAME_INCLUDES_TAITO_F2_H 4 #define MAME_INCLUDES_TAITO_F2_H 5 6 #pragma once 7 8 #include "machine/taitocchip.h" 9 #include "machine/taitoio.h" 10 11 #include "sound/okim6295.h" 12 #include "video/tc0100scn.h" 13 #include "video/tc0110pcr.h" 14 #include "video/tc0280grd.h" 15 #include "video/tc0360pri.h" 16 #include "video/tc0480scp.h" 17 #include "machine/timer.h" 18 #include "emupal.h" 19 #include "screen.h" 20 21 class taitof2_state : public driver_device 22 { 23 public: taitof2_state(const machine_config & mconfig,device_type type,const char * tag)24 taitof2_state(const machine_config &mconfig, device_type type, const char *tag) 25 : driver_device(mconfig, type, tag) 26 , m_sprite_extension(*this, "sprite_ext") 27 , m_spriteram(*this, "spriteram") 28 , m_maincpu(*this, "maincpu") 29 , m_audiocpu(*this, "audiocpu") 30 , m_cchip(*this, "cchip") 31 , m_cchip_irq_clear(*this, "cchip_irq_clear") 32 , m_oki(*this, "oki") 33 , m_tc0100scn(*this, "tc0100scn_%u", 1U) 34 , m_tc0110pcr(*this, "tc0110pcr") 35 , m_tc0360pri(*this, "tc0360pri") 36 , m_tc0280grd(*this, "tc0280grd") 37 , m_tc0430grw(*this, "tc0430grw") 38 , m_tc0480scp(*this, "tc0480scp") 39 , m_tc0220ioc(*this, "tc0220ioc") 40 , m_tc0510nio(*this, "tc0510nio") 41 , m_gfxdecode(*this, "gfxdecode") 42 , m_screen(*this, "screen") 43 , m_palette(*this, "palette") 44 , m_io_paddle(*this, "PADDLE%u", 1U) 45 , m_io_in(*this, "IN%u", 0U) 46 , m_io_dswa(*this, "DSWA") 47 , m_io_dswb(*this, "DSWB") 48 , m_audiobank(*this, "audiobank") 49 , m_okibank(*this, "okibank") 50 { } 51 52 53 void taito_f2_tc0220ioc(machine_config &config); 54 void taito_f2_tc0510nio(machine_config &config); 55 void taito_f2_te7750(machine_config &config); 56 void taito_f2_tc0110pcr(machine_config &config); 57 void taito_f2(machine_config &config); 58 void thundfox(machine_config &config); 59 void dinorex(machine_config &config); 60 void mjnquest(machine_config &config); 61 void cameltrya(machine_config &config); 62 void koshien(machine_config &config); 63 void qzchikyu(machine_config &config); 64 void metalb(machine_config &config); 65 void yesnoj(machine_config &config); 66 void quizhq(machine_config &config); 67 void dondokod(machine_config &config); 68 void qcrayon2(machine_config &config); 69 void qtorimon(machine_config &config); 70 void driftout(machine_config &config); 71 void solfigtr(machine_config &config); 72 void qzquest(machine_config &config); 73 void liquidk(machine_config &config); 74 void deadconx(machine_config &config); 75 void ssi(machine_config &config); 76 void pulirula(machine_config &config); 77 void growl(machine_config &config); 78 void ninjak(machine_config &config); 79 void footchmp(machine_config &config); 80 void cameltry(machine_config &config); 81 void finalb(machine_config &config); 82 void hthero(machine_config &config); 83 void driveout(machine_config &config); 84 void gunfront(machine_config &config); 85 void qcrayon(machine_config &config); 86 void megab(machine_config &config); 87 void qjinsei(machine_config &config); 88 void deadconxj(machine_config &config); 89 void footchmpbl(machine_config &config); 90 void yuyugogo(machine_config &config); 91 92 void init_driveout(); 93 void init_cameltry(); 94 void init_mjnquest(); 95 void init_finalb(); 96 97 protected: 98 virtual void machine_start() override; 99 virtual void video_start() override; 100 101 enum 102 { 103 TIMER_INTERRUPT6 104 }; 105 106 struct f2_tempsprite 107 { 108 u32 code = 0, color = 0; 109 bool flipx = false, flipy = false; 110 int x = 0, y = 0; 111 int zoomx = 0, zoomy = 0; 112 u64 primask = 0; 113 }; 114 /* memory pointers */ 115 optional_shared_ptr<u16> m_sprite_extension; 116 required_shared_ptr<u16> m_spriteram; 117 std::unique_ptr<u16[]> m_spriteram_buffered; 118 std::unique_ptr<u16[]> m_spriteram_delayed; 119 120 /* video-related */ 121 std::unique_ptr<f2_tempsprite[]> m_spritelist; 122 int m_sprite_type; 123 124 u16 m_spritebank[8]; 125 // u16 m_spritebank_eof[8]; 126 u16 m_spritebank_buffered[8]; 127 128 bool m_sprites_disabled; 129 s32 m_sprites_active_area; 130 s32 m_sprites_master_scrollx; 131 s32 m_sprites_master_scrolly; 132 /* remember flip status over frames because driftout can fail to set it */ 133 bool m_sprites_flipscreen; 134 135 /* On the left hand screen edge (assuming horiz screen, no 136 screenflip: in screenflip it is the right hand edge etc.) 137 there may be 0-3 unwanted pixels in both tilemaps *and* 138 sprites. To erase this we use f2_hide_pixels (0 to +3). */ 139 140 s32 m_hide_pixels; 141 s32 m_flip_hide_pixels; /* Different in some games */ 142 143 s32 m_pivot_xdisp; /* Needed in games with a pivot layer */ 144 s32 m_pivot_ydisp; 145 146 s32 m_game; 147 148 u8 m_tilepri[6]; // todo - move into taitoic.c 149 u8 m_spritepri[6]; // todo - move into taitoic.c 150 u8 m_spriteblendmode; // todo - move into taitoic.c 151 152 int m_prepare_sprites; 153 u8 m_gfxbank; 154 155 /* misc */ 156 s32 m_mjnquest_input; 157 int m_last[2]; 158 int m_nibble; 159 s32 m_driveout_sound_latch; 160 emu_timer *m_int6_timer; 161 162 /* devices */ 163 required_device<cpu_device> m_maincpu; 164 required_device<cpu_device> m_audiocpu; 165 optional_device<taito_cchip_device> m_cchip; 166 optional_device<timer_device> m_cchip_irq_clear; 167 optional_device<okim6295_device> m_oki; 168 optional_device_array<tc0100scn_device, 2> m_tc0100scn; 169 optional_device<tc0110pcr_device> m_tc0110pcr; 170 optional_device<tc0360pri_device> m_tc0360pri; 171 optional_device<tc0280grd_device> m_tc0280grd; 172 optional_device<tc0280grd_device> m_tc0430grw; 173 optional_device<tc0480scp_device> m_tc0480scp; 174 optional_device<tc0220ioc_device> m_tc0220ioc; 175 optional_device<tc0510nio_device> m_tc0510nio; 176 required_device<gfxdecode_device> m_gfxdecode; 177 required_device<screen_device> m_screen; 178 optional_device<palette_device> m_palette; 179 180 optional_ioport_array<2> m_io_paddle; 181 optional_ioport_array<7> m_io_in; 182 optional_ioport m_io_dswa; 183 optional_ioport m_io_dswb; 184 185 optional_memory_bank m_audiobank; 186 optional_memory_bank m_okibank; 187 188 void coin_nibble_w(u8 data); 189 void growl_coin_word_w(u8 data); 190 void _4p_coin_word_w(u8 data); 191 u16 cameltry_paddle_r(offs_t offset); 192 u16 mjnquest_dsw_r(offs_t offset); 193 u16 mjnquest_input_r(); 194 void mjnquest_inputselect_w(u16 data); 195 void sound_bankswitch_w(u8 data); 196 u8 driveout_sound_command_r(); 197 void oki_bank_w(u8 data); 198 void driveout_sound_command_w(offs_t offset, u8 data); 199 void sprite_extension_w(offs_t offset, u16 data, u16 mem_mask = ~0); 200 void spritebank_w(offs_t offset, u16 data); 201 void koshien_spritebank_w(u16 data); 202 void cameltrya_porta_w(u8 data); 203 void mjnquest_gfxbank_w(u8 data); 204 TC0100SCN_CB_MEMBER(mjnquest_tmap_cb); 205 206 DECLARE_VIDEO_START(dondokod); 207 DECLARE_VIDEO_START(driftout); 208 DECLARE_VIDEO_START(finalb); 209 DECLARE_VIDEO_START(megab); 210 DECLARE_VIDEO_START(thundfox); 211 DECLARE_VIDEO_START(ssi); 212 DECLARE_VIDEO_START(gunfront); 213 DECLARE_VIDEO_START(growl); 214 DECLARE_VIDEO_START(mjnquest); 215 DECLARE_VIDEO_START(footchmp); 216 DECLARE_VIDEO_START(hthero); 217 DECLARE_VIDEO_START(koshien); 218 DECLARE_VIDEO_START(yuyugogo); 219 DECLARE_VIDEO_START(ninjak); 220 DECLARE_VIDEO_START(solfigtr); 221 DECLARE_VIDEO_START(pulirula); 222 DECLARE_VIDEO_START(metalb); 223 DECLARE_VIDEO_START(qzchikyu); 224 DECLARE_VIDEO_START(yesnoj); 225 DECLARE_VIDEO_START(deadconx); 226 DECLARE_VIDEO_START(deadconxj); 227 DECLARE_VIDEO_START(dinorex); 228 DECLARE_VIDEO_START(quiz); 229 u32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); 230 u32 screen_update_pri_roz(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); 231 u32 screen_update_pri(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); 232 u32 screen_update_thundfox(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); 233 u32 screen_update_ssi(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); 234 u32 screen_update_deadconx(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); 235 u32 screen_update_yesnoj(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); 236 u32 screen_update_metalb(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); 237 DECLARE_WRITE_LINE_MEMBER(screen_vblank_no_buffer); 238 DECLARE_WRITE_LINE_MEMBER(screen_vblank_partial_buffer_delayed); 239 DECLARE_WRITE_LINE_MEMBER(screen_vblank_partial_buffer_delayed_thundfox); 240 DECLARE_WRITE_LINE_MEMBER(screen_vblank_full_buffer_delayed); 241 DECLARE_WRITE_LINE_MEMBER(screen_vblank_partial_buffer_delayed_qzchikyu); 242 INTERRUPT_GEN_MEMBER(interrupt); 243 INTERRUPT_GEN_MEMBER(megab_interrupt); 244 TIMER_DEVICE_CALLBACK_MEMBER(cchip_irq_clear_cb); 245 void core_vh_start(int sprite_type, int hide, int flip_hide); 246 void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, u64 *primasks, int uses_tc360_mixer); 247 void update_spritebanks(); 248 void handle_sprite_buffering(); 249 void update_sprites_active_area(); 250 void draw_roz_layer(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, u8 priority, u8 priority_mask = 0xff); 251 void taito_f2_tc360_spritemixdraw(screen_device &screen, bitmap_ind16 &dest_bmp, const rectangle &clip, gfx_element *gfx, 252 u32 code, u32 color, int flipx, int flipy, int sx, int sy, int scalex, int scaley, u64 primask = 0, bool use_mixer = false); 253 254 void cameltry_map(address_map &map); 255 void cameltrya_map(address_map &map); 256 void cameltrya_sound_map(address_map &map); 257 void deadconx_map(address_map &map); 258 void dinorex_map(address_map &map); 259 void dondokod_map(address_map &map); 260 void driftout_map(address_map &map); 261 void driveout_map(address_map &map); 262 void driveout_oki_map(address_map &map); 263 void driveout_sound_map(address_map &map); 264 void finalb_map(address_map &map); 265 void footchmp_map(address_map &map); 266 void growl_map(address_map &map); 267 void gunfront_map(address_map &map); 268 void koshien_map(address_map &map); 269 void liquidk_map(address_map &map); 270 void megab_map(address_map &map); 271 void metalb_map(address_map &map); 272 void mjnquest_map(address_map &map); 273 void ninjak_map(address_map &map); 274 void pulirula_map(address_map &map); 275 void qcrayon2_map(address_map &map); 276 void qcrayon_map(address_map &map); 277 void qjinsei_map(address_map &map); 278 void qtorimon_map(address_map &map); 279 void quizhq_map(address_map &map); 280 void qzchikyu_map(address_map &map); 281 void qzquest_map(address_map &map); 282 void solfigtr_map(address_map &map); 283 void sound_map(address_map &map); 284 void ssi_map(address_map &map); 285 void thundfox_map(address_map &map); 286 void yesnoj_map(address_map &map); 287 void yuyugogo_map(address_map &map); 288 289 virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; 290 }; 291 292 #endif // MAME_INCLUDES_TAITO_F2_H 293