1 // license:BSD-3-Clause 2 // copyright-holders:Aaron Giles 3 /************************************************************************* 4 5 Exidy 440 hardware 6 7 *************************************************************************/ 8 #ifndef MAME_INCLUDES_EXIDY440_H 9 #define MAME_INCLUDES_EXIDY440_H 10 11 #pragma once 12 13 #include "audio/exidy440.h" 14 #include "emupal.h" 15 #include "screen.h" 16 17 #define EXIDY440_MASTER_CLOCK (XTAL(12'979'200)) 18 19 20 class exidy440_state : public driver_device 21 { 22 public: exidy440_state(const machine_config & mconfig,device_type type,const char * tag)23 exidy440_state(const machine_config &mconfig, device_type type, const char *tag) : 24 driver_device(mconfig, type, tag), 25 m_imageram(*this, "imageram"), 26 m_spriteram(*this, "spriteram"), 27 m_scanline(*this, "scanline"), 28 m_maincpu(*this, "maincpu"), 29 m_custom(*this, "440audio"), 30 m_screen(*this, "screen"), 31 m_palette(*this, "palette") 32 { } 33 34 DECLARE_READ_LINE_MEMBER(firq_beam_r); 35 DECLARE_READ_LINE_MEMBER(firq_vblank_r); 36 DECLARE_CUSTOM_INPUT_MEMBER(hitnmiss_button1_r); 37 DECLARE_INPUT_CHANGED_MEMBER(coin_inserted); 38 void init_showdown(); 39 void init_yukon(); 40 void init_exidy440(); 41 void init_claypign(); 42 void exidy440(machine_config &config); 43 44 protected: 45 void bankram_w(offs_t offset, uint8_t data); 46 uint8_t exidy440_input_port_3_r(); 47 uint8_t sound_command_ack_r(); 48 void sound_command_w(uint8_t data); 49 void exidy440_input_port_3_w(uint8_t data); 50 void exidy440_coin_counter_w(uint8_t data); 51 uint8_t showdown_bank0_r(offs_t offset); 52 uint8_t claypign_protection_r(); 53 uint8_t exidy440_videoram_r(offs_t offset); 54 void exidy440_videoram_w(offs_t offset, uint8_t data); 55 uint8_t exidy440_paletteram_r(offs_t offset); 56 void exidy440_paletteram_w(offs_t offset, uint8_t data); 57 uint8_t exidy440_horizontal_pos_r(); 58 uint8_t exidy440_vertical_pos_r(); 59 void exidy440_spriteram_w(offs_t offset, uint8_t data); 60 void exidy440_control_w(offs_t offset, uint8_t data); 61 void exidy440_interrupt_clear_w(uint8_t data); 62 void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int scroll_offset, int check_collision); 63 void update_screen(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int scroll_offset, int check_collision); 64 uint32_t screen_update_exidy440(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); 65 DECLARE_WRITE_LINE_MEMBER(vblank_interrupt_w); 66 TIMER_CALLBACK_MEMBER(delayed_sound_command_w); 67 TIMER_CALLBACK_MEMBER(beam_firq_callback); 68 TIMER_CALLBACK_MEMBER(collide_firq_callback); 69 void exidy440_update_firq(); 70 void exidy440_bank_select(uint8_t bank); 71 72 virtual void machine_start() override; 73 virtual void machine_reset() override; 74 virtual void video_start() override; 75 void exidy440_video(machine_config &config); 76 void exidy440_map(address_map &map); 77 78 required_shared_ptr<uint8_t> m_imageram; 79 required_shared_ptr<uint8_t> m_spriteram; 80 required_shared_ptr<uint8_t> m_scanline; 81 82 required_device<cpu_device> m_maincpu; 83 required_device<exidy440_sound_device> m_custom; 84 required_device<screen_device> m_screen; 85 required_device<palette_device> m_palette; 86 87 private: 88 uint8_t m_bank; 89 const uint8_t *m_showdown_bank_data[2]; 90 int8_t m_showdown_bank_select; 91 uint8_t m_showdown_bank_offset; 92 uint8_t m_firq_vblank; 93 uint8_t m_firq_beam; 94 uint8_t m_latched_x; 95 std::unique_ptr<uint8_t[]> m_local_videoram; 96 std::unique_ptr<uint8_t[]> m_local_paletteram; 97 uint8_t m_firq_enable; 98 uint8_t m_firq_select; 99 uint8_t m_palettebank_io; 100 uint8_t m_palettebank_vis; 101 emu_timer *m_beam_firq_timer; 102 emu_timer *m_collide_firq_timer; 103 uint8_t m_beam_firq_count; 104 }; 105 106 107 class topsecex_state : public exidy440_state 108 { 109 public: 110 using exidy440_state::exidy440_state; 111 void init_topsecex(); 112 void topsecex(machine_config &config); 113 114 protected: 115 void topsecex_video(machine_config &config); 116 uint8_t topsecex_input_port_5_r(); 117 void topsecex_yscroll_w(uint8_t data); 118 uint32_t screen_update_topsecex(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); 119 120 virtual void video_start() override; 121 122 private: 123 uint8_t m_topsecex_yscroll; 124 }; 125 126 #endif // MAME_INCLUDES_EXIDY440_H 127