1 // license:BSD-3-Clause 2 // copyright-holders:David Haywood, Paul Priest 3 #ifndef MAME_INCLUDES_ONESHOT_H 4 #define MAME_INCLUDES_ONESHOT_H 5 6 #pragma once 7 8 #include "sound/okim6295.h" 9 #include "emupal.h" 10 #include "tilemap.h" 11 12 class oneshot_state : public driver_device 13 { 14 public: oneshot_state(const machine_config & mconfig,device_type type,const char * tag)15 oneshot_state(const machine_config &mconfig, device_type type, const char *tag) : 16 driver_device(mconfig, type, tag), 17 m_spriteram(*this, "spriteram"), 18 m_bg_videoram(*this, "bg_videoram"), 19 m_mid_videoram(*this, "mid_videoram"), 20 m_fg_videoram(*this, "fg_videoram"), 21 m_scroll(*this, "scroll"), 22 m_io_dsw1(*this, "DSW1"), 23 m_io_lightgun_x(*this, "LIGHT%u_X", 0U), 24 m_io_lightgun_y(*this, "LIGHT%u_Y", 0U), 25 m_maincpu(*this, "maincpu"), 26 m_oki(*this, "oki"), 27 m_gfxdecode(*this, "gfxdecode"), 28 m_palette(*this, "palette") 29 { } 30 31 void maddonna(machine_config &config); 32 void komocomo(machine_config &config); 33 void oneshot(machine_config &config); 34 35 protected: 36 virtual void machine_start() override; 37 virtual void machine_reset() override; 38 virtual void video_start() override; 39 40 private: 41 /* memory pointers */ 42 required_shared_ptr<u16> m_spriteram; 43 required_shared_ptr<u16> m_bg_videoram; 44 required_shared_ptr<u16> m_mid_videoram; 45 required_shared_ptr<u16> m_fg_videoram; 46 required_shared_ptr<u16> m_scroll; 47 48 optional_ioport m_io_dsw1; 49 optional_ioport_array<2> m_io_lightgun_x; 50 optional_ioport_array<2> m_io_lightgun_y; 51 52 /* video-related */ 53 tilemap_t *m_bg_tilemap; 54 tilemap_t *m_mid_tilemap; 55 tilemap_t *m_fg_tilemap; 56 57 /* misc */ 58 int m_gun_x_p1; 59 int m_gun_y_p1; 60 int m_gun_x_p2; 61 int m_gun_y_p2; 62 int m_gun_x_shift; 63 int m_p1_wobble; 64 int m_p2_wobble; 65 66 /* devices */ 67 required_device<cpu_device> m_maincpu; 68 required_device<okim6295_device> m_oki; 69 required_device<gfxdecode_device> m_gfxdecode; 70 required_device<palette_device> m_palette; 71 72 u16 oneshot_in0_word_r(); 73 u16 oneshot_gun_x_p1_r(); 74 u16 oneshot_gun_y_p1_r(); 75 u16 oneshot_gun_x_p2_r(); 76 u16 oneshot_gun_y_p2_r(); 77 void bg_videoram_w(offs_t offset, u16 data, u16 mem_mask = ~0); 78 void mid_videoram_w(offs_t offset, u16 data, u16 mem_mask = ~0); 79 void fg_videoram_w(offs_t offset, u16 data, u16 mem_mask = ~0); 80 void soundbank_w(u8 data); 81 TILE_GET_INFO_MEMBER(get_bg_tile_info); 82 TILE_GET_INFO_MEMBER(get_mid_tile_info); 83 TILE_GET_INFO_MEMBER(get_fg_tile_info); 84 u32 screen_update_oneshot(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); 85 u32 screen_update_maddonna(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); 86 u32 screen_update_komocomo(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); 87 void draw_crosshairs(); 88 void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); 89 void mem_map(address_map &map); 90 void sound_map(address_map &map); 91 }; 92 93 #endif // MAME_INCLUDES_ONESHOT_H 94