1 // license:BSD-3-Clause 2 // copyright-holders:Lee Taylor 3 /*************************************************************************** 4 5 Astro Fighter hardware 6 7 ****************************************************************************/ 8 9 #include "machine/timer.h" 10 #include "sound/samples.h" 11 #include "sound/sn76477.h" 12 #include "screen.h" 13 14 class astrof_state : public driver_device 15 { 16 public: astrof_state(const machine_config & mconfig,device_type type,const char * tag)17 astrof_state(const machine_config &mconfig, device_type type, const char *tag) 18 : driver_device(mconfig, type, tag), 19 m_videoram(*this, "videoram"), 20 m_astrof_color(*this, "astrof_color"), 21 m_tomahawk_protection(*this, "tomahawk_prot"), 22 m_fake_port(*this, "FAKE"), 23 m_maincpu(*this, "maincpu"), 24 m_samples(*this, "samples"), 25 m_sn(*this, "snsnd"), 26 m_screen(*this, "screen") { } 27 28 void init_afire(); 29 void init_abattle(); 30 void init_sstarbtl(); 31 void init_acombat3(); 32 void init_asterion(); 33 34 void astrof(machine_config &config); 35 void abattle(machine_config &config); 36 void spfghmk2(machine_config &config); 37 void tomahawk(machine_config &config); 38 void astrof_audio(machine_config &config); 39 void spfghmk2_audio(machine_config &config); 40 void tomahawk_audio(machine_config &config); 41 42 DECLARE_CUSTOM_INPUT_MEMBER(astrof_p1_controls_r); 43 DECLARE_CUSTOM_INPUT_MEMBER(astrof_p2_controls_r); 44 DECLARE_CUSTOM_INPUT_MEMBER(tomahawk_controls_r); 45 DECLARE_INPUT_CHANGED_MEMBER(coin_inserted); 46 DECLARE_INPUT_CHANGED_MEMBER(service_coin_inserted); 47 48 protected: 49 virtual void video_start() override; 50 51 private: 52 /* video-related */ 53 required_shared_ptr<uint8_t> m_videoram; 54 55 std::unique_ptr<uint8_t[]> m_colorram; 56 required_shared_ptr<uint8_t> m_astrof_color; 57 optional_shared_ptr<uint8_t> m_tomahawk_protection; 58 optional_ioport m_fake_port; 59 60 uint8_t m_astrof_palette_bank; 61 uint8_t m_red_on; 62 uint8_t m_flipscreen; 63 uint8_t m_screen_off; 64 uint16_t m_abattle_count; 65 66 /* sound-related */ 67 uint8_t m_port_1_last; 68 uint8_t m_port_2_last; 69 uint8_t m_astrof_start_explosion; 70 uint8_t m_astrof_death_playing; 71 uint8_t m_astrof_bosskill_playing; 72 73 /* devices */ 74 required_device<cpu_device> m_maincpu; 75 optional_device<samples_device> m_samples; // astrof & abattle 76 optional_device<sn76477_device> m_sn; // tomahawk 77 required_device<screen_device> m_screen; 78 uint8_t irq_clear_r(); 79 void astrof_videoram_w(offs_t offset, uint8_t data); 80 void tomahawk_videoram_w(offs_t offset, uint8_t data); 81 void video_control_1_w(uint8_t data); 82 void astrof_video_control_2_w(uint8_t data); 83 void spfghmk2_video_control_2_w(uint8_t data); 84 void tomahawk_video_control_2_w(uint8_t data); 85 uint8_t shoot_r(); 86 uint8_t abattle_coin_prot_r(); 87 uint8_t afire_coin_prot_r(); 88 uint8_t tomahawk_protection_r(); 89 void astrof_audio_1_w(uint8_t data); 90 void astrof_audio_2_w(uint8_t data); 91 void spfghmk2_audio_w(uint8_t data); 92 void tomahawk_audio_w(uint8_t data); 93 DECLARE_MACHINE_START(astrof); 94 DECLARE_MACHINE_START(abattle); 95 DECLARE_MACHINE_RESET(abattle); 96 DECLARE_MACHINE_START(spfghmk2); 97 DECLARE_MACHINE_START(tomahawk); 98 uint32_t screen_update_astrof(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); 99 uint32_t screen_update_tomahawk(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); 100 TIMER_DEVICE_CALLBACK_MEMBER(irq_callback); 101 rgb_t make_pen( uint8_t data ); 102 void astrof_get_pens( pen_t *pens ); 103 void tomahawk_get_pens( pen_t *pens ); 104 void astrof_set_video_control_2( uint8_t data ); 105 void spfghmk2_set_video_control_2( uint8_t data ); 106 void tomahawk_set_video_control_2( uint8_t data ); 107 void video_update_common( bitmap_rgb32 &bitmap, const rectangle &cliprect, pen_t *pens, int num_pens ); 108 void base(machine_config &config); 109 void astrof_map(address_map &map); 110 void spfghmk2_map(address_map &map); 111 void tomahawk_map(address_map &map); 112 }; 113