1 // license:BSD-3-Clause 2 // copyright-holders:Alex Pasadyn, Zsolt Vasvari, Ernesto Corvi, Aaron Giles 3 // thanks-to:Kurt Mahan 4 /************************************************************************* 5 6 Driver for Midway T-unit games. 7 8 **************************************************************************/ 9 #ifndef MAME_INCLUDES_MIDTUNIT_H 10 #define MAME_INCLUDES_MIDTUNIT_H 11 12 #pragma once 13 14 #include "audio/dcs.h" 15 #include "audio/williams.h" 16 #include "video/midtunit.h" 17 18 #include "cpu/tms34010/tms34010.h" 19 #include "emupal.h" 20 21 22 class midtunit_state : public driver_device 23 { 24 public: midtunit_state(const machine_config & mconfig,device_type type,const char * tag)25 midtunit_state(const machine_config &mconfig, device_type type, const char *tag) : 26 driver_device(mconfig, type, tag), 27 m_maincpu(*this, "maincpu"), 28 m_video(*this, "video"), 29 m_dcs(*this, "dcs"), 30 m_palette(*this, "palette"), 31 m_gfxrom(*this, "gfxrom"), 32 m_cvsd_sound(*this, "cvsd"), 33 m_adpcm_sound(*this, "adpcm"), 34 m_nvram(*this, "nvram") 35 { } 36 37 void tunit_core(machine_config &config); 38 void tunit_adpcm(machine_config &config); 39 void tunit_dcs(machine_config &config); 40 41 void init_mktunit(); 42 void init_mkturbo(); 43 void init_nbajamte(); 44 void init_nbajam(); 45 void init_jdreddp(); 46 void init_mk2(); 47 48 protected: 49 void machine_reset() override; 50 51 required_device<tms340x0_device> m_maincpu; 52 required_device<midtunit_video_device> m_video; 53 optional_device<dcs_audio_device> m_dcs; 54 required_device<palette_device> m_palette; 55 required_memory_region m_gfxrom; 56 57 private: 58 optional_device<williams_cvsd_sound_device> m_cvsd_sound; 59 optional_device<williams_adpcm_sound_device> m_adpcm_sound; 60 61 required_shared_ptr<uint16_t> m_nvram; 62 63 void midtunit_cmos_enable_w(uint16_t data); 64 void midtunit_cmos_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); 65 uint16_t midtunit_cmos_r(offs_t offset); 66 uint16_t midtunit_sound_state_r(); 67 uint16_t midtunit_sound_r(); 68 void midtunit_sound_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); 69 uint16_t mk_prot_r(offs_t offset); 70 void mk_prot_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); 71 uint16_t mkturbo_prot_r(); 72 uint16_t mk2_prot_const_r(); 73 uint16_t mk2_prot_r(); 74 uint16_t mk2_prot_shift_r(); 75 void mk2_prot_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); 76 uint16_t nbajam_prot_r(); 77 void nbajam_prot_w(offs_t offset, uint16_t data); 78 void jdredd_prot_w(offs_t offset, uint16_t data); 79 uint16_t jdredd_prot_r(offs_t offset); 80 81 void register_state_saving(); 82 void init_tunit_generic(int sound); 83 void init_nbajam_common(int te_protection); 84 85 /* CMOS-related variables */ 86 uint8_t m_cmos_write_enable; 87 88 /* sound-related variables */ 89 uint8_t m_chip_type; 90 uint8_t m_fake_sound_state; 91 92 /* protection */ 93 uint8_t m_mk_prot_index; 94 uint16_t m_mk2_prot_data; 95 96 const uint32_t *m_nbajam_prot_table; 97 uint16_t m_nbajam_prot_queue[5]; 98 uint8_t m_nbajam_prot_index; 99 100 const uint8_t *m_jdredd_prot_table; 101 uint8_t m_jdredd_prot_index; 102 uint8_t m_jdredd_prot_max; 103 104 void main_map(address_map &map); 105 }; 106 107 #endif // MAME_INCLUDES_MIDTUNIT_H 108