1 // license:BSD-3-Clause 2 // copyright-holders:Aaron Giles 3 /************************************************************************* 4 5 Cinematronics vector hardware 6 7 *************************************************************************/ 8 #ifndef MAME_INCLUDES_CINEMAT_H 9 #define MAME_INCLUDES_CINEMAT_H 10 11 #pragma once 12 13 #include "cpu/ccpu/ccpu.h" 14 #include "audio/cinemat.h" 15 #include "machine/74259.h" 16 #include "sound/ay8910.h" 17 #include "sound/samples.h" 18 #include "video/vector.h" 19 #include "screen.h" 20 21 class cinemat_state : public driver_device 22 { 23 public: cinemat_state(const machine_config & mconfig,device_type type,const char * tag)24 cinemat_state(const machine_config &mconfig, device_type type, const char *tag) 25 : driver_device(mconfig, type, tag) 26 , m_maincpu(*this, "maincpu") 27 , m_ay1(*this, "ay1") 28 , m_outlatch(*this, "outlatch") 29 , m_vector(*this, "vector") 30 , m_screen(*this, "screen") 31 , m_rambase(*this, "rambase") 32 , m_inputs(*this, "INPUTS") 33 , m_switches(*this, "SWITCHES") 34 , m_wheel(*this, "WHEEL") 35 , m_analog_x(*this, "ANALOGX") 36 , m_analog_y(*this, "ANALOGY") 37 , m_led(*this, "led") 38 , m_pressed(*this, "pressed%u", 0U) 39 , m_coin_detected(0) 40 , m_coin_last_reset(0) 41 , m_mux_select(0) 42 , m_gear(0) 43 , m_vector_color(255, 255, 255) 44 , m_lastx(0) 45 , m_lasty(0) 46 { } 47 48 required_device<ccpu_cpu_device> m_maincpu; 49 optional_device<ay8910_device> m_ay1; 50 required_device<ls259_device> m_outlatch; 51 required_device<vector_device> m_vector; 52 required_device<screen_device> m_screen; 53 optional_shared_ptr<s16> m_rambase; 54 55 required_ioport m_inputs; 56 required_ioport m_switches; 57 optional_ioport m_wheel; 58 optional_ioport m_analog_x; 59 optional_ioport m_analog_y; 60 61 output_finder<> m_led; 62 output_finder<10> m_pressed; 63 64 u8 m_coin_detected; 65 u8 m_coin_last_reset; 66 u8 m_mux_select; 67 u8 m_gear; 68 rgb_t m_vector_color; 69 s16 m_lastx; 70 s16 m_lasty; 71 u8 inputs_r(offs_t offset); 72 u8 switches_r(offs_t offset); 73 u8 coin_input_r(); 74 WRITE_LINE_MEMBER(coin_reset_w); 75 WRITE_LINE_MEMBER(mux_select_w); 76 u8 speedfrk_wheel_r(offs_t offset); 77 u8 speedfrk_gear_r(offs_t offset); 78 virtual DECLARE_WRITE_LINE_MEMBER(vector_control_w); 79 u8 joystick_read(); 80 DECLARE_INPUT_CHANGED_MEMBER(coin_inserted); 81 void init_speedfrk(); 82 u32 screen_update_cinemat(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); 83 u32 screen_update_spacewar(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); 84 void cinemat_vector_callback(s16 sx, s16 sy, s16 ex, s16 ey, u8 shift); 85 void ripoff(machine_config &config); 86 void wotw(machine_config &config); 87 void speedfrk(machine_config &config); 88 void starcas(machine_config &config); 89 void spacewar(machine_config &config); 90 void tailg(machine_config &config); 91 void warrior(machine_config &config); 92 void starhawk(machine_config &config); 93 void barrier(machine_config &config); 94 void armora(machine_config &config); 95 96 template<int Index> DECLARE_WRITE_LINE_MEMBER(speedfrk_gear_change_w)97 DECLARE_WRITE_LINE_MEMBER(speedfrk_gear_change_w) 98 { 99 if (state) 100 m_gear = Index; 101 } 102 speedfrk_gear_number_r()103 ioport_value speedfrk_gear_number_r() 104 { 105 return m_gear; 106 } 107 108 protected: 109 virtual void machine_start() override; 110 virtual void machine_reset() override; 111 112 DECLARE_WRITE_LINE_MEMBER(speedfrk_start_led_w); 113 114 void cinemat_nojmi_4k(machine_config &config); 115 void cinemat_jmi_4k(machine_config &config); 116 void cinemat_nojmi_8k(machine_config &config); 117 void cinemat_jmi_8k(machine_config &config); 118 void cinemat_jmi_16k(machine_config &config); 119 void cinemat_jmi_32k(machine_config &config); 120 121 void program_map_4k(address_map &map); 122 void program_map_8k(address_map &map); 123 void program_map_16k(address_map &map); 124 void program_map_32k(address_map &map); 125 void data_map(address_map &map); 126 void io_map(address_map &map); 127 }; 128 129 130 class cinemat_16level_state : public cinemat_state 131 { 132 public: 133 using cinemat_state::cinemat_state; 134 135 void init_sundance(); 136 137 void sundance(machine_config &config); 138 139 protected: 140 virtual DECLARE_WRITE_LINE_MEMBER(vector_control_w) override; 141 u8 sundance_inputs_r(offs_t offset); 142 }; 143 144 145 class cinemat_64level_state : public cinemat_state 146 { 147 public: 148 using cinemat_state::cinemat_state; 149 150 void solarq(machine_config &config); 151 152 void init_solarq(); 153 154 protected: 155 virtual DECLARE_WRITE_LINE_MEMBER(vector_control_w) override; 156 }; 157 158 159 class cinemat_color_state : public cinemat_state 160 { 161 public: 162 using cinemat_state::cinemat_state; 163 164 void init_boxingb(); 165 166 void boxingb(machine_config &config); 167 void wotwc(machine_config &config); 168 169 protected: 170 virtual DECLARE_WRITE_LINE_MEMBER(vector_control_w) override; 171 u8 boxingb_dial_r(offs_t offset); 172 }; 173 174 175 class demon_state : public cinemat_state 176 { 177 public: 178 using cinemat_state::cinemat_state; 179 180 void demon(machine_config &config); 181 182 protected: 183 TIMER_CALLBACK_MEMBER(synced_sound_w); 184 DECLARE_WRITE_LINE_MEMBER(demon_sound4_w); 185 u8 sound_porta_r(); 186 u8 sound_portb_r(); 187 void sound_portb_w(u8 data); 188 void sound_output_w(u8 data); 189 190 virtual void sound_start() override; 191 virtual void sound_reset() override; 192 193 void demon_sound(machine_config &config); 194 195 void demon_sound_map(address_map &map); 196 void demon_sound_ports(address_map &map); 197 198 private: 199 u8 m_sound_fifo[16]; 200 u8 m_sound_fifo_in; 201 u8 m_sound_fifo_out; 202 u8 m_last_portb_write; 203 }; 204 205 206 class qb3_state : public demon_state 207 { 208 public: 209 using demon_state::demon_state; 210 211 void init_qb3(); 212 213 void qb3(machine_config &config); 214 215 protected: 216 virtual DECLARE_WRITE_LINE_MEMBER(vector_control_w) override; 217 u8 qb3_frame_r(); 218 void qb3_ram_bank_w(u8 data); 219 void qb3_sound_fifo_w(u8 data); 220 221 virtual void sound_reset() override; 222 223 void qb3_sound(machine_config &config); 224 225 void data_map_qb3(address_map &map); 226 void io_map_qb3(address_map &map); 227 228 private: 229 int m_qb3_lastx; 230 int m_qb3_lasty; 231 }; 232 233 #endif // MAME_INCLUDES_CINEMAT_H 234