1 // license:BSD-3-Clause 2 // copyright-holders:Aaron Giles 3 /************************************************************************* 4 5 Driver for Midway X-unit games. 6 7 **************************************************************************/ 8 #ifndef MAME_INCLUDES_MIDXUNIT_H 9 #define MAME_INCLUDES_MIDXUNIT_H 10 11 #pragma once 12 13 #include "audio/dcs.h" 14 #include "cpu/tms34010/tms34010.h" 15 #include "cpu/pic16c5x/pic16c5x.h" 16 #include "machine/nvram.h" 17 #include "video/midtunit.h" 18 #include "emupal.h" 19 20 21 class midxunit_state : public driver_device 22 { 23 public: midxunit_state(const machine_config & mconfig,device_type type,const char * tag)24 midxunit_state(const machine_config &mconfig, device_type type, const char *tag) 25 : driver_device(mconfig, type, tag) 26 , m_maincpu(*this, "maincpu") 27 , m_video(*this, "video") 28 , m_dcs(*this, "dcs") 29 , m_palette(*this, "palette") 30 , m_gfxrom(*this, "gfxrom") 31 , m_nvram(*this, "nvram") 32 , m_pic(*this, "pic") 33 , m_gun_recoil(*this, "Player%u_Gun_Recoil", 1U) 34 , m_gun_led(*this, "Player%u_Gun_LED", 1U) 35 { } 36 37 void midxunit(machine_config &config); 38 39 protected: 40 virtual void machine_start() override; 41 virtual void machine_reset() override; 42 43 private: 44 uint8_t midxunit_cmos_r(offs_t offset); 45 void midxunit_cmos_w(offs_t offset, uint8_t data); 46 void midxunit_io_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); 47 void midxunit_unknown_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); 48 DECLARE_WRITE_LINE_MEMBER(adc_int_w); 49 uint32_t midxunit_status_r(); 50 uint8_t midxunit_uart_r(offs_t offset); 51 void midxunit_uart_w(offs_t offset, uint8_t data); 52 uint32_t midxunit_security_r(); 53 void midxunit_security_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0); 54 void midxunit_security_clock_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0); 55 DECLARE_WRITE_LINE_MEMBER(midxunit_dcs_output_full); 56 uint32_t midxunit_dma_r(offs_t offset, uint32_t mem_mask = ~0); 57 void midxunit_dma_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0); 58 59 void main_map(address_map &map); 60 61 required_device<tms340x0_device> m_maincpu; 62 required_device<midtunit_video_device> m_video; 63 required_device<dcs_audio_device> m_dcs; 64 required_device<palette_device> m_palette; 65 required_memory_region m_gfxrom; 66 67 required_device<nvram_device> m_nvram; 68 required_device<pic16c57_device> m_pic; 69 output_finder<3> m_gun_recoil; 70 output_finder<3> m_gun_led; 71 72 uint8_t m_cmos_write_enable; 73 uint16_t m_iodata[8]; 74 uint8_t m_uart[8]; 75 bool m_adc_int; 76 std::unique_ptr<uint8_t[]> m_nvram_data; 77 78 uint8_t m_pic_command; 79 uint8_t m_pic_data; 80 uint8_t m_pic_clk; 81 uint8_t m_pic_status; 82 }; 83 84 #endif // MAME_INCLUDES_MIDXUNIT_H 85