src/mess/machine/x1.c
| r0 | r8362 | |
| 1 | #include "emu.h" |
| 2 | #include "includes/x1.h" |
| 3 | |
| 4 | //************************************************************************** |
| 5 | // DEVICE CONFIGURATION |
| 6 | //************************************************************************** |
| 7 | |
| 8 | //------------------------------------------------- |
| 9 | // x1_keyboard_device_config - constructor |
| 10 | //------------------------------------------------- |
| 11 | |
| 12 | x1_keyboard_device_config::x1_keyboard_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock) |
| 13 | : device_config(mconfig, static_alloc_device_config, tag, owner, clock), |
| 14 | device_config_z80daisy_interface(mconfig, *this) |
| 15 | { |
| 16 | } |
| 17 | |
| 18 | |
| 19 | //------------------------------------------------- |
| 20 | // static_alloc_device_config - allocate a new |
| 21 | // configuration object |
| 22 | //------------------------------------------------- |
| 23 | |
| 24 | device_config *x1_keyboard_device_config::static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock) |
| 25 | { |
| 26 | return global_alloc(x1_keyboard_device_config(mconfig, tag, owner, clock)); |
| 27 | } |
| 28 | |
| 29 | |
| 30 | //------------------------------------------------- |
| 31 | // alloc_device - allocate a new device object |
| 32 | //------------------------------------------------- |
| 33 | |
| 34 | device_t *x1_keyboard_device_config::alloc_device(running_machine &machine) const |
| 35 | { |
| 36 | return auto_alloc(&machine, x1_keyboard_device(machine, *this)); |
| 37 | } |
| 38 | |
| 39 | //************************************************************************** |
| 40 | // LIVE DEVICE |
| 41 | //************************************************************************** |
| 42 | |
| 43 | //------------------------------------------------- |
| 44 | // z80ctc_device - constructor |
| 45 | //------------------------------------------------- |
| 46 | |
| 47 | x1_keyboard_device::x1_keyboard_device(running_machine &_machine, const x1_keyboard_device_config &_config) |
| 48 | : device_t(_machine, _config), |
| 49 | device_z80daisy_interface(_machine, _config, *this), |
| 50 | m_config(_config) |
| 51 | { |
| 52 | } |
| 53 | |
| 54 | //------------------------------------------------- |
| 55 | // device_start - device-specific startup |
| 56 | //------------------------------------------------- |
| 57 | |
| 58 | void x1_keyboard_device::device_start() |
| 59 | { |
| 60 | } |
| 61 | |
| 62 | //************************************************************************** |
| 63 | // DAISY CHAIN INTERFACE |
| 64 | //************************************************************************** |
| 65 | |
| 66 | //------------------------------------------------- |
| 67 | // z80daisy_irq_state - return the overall IRQ |
| 68 | // state for this device |
| 69 | //------------------------------------------------- |
| 70 | |
| 71 | int x1_keyboard_device::z80daisy_irq_state() |
| 72 | { |
| 73 | if(x1_key_irq_flag != 0) |
| 74 | return Z80_DAISY_INT; |
| 75 | return 0; |
| 76 | } |
| 77 | |
| 78 | |
| 79 | //------------------------------------------------- |
| 80 | // z80daisy_irq_ack - acknowledge an IRQ and |
| 81 | // return the appropriate vector |
| 82 | //------------------------------------------------- |
| 83 | |
| 84 | int x1_keyboard_device::z80daisy_irq_ack() |
| 85 | { |
| 86 | x1_key_irq_flag = 0; |
| 87 | cputag_set_input_line(device().machine,"maincpu",INPUT_LINE_IRQ0,CLEAR_LINE); |
| 88 | return x1_key_irq_vector; |
| 89 | } |
| 90 | |
| 91 | //------------------------------------------------- |
| 92 | // z80daisy_irq_reti - clear the interrupt |
| 93 | // pending state to allow other interrupts through |
| 94 | //------------------------------------------------- |
| 95 | |
| 96 | void x1_keyboard_device::z80daisy_irq_reti() |
| 97 | { |
| 98 | } |
| 99 | |
| 100 | const device_type X1_KEYBOARD = x1_keyboard_device_config::static_alloc_device_config; |
src/mess/machine/einstein.c
| r0 | r8362 | |
| 1 | #include "emu.h" |
| 2 | #include "includes/einstein.h" |
| 3 | |
| 4 | /**************************************************************** |
| 5 | EINSTEIN NON-Z80 DEVICES DAISY CHAIN SUPPORT |
| 6 | ****************************************************************/ |
| 7 | |
| 8 | //************************************************************************** |
| 9 | // DEVICE CONFIGURATION |
| 10 | //************************************************************************** |
| 11 | |
| 12 | //------------------------------------------------- |
| 13 | // einstein_keyboard_daisy_device_config - constructor |
| 14 | //------------------------------------------------- |
| 15 | |
| 16 | einstein_keyboard_daisy_device_config::einstein_keyboard_daisy_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock) |
| 17 | : device_config(mconfig, static_alloc_device_config, tag, owner, clock), |
| 18 | device_config_z80daisy_interface(mconfig, *this) |
| 19 | { |
| 20 | } |
| 21 | |
| 22 | |
| 23 | //------------------------------------------------- |
| 24 | // static_alloc_device_config - allocate a new |
| 25 | // configuration object |
| 26 | //------------------------------------------------- |
| 27 | |
| 28 | device_config *einstein_keyboard_daisy_device_config::static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock) |
| 29 | { |
| 30 | return global_alloc(einstein_keyboard_daisy_device_config(mconfig, tag, owner, clock)); |
| 31 | } |
| 32 | |
| 33 | |
| 34 | //------------------------------------------------- |
| 35 | // alloc_device - allocate a new device object |
| 36 | //------------------------------------------------- |
| 37 | |
| 38 | device_t *einstein_keyboard_daisy_device_config::alloc_device(running_machine &machine) const |
| 39 | { |
| 40 | return auto_alloc(&machine, einstein_keyboard_daisy_device(machine, *this)); |
| 41 | } |
| 42 | |
| 43 | //************************************************************************** |
| 44 | // LIVE DEVICE |
| 45 | //************************************************************************** |
| 46 | |
| 47 | //------------------------------------------------- |
| 48 | // z80ctc_device - constructor |
| 49 | //------------------------------------------------- |
| 50 | |
| 51 | einstein_keyboard_daisy_device::einstein_keyboard_daisy_device(running_machine &_machine, const einstein_keyboard_daisy_device_config &_config) |
| 52 | : device_t(_machine, _config), |
| 53 | device_z80daisy_interface(_machine, _config, *this), |
| 54 | m_config(_config) |
| 55 | { |
| 56 | } |
| 57 | |
| 58 | //------------------------------------------------- |
| 59 | // device_start - device-specific startup |
| 60 | //------------------------------------------------- |
| 61 | |
| 62 | void einstein_keyboard_daisy_device::device_start() |
| 63 | { |
| 64 | } |
| 65 | |
| 66 | //************************************************************************** |
| 67 | // DAISY CHAIN INTERFACE |
| 68 | //************************************************************************** |
| 69 | |
| 70 | //------------------------------------------------- |
| 71 | // z80daisy_irq_state - return the overall IRQ |
| 72 | // state for this device |
| 73 | //------------------------------------------------- |
| 74 | |
| 75 | int einstein_keyboard_daisy_device::z80daisy_irq_state() |
| 76 | { |
| 77 | einstein_state *einstein = (einstein_state *)device().machine->driver_data; |
| 78 | |
| 79 | if (einstein->interrupt & einstein->interrupt_mask & EINSTEIN_KEY_INT) |
| 80 | return Z80_DAISY_INT; |
| 81 | |
| 82 | return 0; |
| 83 | } |
| 84 | |
| 85 | |
| 86 | //------------------------------------------------- |
| 87 | // z80daisy_irq_ack - acknowledge an IRQ and |
| 88 | // return the appropriate vector |
| 89 | //------------------------------------------------- |
| 90 | |
| 91 | int einstein_keyboard_daisy_device::z80daisy_irq_ack() |
| 92 | { |
| 93 | return 0xf7; |
| 94 | } |
| 95 | |
| 96 | //------------------------------------------------- |
| 97 | // z80daisy_irq_reti - clear the interrupt |
| 98 | // pending state to allow other interrupts through |
| 99 | //------------------------------------------------- |
| 100 | |
| 101 | void einstein_keyboard_daisy_device::z80daisy_irq_reti() |
| 102 | { |
| 103 | } |
| 104 | |
| 105 | const device_type EINSTEIN_KEYBOARD_DAISY = einstein_keyboard_daisy_device_config::static_alloc_device_config; |
| 106 | |
| 107 | //************************************************************************** |
| 108 | // DEVICE CONFIGURATION |
| 109 | //************************************************************************** |
| 110 | |
| 111 | //------------------------------------------------- |
| 112 | // einstein_adc_daisy_device_config - constructor |
| 113 | //------------------------------------------------- |
| 114 | |
| 115 | einstein_adc_daisy_device_config::einstein_adc_daisy_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock) |
| 116 | : device_config(mconfig, static_alloc_device_config, tag, owner, clock), |
| 117 | device_config_z80daisy_interface(mconfig, *this) |
| 118 | { |
| 119 | } |
| 120 | |
| 121 | |
| 122 | //------------------------------------------------- |
| 123 | // static_alloc_device_config - allocate a new |
| 124 | // configuration object |
| 125 | //------------------------------------------------- |
| 126 | |
| 127 | device_config *einstein_adc_daisy_device_config::static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock) |
| 128 | { |
| 129 | return global_alloc(einstein_adc_daisy_device_config(mconfig, tag, owner, clock)); |
| 130 | } |
| 131 | |
| 132 | |
| 133 | //------------------------------------------------- |
| 134 | // alloc_device - allocate a new device object |
| 135 | //------------------------------------------------- |
| 136 | |
| 137 | device_t *einstein_adc_daisy_device_config::alloc_device(running_machine &machine) const |
| 138 | { |
| 139 | return auto_alloc(&machine, einstein_adc_daisy_device(machine, *this)); |
| 140 | } |
| 141 | |
| 142 | //************************************************************************** |
| 143 | // LIVE DEVICE |
| 144 | //************************************************************************** |
| 145 | |
| 146 | //------------------------------------------------- |
| 147 | // z80ctc_device - constructor |
| 148 | //------------------------------------------------- |
| 149 | |
| 150 | einstein_adc_daisy_device::einstein_adc_daisy_device(running_machine &_machine, const einstein_adc_daisy_device_config &_config) |
| 151 | : device_t(_machine, _config), |
| 152 | device_z80daisy_interface(_machine, _config, *this), |
| 153 | m_config(_config) |
| 154 | { |
| 155 | } |
| 156 | |
| 157 | //------------------------------------------------- |
| 158 | // device_start - device-specific startup |
| 159 | //------------------------------------------------- |
| 160 | |
| 161 | void einstein_adc_daisy_device::device_start() |
| 162 | { |
| 163 | } |
| 164 | |
| 165 | //************************************************************************** |
| 166 | // DAISY CHAIN INTERFACE |
| 167 | //************************************************************************** |
| 168 | |
| 169 | //------------------------------------------------- |
| 170 | // z80daisy_irq_state - return the overall IRQ |
| 171 | // state for this device |
| 172 | //------------------------------------------------- |
| 173 | |
| 174 | int einstein_adc_daisy_device::z80daisy_irq_state() |
| 175 | { |
| 176 | einstein_state *einstein = (einstein_state *)device().machine->driver_data; |
| 177 | |
| 178 | if (einstein->interrupt & einstein->interrupt_mask & EINSTEIN_ADC_INT) |
| 179 | return Z80_DAISY_INT; |
| 180 | |
| 181 | return 0; |
| 182 | } |
| 183 | |
| 184 | |
| 185 | //------------------------------------------------- |
| 186 | // z80daisy_irq_ack - acknowledge an IRQ and |
| 187 | // return the appropriate vector |
| 188 | //------------------------------------------------- |
| 189 | |
| 190 | int einstein_adc_daisy_device::z80daisy_irq_ack() |
| 191 | { |
| 192 | return 0xfb; |
| 193 | } |
| 194 | |
| 195 | //------------------------------------------------- |
| 196 | // z80daisy_irq_reti - clear the interrupt |
| 197 | // pending state to allow other interrupts through |
| 198 | //------------------------------------------------- |
| 199 | |
| 200 | void einstein_adc_daisy_device::z80daisy_irq_reti() |
| 201 | { |
| 202 | } |
| 203 | |
| 204 | const device_type EINSTEIN_ADC_DAISY = einstein_adc_daisy_device_config::static_alloc_device_config; |
| 205 | |
| 206 | //************************************************************************** |
| 207 | // DEVICE CONFIGURATION |
| 208 | //************************************************************************** |
| 209 | |
| 210 | //------------------------------------------------- |
| 211 | // einstein_fire_daisy_device_config - constructor |
| 212 | //------------------------------------------------- |
| 213 | |
| 214 | einstein_fire_daisy_device_config::einstein_fire_daisy_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock) |
| 215 | : device_config(mconfig, static_alloc_device_config, tag, owner, clock), |
| 216 | device_config_z80daisy_interface(mconfig, *this) |
| 217 | { |
| 218 | } |
| 219 | |
| 220 | |
| 221 | //------------------------------------------------- |
| 222 | // static_alloc_device_config - allocate a new |
| 223 | // configuration object |
| 224 | //------------------------------------------------- |
| 225 | |
| 226 | device_config *einstein_fire_daisy_device_config::static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock) |
| 227 | { |
| 228 | return global_alloc(einstein_fire_daisy_device_config(mconfig, tag, owner, clock)); |
| 229 | } |
| 230 | |
| 231 | |
| 232 | //------------------------------------------------- |
| 233 | // alloc_device - allocate a new device object |
| 234 | //------------------------------------------------- |
| 235 | |
| 236 | device_t *einstein_fire_daisy_device_config::alloc_device(running_machine &machine) const |
| 237 | { |
| 238 | return auto_alloc(&machine, einstein_fire_daisy_device(machine, *this)); |
| 239 | } |
| 240 | |
| 241 | //************************************************************************** |
| 242 | // LIVE DEVICE |
| 243 | //************************************************************************** |
| 244 | |
| 245 | //------------------------------------------------- |
| 246 | // z80ctc_device - constructor |
| 247 | //------------------------------------------------- |
| 248 | |
| 249 | einstein_fire_daisy_device::einstein_fire_daisy_device(running_machine &_machine, const einstein_fire_daisy_device_config &_config) |
| 250 | : device_t(_machine, _config), |
| 251 | device_z80daisy_interface(_machine, _config, *this), |
| 252 | m_config(_config) |
| 253 | { |
| 254 | } |
| 255 | |
| 256 | //------------------------------------------------- |
| 257 | // device_start - device-specific startup |
| 258 | //------------------------------------------------- |
| 259 | |
| 260 | void einstein_fire_daisy_device::device_start() |
| 261 | { |
| 262 | } |
| 263 | |
| 264 | //************************************************************************** |
| 265 | // DAISY CHAIN INTERFACE |
| 266 | //************************************************************************** |
| 267 | |
| 268 | //------------------------------------------------- |
| 269 | // z80daisy_irq_state - return the overall IRQ |
| 270 | // state for this device |
| 271 | //------------------------------------------------- |
| 272 | |
| 273 | int einstein_fire_daisy_device::z80daisy_irq_state() |
| 274 | { |
| 275 | einstein_state *einstein = (einstein_state *)device().machine->driver_data; |
| 276 | |
| 277 | if (einstein->interrupt & einstein->interrupt_mask & EINSTEIN_FIRE_INT) |
| 278 | return Z80_DAISY_INT; |
| 279 | |
| 280 | return 0; |
| 281 | } |
| 282 | |
| 283 | |
| 284 | //------------------------------------------------- |
| 285 | // z80daisy_irq_ack - acknowledge an IRQ and |
| 286 | // return the appropriate vector |
| 287 | //------------------------------------------------- |
| 288 | |
| 289 | int einstein_fire_daisy_device::z80daisy_irq_ack() |
| 290 | { |
| 291 | return 0xfd; |
| 292 | } |
| 293 | |
| 294 | //------------------------------------------------- |
| 295 | // z80daisy_irq_reti - clear the interrupt |
| 296 | // pending state to allow other interrupts through |
| 297 | //------------------------------------------------- |
| 298 | |
| 299 | void einstein_fire_daisy_device::z80daisy_irq_reti() |
| 300 | { |
| 301 | } |
| 302 | |
| 303 | const device_type EINSTEIN_FIRE_DAISY = einstein_fire_daisy_device_config::static_alloc_device_config; |
src/mess/includes/einstein.h
| r0 | r8362 | |
| 1 | /***************************************************************************** |
| 2 | * |
| 3 | * includes/einstein.h |
| 4 | * |
| 5 | ****************************************************************************/ |
| 6 | |
| 7 | #ifndef EINSTEIN_H_ |
| 8 | #define EINSTEIN_H_ |
| 9 | |
| 10 | #include "cpu/z80/z80daisy.h" |
| 11 | |
| 12 | /*************************************************************************** |
| 13 | TYPE DEFINITIONS |
| 14 | ***************************************************************************/ |
| 15 | |
| 16 | class einstein_state |
| 17 | { |
| 18 | public: |
| 19 | static void *alloc(running_machine &machine) { return auto_alloc_clear(&machine, einstein_state(machine)); } |
| 20 | |
| 21 | einstein_state(running_machine &machine) { } |
| 22 | |
| 23 | running_device *color_screen; |
| 24 | running_device *ctc; |
| 25 | |
| 26 | int rom_enabled; |
| 27 | int interrupt; |
| 28 | int interrupt_mask; |
| 29 | int ctc_trigger; |
| 30 | |
| 31 | /* keyboard */ |
| 32 | UINT8 keyboard_line; |
| 33 | UINT8 keyboard_data; |
| 34 | |
| 35 | /* 80 column device */ |
| 36 | running_device *mc6845; |
| 37 | screen_device *crtc_screen; |
| 38 | UINT8 *crtc_ram; |
| 39 | }; |
| 40 | |
| 41 | /*************************************************************************** |
| 42 | CONSTANTS |
| 43 | ***************************************************************************/ |
| 44 | |
| 45 | /* xtals */ |
| 46 | #define XTAL_X001 XTAL_10_738635MHz |
| 47 | #define XTAL_X002 XTAL_8MHz |
| 48 | |
| 49 | /* integrated circuits */ |
| 50 | #define IC_I001 "i001" /* Z8400A */ |
| 51 | #define IC_I030 "i030" /* AY-3-8910 */ |
| 52 | #define IC_I038 "i038" /* TMM9129 */ |
| 53 | #define IC_I042 "i042" /* WD1770-PH */ |
| 54 | #define IC_I050 "i050" /* ADC0844CCN */ |
| 55 | #define IC_I058 "i058" /* Z8430A */ |
| 56 | #define IC_I060 "i060" /* uPD8251A */ |
| 57 | #define IC_I063 "i063" /* Z8420A */ |
| 58 | |
| 59 | /* interrupt sources */ |
| 60 | #define EINSTEIN_KEY_INT (1<<0) |
| 61 | #define EINSTEIN_ADC_INT (1<<1) |
| 62 | #define EINSTEIN_FIRE_INT (1<<2) |
| 63 | |
| 64 | // ======================> einstein_keyboard_daisy_device_config |
| 65 | |
| 66 | class einstein_keyboard_daisy_device_config : public device_config, |
| 67 | public device_config_z80daisy_interface |
| 68 | { |
| 69 | friend class einstein_keyboard_daisy_device; |
| 70 | |
| 71 | // construction/destruction |
| 72 | einstein_keyboard_daisy_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock); |
| 73 | |
| 74 | public: |
| 75 | // allocators |
| 76 | static device_config *static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock); |
| 77 | virtual device_t *alloc_device(running_machine &machine) const; |
| 78 | |
| 79 | // basic information getters |
| 80 | virtual const char *name() const { return "Einstein keyboard daisy chain"; } |
| 81 | }; |
| 82 | |
| 83 | |
| 84 | |
| 85 | // ======================> einstein_keyboard_daisy_device |
| 86 | |
| 87 | class einstein_keyboard_daisy_device : public device_t, |
| 88 | public device_z80daisy_interface |
| 89 | { |
| 90 | friend class einstein_keyboard_daisy_device_config; |
| 91 | |
| 92 | // construction/destruction |
| 93 | einstein_keyboard_daisy_device(running_machine &_machine, const einstein_keyboard_daisy_device_config &_config); |
| 94 | |
| 95 | private: |
| 96 | virtual void device_start(); |
| 97 | // z80daisy_interface overrides |
| 98 | virtual int z80daisy_irq_state(); |
| 99 | virtual int z80daisy_irq_ack(); |
| 100 | virtual void z80daisy_irq_reti(); |
| 101 | |
| 102 | // internal state |
| 103 | const einstein_keyboard_daisy_device_config &m_config; |
| 104 | }; |
| 105 | |
| 106 | extern const device_type EINSTEIN_KEYBOARD_DAISY; |
| 107 | |
| 108 | // ======================> einstein_adc_daisy_device_config |
| 109 | |
| 110 | class einstein_adc_daisy_device_config : public device_config, |
| 111 | public device_config_z80daisy_interface |
| 112 | { |
| 113 | friend class einstein_adc_daisy_device; |
| 114 | |
| 115 | // construction/destruction |
| 116 | einstein_adc_daisy_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock); |
| 117 | |
| 118 | public: |
| 119 | // allocators |
| 120 | static device_config *static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock); |
| 121 | virtual device_t *alloc_device(running_machine &machine) const; |
| 122 | |
| 123 | // basic information getters |
| 124 | virtual const char *name() const { return "Einstein ADC daisy chain"; } |
| 125 | }; |
| 126 | |
| 127 | |
| 128 | |
| 129 | // ======================> einstein_adc_daisy_device |
| 130 | |
| 131 | class einstein_adc_daisy_device : public device_t, |
| 132 | public device_z80daisy_interface |
| 133 | { |
| 134 | friend class einstein_adc_daisy_device_config; |
| 135 | |
| 136 | // construction/destruction |
| 137 | einstein_adc_daisy_device(running_machine &_machine, const einstein_adc_daisy_device_config &_config); |
| 138 | |
| 139 | private: |
| 140 | virtual void device_start(); |
| 141 | // z80daisy_interface overrides |
| 142 | virtual int z80daisy_irq_state(); |
| 143 | virtual int z80daisy_irq_ack(); |
| 144 | virtual void z80daisy_irq_reti(); |
| 145 | |
| 146 | // internal state |
| 147 | const einstein_adc_daisy_device_config &m_config; |
| 148 | }; |
| 149 | |
| 150 | extern const device_type EINSTEIN_ADC_DAISY; |
| 151 | |
| 152 | // ======================> einstein_fire_daisy_device_config |
| 153 | |
| 154 | class einstein_fire_daisy_device_config : public device_config, |
| 155 | public device_config_z80daisy_interface |
| 156 | { |
| 157 | friend class einstein_fire_daisy_device; |
| 158 | |
| 159 | // construction/destruction |
| 160 | einstein_fire_daisy_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock); |
| 161 | |
| 162 | public: |
| 163 | // allocators |
| 164 | static device_config *static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock); |
| 165 | virtual device_t *alloc_device(running_machine &machine) const; |
| 166 | |
| 167 | // basic information getters |
| 168 | virtual const char *name() const { return "Einstein fire button daisy chain"; } |
| 169 | }; |
| 170 | |
| 171 | |
| 172 | |
| 173 | // ======================> einstein_fire_daisy_device |
| 174 | |
| 175 | class einstein_fire_daisy_device : public device_t, |
| 176 | public device_z80daisy_interface |
| 177 | { |
| 178 | friend class einstein_fire_daisy_device_config; |
| 179 | |
| 180 | // construction/destruction |
| 181 | einstein_fire_daisy_device(running_machine &_machine, const einstein_fire_daisy_device_config &_config); |
| 182 | |
| 183 | private: |
| 184 | virtual void device_start(); |
| 185 | // z80daisy_interface overrides |
| 186 | virtual int z80daisy_irq_state(); |
| 187 | virtual int z80daisy_irq_ack(); |
| 188 | virtual void z80daisy_irq_reti(); |
| 189 | |
| 190 | // internal state |
| 191 | const einstein_fire_daisy_device_config &m_config; |
| 192 | }; |
| 193 | |
| 194 | extern const device_type EINSTEIN_FIRE_DAISY; |
| 195 | |
| 196 | #endif /* EINSTEIN_H_ */ |
| | No newline at end of file |
src/mess/drivers/x1.c
| r8361 | r8362 | |
| 198 | 198 | #include "formats/basicdsk.h" |
| 199 | 199 | #include "formats/x1_tap.h" |
| 200 | 200 | #include "devices/cartslot.h" |
| 201 | #include "includes/x1.h" |
| 201 | 202 | //#include <ctype.h> |
| 202 | 203 | |
| 203 | 204 | #define MAIN_CLOCK XTAL_16MHz |
| r8361 | r8362 | |
| 212 | 213 | static UINT16 crtc_start_addr; |
| 213 | 214 | static UINT8 tile_height; |
| 214 | 215 | static UINT8 sub_obf; |
| 215 | | static UINT8 key_irq_flag; |
| 216 | UINT8 x1_key_irq_flag; |
| 216 | 217 | static UINT8 ctc_irq_flag; |
| 217 | 218 | static struct |
| 218 | 219 | { |
| r8361 | r8362 | |
| 686 | 687 | |
| 687 | 688 | static UINT8 x1_irq_vector; |
| 688 | 689 | //static UINT8 ctc_irq_vector; //always 0x5e? |
| 689 | | static UINT8 key_irq_vector; |
| 690 | UINT8 x1_key_irq_vector; |
| 690 | 691 | static UINT8 cmt_current_cmd; |
| 691 | 692 | static UINT8 cmt_test; |
| 692 | 693 | |
| r8361 | r8362 | |
| 778 | 779 | |
| 779 | 780 | if(sub_cmd == 0xe4) |
| 780 | 781 | { |
| 781 | | key_irq_vector = data; |
| 782 | x1_key_irq_vector = data; |
| 782 | 783 | logerror("Key vector set to 0x%02x\n",data); |
| 783 | 784 | } |
| 784 | 785 | |
| r8361 | r8362 | |
| 855 | 856 | logerror("SUB: Command byte 0x%02x\n",data); |
| 856 | 857 | } |
| 857 | 858 | |
| 858 | | |
| 859 | | // ======================> x1_keyboard_device_config |
| 860 | | |
| 861 | | class x1_keyboard_device_config : public device_config, |
| 862 | | public device_config_z80daisy_interface |
| 863 | | { |
| 864 | | friend class x1_keyboard_device; |
| 865 | | |
| 866 | | // construction/destruction |
| 867 | | x1_keyboard_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock); |
| 868 | | |
| 869 | | public: |
| 870 | | // allocators |
| 871 | | static device_config *static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock); |
| 872 | | virtual device_t *alloc_device(running_machine &machine) const; |
| 873 | | |
| 874 | | // basic information getters |
| 875 | | virtual const char *name() const { return "X1 Keyboard"; } |
| 876 | | }; |
| 877 | | |
| 878 | | |
| 879 | | |
| 880 | | // ======================> x1_keyboard_device |
| 881 | | |
| 882 | | class x1_keyboard_device : public device_t, |
| 883 | | public device_z80daisy_interface |
| 884 | | { |
| 885 | | friend class x1_keyboard_device_config; |
| 886 | | |
| 887 | | // construction/destruction |
| 888 | | x1_keyboard_device(running_machine &_machine, const x1_keyboard_device_config &_config); |
| 889 | | |
| 890 | | private: |
| 891 | | virtual void device_start(); |
| 892 | | // z80daisy_interface overrides |
| 893 | | virtual int z80daisy_irq_state(); |
| 894 | | virtual int z80daisy_irq_ack(); |
| 895 | | virtual void z80daisy_irq_reti(); |
| 896 | | |
| 897 | | // internal state |
| 898 | | const x1_keyboard_device_config &m_config; |
| 899 | | }; |
| 900 | | |
| 901 | | //************************************************************************** |
| 902 | | // DEVICE CONFIGURATION |
| 903 | | //************************************************************************** |
| 904 | | |
| 905 | | //------------------------------------------------- |
| 906 | | // x1_keyboard_device_config - constructor |
| 907 | | //------------------------------------------------- |
| 908 | | |
| 909 | | x1_keyboard_device_config::x1_keyboard_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock) |
| 910 | | : device_config(mconfig, static_alloc_device_config, tag, owner, clock), |
| 911 | | device_config_z80daisy_interface(mconfig, *this) |
| 912 | | { |
| 913 | | } |
| 914 | | |
| 915 | | |
| 916 | | //------------------------------------------------- |
| 917 | | // static_alloc_device_config - allocate a new |
| 918 | | // configuration object |
| 919 | | //------------------------------------------------- |
| 920 | | |
| 921 | | device_config *x1_keyboard_device_config::static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock) |
| 922 | | { |
| 923 | | return global_alloc(x1_keyboard_device_config(mconfig, tag, owner, clock)); |
| 924 | | } |
| 925 | | |
| 926 | | |
| 927 | | //------------------------------------------------- |
| 928 | | // alloc_device - allocate a new device object |
| 929 | | //------------------------------------------------- |
| 930 | | |
| 931 | | device_t *x1_keyboard_device_config::alloc_device(running_machine &machine) const |
| 932 | | { |
| 933 | | return auto_alloc(&machine, x1_keyboard_device(machine, *this)); |
| 934 | | } |
| 935 | | |
| 936 | | //************************************************************************** |
| 937 | | // LIVE DEVICE |
| 938 | | //************************************************************************** |
| 939 | | |
| 940 | | //------------------------------------------------- |
| 941 | | // z80ctc_device - constructor |
| 942 | | //------------------------------------------------- |
| 943 | | |
| 944 | | x1_keyboard_device::x1_keyboard_device(running_machine &_machine, const x1_keyboard_device_config &_config) |
| 945 | | : device_t(_machine, _config), |
| 946 | | device_z80daisy_interface(_machine, _config, *this), |
| 947 | | m_config(_config) |
| 948 | | { |
| 949 | | } |
| 950 | | |
| 951 | | //------------------------------------------------- |
| 952 | | // device_start - device-specific startup |
| 953 | | //------------------------------------------------- |
| 954 | | |
| 955 | | void x1_keyboard_device::device_start() |
| 956 | | { |
| 957 | | } |
| 958 | | |
| 959 | | //************************************************************************** |
| 960 | | // DAISY CHAIN INTERFACE |
| 961 | | //************************************************************************** |
| 962 | | |
| 963 | | //------------------------------------------------- |
| 964 | | // z80daisy_irq_state - return the overall IRQ |
| 965 | | // state for this device |
| 966 | | //------------------------------------------------- |
| 967 | | |
| 968 | | int x1_keyboard_device::z80daisy_irq_state() |
| 969 | | { |
| 970 | | if(key_irq_flag != 0) |
| 971 | | return Z80_DAISY_INT; |
| 972 | | return 0; |
| 973 | | } |
| 974 | | |
| 975 | | |
| 976 | | //------------------------------------------------- |
| 977 | | // z80daisy_irq_ack - acknowledge an IRQ and |
| 978 | | // return the appropriate vector |
| 979 | | //------------------------------------------------- |
| 980 | | |
| 981 | | int x1_keyboard_device::z80daisy_irq_ack() |
| 982 | | { |
| 983 | | key_irq_flag = 0; |
| 984 | | cputag_set_input_line(device().machine,"maincpu",INPUT_LINE_IRQ0,CLEAR_LINE); |
| 985 | | return key_irq_vector; |
| 986 | | } |
| 987 | | |
| 988 | | //------------------------------------------------- |
| 989 | | // z80daisy_irq_reti - clear the interrupt |
| 990 | | // pending state to allow other interrupts through |
| 991 | | //------------------------------------------------- |
| 992 | | |
| 993 | | void x1_keyboard_device::z80daisy_irq_reti() |
| 994 | | { |
| 995 | | } |
| 996 | | |
| 997 | | const device_type X1_KEYBOARD = x1_keyboard_device_config::static_alloc_device_config; |
| 998 | | |
| 999 | 859 | /************************************* |
| 1000 | 860 | * |
| 1001 | 861 | * ROM Image / Banking Handling |
| r8361 | r8362 | |
| 2145 | 2005 | if(ctc_irq_flag != 0) |
| 2146 | 2006 | { |
| 2147 | 2007 | ctc_irq_flag = 0; |
| 2148 | | if(key_irq_flag == 0) // if no other devices are pulling the IRQ line high |
| 2008 | if(x1_key_irq_flag == 0) // if no other devices are pulling the IRQ line high |
| 2149 | 2009 | cpu_set_input_line(device, 0, CLEAR_LINE); |
| 2150 | 2010 | return x1_irq_vector; |
| 2151 | 2011 | } |
| 2152 | | if(key_irq_flag != 0) |
| 2012 | if(x1_key_irq_flag != 0) |
| 2153 | 2013 | { |
| 2154 | | key_irq_flag = 0; |
| 2014 | x1_key_irq_flag = 0; |
| 2155 | 2015 | if(ctc_irq_flag == 0) // if no other devices are pulling the IRQ line high |
| 2156 | 2016 | cpu_set_input_line(device, 0, CLEAR_LINE); |
| 2157 | | return key_irq_vector; |
| 2017 | return x1_key_irq_vector; |
| 2158 | 2018 | } |
| 2159 | 2019 | return x1_irq_vector; |
| 2160 | 2020 | } |
| r8361 | r8362 | |
| 2170 | 2030 | UINT32 f_key = input_port_read(machine, "f_keys"); |
| 2171 | 2031 | static UINT32 old_key1,old_key2,old_key3,old_key4,old_fkey; |
| 2172 | 2032 | |
| 2173 | | if(key_irq_vector) |
| 2033 | if(x1_key_irq_vector) |
| 2174 | 2034 | { |
| 2175 | 2035 | if((key1 != old_key1) || (key2 != old_key2) || (key3 != old_key3) || (key4 != old_key4) || (f_key != old_fkey)) |
| 2176 | 2036 | { |
| 2177 | 2037 | // generate keyboard IRQ |
| 2178 | 2038 | sub_io_w(space,0,0xe6); |
| 2179 | | x1_irq_vector = key_irq_vector; |
| 2180 | | key_irq_flag = 1; |
| 2039 | x1_irq_vector = x1_key_irq_vector; |
| 2040 | x1_key_irq_flag = 1; |
| 2181 | 2041 | cputag_set_input_line(machine,"maincpu",0,ASSERT_LINE); |
| 2182 | 2042 | old_key1 = key1; |
| 2183 | 2043 | old_key2 = key2; |
| r8361 | r8362 | |
| 2247 | 2107 | cmt_test = 0; |
| 2248 | 2108 | cassette_change_state(devtag_get_device(machine, "cass" ),CASSETTE_MOTOR_DISABLED,CASSETTE_MASK_MOTOR); |
| 2249 | 2109 | |
| 2250 | | key_irq_flag = ctc_irq_flag = 0; |
| 2110 | x1_key_irq_flag = ctc_irq_flag = 0; |
| 2251 | 2111 | |
| 2252 | 2112 | /* Reinitialize palette here if there's a soft reset for the Turbo PAL stuff*/ |
| 2253 | 2113 | for(i=0;i<8;i++) |
src/mess/drivers/einstein.c
| r8361 | r8362 | |
| 62 | 62 | #include "video/mc6845.h" |
| 63 | 63 | #include "rendlay.h" |
| 64 | 64 | #include "devices/messram.h" |
| 65 | #include "includes/einstein.h" |
| 65 | 66 | |
| 66 | 67 | /*************************************************************************** |
| 67 | | CONSTANTS |
| 68 | | ***************************************************************************/ |
| 69 | | |
| 70 | | /* xtals */ |
| 71 | | #define XTAL_X001 XTAL_10_738635MHz |
| 72 | | #define XTAL_X002 XTAL_8MHz |
| 73 | | |
| 74 | | /* integrated circuits */ |
| 75 | | #define IC_I001 "i001" /* Z8400A */ |
| 76 | | #define IC_I030 "i030" /* AY-3-8910 */ |
| 77 | | #define IC_I038 "i038" /* TMM9129 */ |
| 78 | | #define IC_I042 "i042" /* WD1770-PH */ |
| 79 | | #define IC_I050 "i050" /* ADC0844CCN */ |
| 80 | | #define IC_I058 "i058" /* Z8430A */ |
| 81 | | #define IC_I060 "i060" /* uPD8251A */ |
| 82 | | #define IC_I063 "i063" /* Z8420A */ |
| 83 | | |
| 84 | | /* interrupt sources */ |
| 85 | | #define EINSTEIN_KEY_INT (1<<0) |
| 86 | | #define EINSTEIN_ADC_INT (1<<1) |
| 87 | | #define EINSTEIN_FIRE_INT (1<<2) |
| 88 | | |
| 89 | | |
| 90 | | /*************************************************************************** |
| 91 | | TYPE DEFINITIONS |
| 92 | | ***************************************************************************/ |
| 93 | | |
| 94 | | class einstein_state |
| 95 | | { |
| 96 | | public: |
| 97 | | static void *alloc(running_machine &machine) { return auto_alloc_clear(&machine, einstein_state(machine)); } |
| 98 | | |
| 99 | | einstein_state(running_machine &machine) { } |
| 100 | | |
| 101 | | running_device *color_screen; |
| 102 | | running_device *ctc; |
| 103 | | |
| 104 | | int rom_enabled; |
| 105 | | int interrupt; |
| 106 | | int interrupt_mask; |
| 107 | | int ctc_trigger; |
| 108 | | |
| 109 | | /* keyboard */ |
| 110 | | UINT8 keyboard_line; |
| 111 | | UINT8 keyboard_data; |
| 112 | | |
| 113 | | /* 80 column device */ |
| 114 | | running_device *mc6845; |
| 115 | | screen_device *crtc_screen; |
| 116 | | UINT8 *crtc_ram; |
| 117 | | }; |
| 118 | | |
| 119 | | |
| 120 | | /*************************************************************************** |
| 121 | 68 | 80 COLUMN DEVICE |
| 122 | 69 | ***************************************************************************/ |
| 123 | 70 | |
| r8361 | r8362 | |
| 178 | 125 | return result; |
| 179 | 126 | } |
| 180 | 127 | |
| 181 | | |
| 182 | | /**************************************************************** |
| 183 | | EINSTEIN NON-Z80 DEVICES DAISY CHAIN SUPPORT |
| 184 | | ****************************************************************/ |
| 185 | | |
| 186 | | // ======================> einstein_keyboard_daisy_device_config |
| 187 | | |
| 188 | | class einstein_keyboard_daisy_device_config : public device_config, |
| 189 | | public device_config_z80daisy_interface |
| 190 | | { |
| 191 | | friend class einstein_keyboard_daisy_device; |
| 192 | | |
| 193 | | // construction/destruction |
| 194 | | einstein_keyboard_daisy_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock); |
| 195 | | |
| 196 | | public: |
| 197 | | // allocators |
| 198 | | static device_config *static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock); |
| 199 | | virtual device_t *alloc_device(running_machine &machine) const; |
| 200 | | |
| 201 | | // basic information getters |
| 202 | | virtual const char *name() const { return "Einstein keyboard daisy chain"; } |
| 203 | | }; |
| 204 | | |
| 205 | | |
| 206 | | |
| 207 | | // ======================> einstein_keyboard_daisy_device |
| 208 | | |
| 209 | | class einstein_keyboard_daisy_device : public device_t, |
| 210 | | public device_z80daisy_interface |
| 211 | | { |
| 212 | | friend class einstein_keyboard_daisy_device_config; |
| 213 | | |
| 214 | | // construction/destruction |
| 215 | | einstein_keyboard_daisy_device(running_machine &_machine, const einstein_keyboard_daisy_device_config &_config); |
| 216 | | |
| 217 | | private: |
| 218 | | virtual void device_start(); |
| 219 | | // z80daisy_interface overrides |
| 220 | | virtual int z80daisy_irq_state(); |
| 221 | | virtual int z80daisy_irq_ack(); |
| 222 | | virtual void z80daisy_irq_reti(); |
| 223 | | |
| 224 | | // internal state |
| 225 | | const einstein_keyboard_daisy_device_config &m_config; |
| 226 | | }; |
| 227 | | |
| 228 | | //************************************************************************** |
| 229 | | // DEVICE CONFIGURATION |
| 230 | | //************************************************************************** |
| 231 | | |
| 232 | | //------------------------------------------------- |
| 233 | | // einstein_keyboard_daisy_device_config - constructor |
| 234 | | //------------------------------------------------- |
| 235 | | |
| 236 | | einstein_keyboard_daisy_device_config::einstein_keyboard_daisy_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock) |
| 237 | | : device_config(mconfig, static_alloc_device_config, tag, owner, clock), |
| 238 | | device_config_z80daisy_interface(mconfig, *this) |
| 239 | | { |
| 240 | | } |
| 241 | | |
| 242 | | |
| 243 | | //------------------------------------------------- |
| 244 | | // static_alloc_device_config - allocate a new |
| 245 | | // configuration object |
| 246 | | //------------------------------------------------- |
| 247 | | |
| 248 | | device_config *einstein_keyboard_daisy_device_config::static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock) |
| 249 | | { |
| 250 | | return global_alloc(einstein_keyboard_daisy_device_config(mconfig, tag, owner, clock)); |
| 251 | | } |
| 252 | | |
| 253 | | |
| 254 | | //------------------------------------------------- |
| 255 | | // alloc_device - allocate a new device object |
| 256 | | //------------------------------------------------- |
| 257 | | |
| 258 | | device_t *einstein_keyboard_daisy_device_config::alloc_device(running_machine &machine) const |
| 259 | | { |
| 260 | | return auto_alloc(&machine, einstein_keyboard_daisy_device(machine, *this)); |
| 261 | | } |
| 262 | | |
| 263 | | //************************************************************************** |
| 264 | | // LIVE DEVICE |
| 265 | | //************************************************************************** |
| 266 | | |
| 267 | | //------------------------------------------------- |
| 268 | | // z80ctc_device - constructor |
| 269 | | //------------------------------------------------- |
| 270 | | |
| 271 | | einstein_keyboard_daisy_device::einstein_keyboard_daisy_device(running_machine &_machine, const einstein_keyboard_daisy_device_config &_config) |
| 272 | | : device_t(_machine, _config), |
| 273 | | device_z80daisy_interface(_machine, _config, *this), |
| 274 | | m_config(_config) |
| 275 | | { |
| 276 | | } |
| 277 | | |
| 278 | | //------------------------------------------------- |
| 279 | | // device_start - device-specific startup |
| 280 | | //------------------------------------------------- |
| 281 | | |
| 282 | | void einstein_keyboard_daisy_device::device_start() |
| 283 | | { |
| 284 | | } |
| 285 | | |
| 286 | | //************************************************************************** |
| 287 | | // DAISY CHAIN INTERFACE |
| 288 | | //************************************************************************** |
| 289 | | |
| 290 | | //------------------------------------------------- |
| 291 | | // z80daisy_irq_state - return the overall IRQ |
| 292 | | // state for this device |
| 293 | | //------------------------------------------------- |
| 294 | | |
| 295 | | int einstein_keyboard_daisy_device::z80daisy_irq_state() |
| 296 | | { |
| 297 | | einstein_state *einstein = (einstein_state *)device().machine->driver_data; |
| 298 | | |
| 299 | | if (einstein->interrupt & einstein->interrupt_mask & EINSTEIN_KEY_INT) |
| 300 | | return Z80_DAISY_INT; |
| 301 | | |
| 302 | | return 0; |
| 303 | | } |
| 304 | | |
| 305 | | |
| 306 | | //------------------------------------------------- |
| 307 | | // z80daisy_irq_ack - acknowledge an IRQ and |
| 308 | | // return the appropriate vector |
| 309 | | //------------------------------------------------- |
| 310 | | |
| 311 | | int einstein_keyboard_daisy_device::z80daisy_irq_ack() |
| 312 | | { |
| 313 | | return 0xf7; |
| 314 | | } |
| 315 | | |
| 316 | | //------------------------------------------------- |
| 317 | | // z80daisy_irq_reti - clear the interrupt |
| 318 | | // pending state to allow other interrupts through |
| 319 | | //------------------------------------------------- |
| 320 | | |
| 321 | | void einstein_keyboard_daisy_device::z80daisy_irq_reti() |
| 322 | | { |
| 323 | | } |
| 324 | | |
| 325 | | const device_type EINSTEIN_KEYBOARD_DAISY = einstein_keyboard_daisy_device_config::static_alloc_device_config; |
| 326 | | |
| 327 | | // ======================> einstein_adc_daisy_device_config |
| 328 | | |
| 329 | | class einstein_adc_daisy_device_config : public device_config, |
| 330 | | public device_config_z80daisy_interface |
| 331 | | { |
| 332 | | friend class einstein_adc_daisy_device; |
| 333 | | |
| 334 | | // construction/destruction |
| 335 | | einstein_adc_daisy_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock); |
| 336 | | |
| 337 | | public: |
| 338 | | // allocators |
| 339 | | static device_config *static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock); |
| 340 | | virtual device_t *alloc_device(running_machine &machine) const; |
| 341 | | |
| 342 | | // basic information getters |
| 343 | | virtual const char *name() const { return "Einstein ADC daisy chain"; } |
| 344 | | }; |
| 345 | | |
| 346 | | |
| 347 | | |
| 348 | | // ======================> einstein_adc_daisy_device |
| 349 | | |
| 350 | | class einstein_adc_daisy_device : public device_t, |
| 351 | | public device_z80daisy_interface |
| 352 | | { |
| 353 | | friend class einstein_adc_daisy_device_config; |
| 354 | | |
| 355 | | // construction/destruction |
| 356 | | einstein_adc_daisy_device(running_machine &_machine, const einstein_adc_daisy_device_config &_config); |
| 357 | | |
| 358 | | private: |
| 359 | | virtual void device_start(); |
| 360 | | // z80daisy_interface overrides |
| 361 | | virtual int z80daisy_irq_state(); |
| 362 | | virtual int z80daisy_irq_ack(); |
| 363 | | virtual void z80daisy_irq_reti(); |
| 364 | | |
| 365 | | // internal state |
| 366 | | const einstein_adc_daisy_device_config &m_config; |
| 367 | | }; |
| 368 | | |
| 369 | | //************************************************************************** |
| 370 | | // DEVICE CONFIGURATION |
| 371 | | //************************************************************************** |
| 372 | | |
| 373 | | //------------------------------------------------- |
| 374 | | // einstein_adc_daisy_device_config - constructor |
| 375 | | //------------------------------------------------- |
| 376 | | |
| 377 | | einstein_adc_daisy_device_config::einstein_adc_daisy_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock) |
| 378 | | : device_config(mconfig, static_alloc_device_config, tag, owner, clock), |
| 379 | | device_config_z80daisy_interface(mconfig, *this) |
| 380 | | { |
| 381 | | } |
| 382 | | |
| 383 | | |
| 384 | | //------------------------------------------------- |
| 385 | | // static_alloc_device_config - allocate a new |
| 386 | | // configuration object |
| 387 | | //------------------------------------------------- |
| 388 | | |
| 389 | | device_config *einstein_adc_daisy_device_config::static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock) |
| 390 | | { |
| 391 | | return global_alloc(einstein_adc_daisy_device_config(mconfig, tag, owner, clock)); |
| 392 | | } |
| 393 | | |
| 394 | | |
| 395 | | //------------------------------------------------- |
| 396 | | // alloc_device - allocate a new device object |
| 397 | | //------------------------------------------------- |
| 398 | | |
| 399 | | device_t *einstein_adc_daisy_device_config::alloc_device(running_machine &machine) const |
| 400 | | { |
| 401 | | return auto_alloc(&machine, einstein_adc_daisy_device(machine, *this)); |
| 402 | | } |
| 403 | | |
| 404 | | //************************************************************************** |
| 405 | | // LIVE DEVICE |
| 406 | | //************************************************************************** |
| 407 | | |
| 408 | | //------------------------------------------------- |
| 409 | | // z80ctc_device - constructor |
| 410 | | //------------------------------------------------- |
| 411 | | |
| 412 | | einstein_adc_daisy_device::einstein_adc_daisy_device(running_machine &_machine, const einstein_adc_daisy_device_config &_config) |
| 413 | | : device_t(_machine, _config), |
| 414 | | device_z80daisy_interface(_machine, _config, *this), |
| 415 | | m_config(_config) |
| 416 | | { |
| 417 | | } |
| 418 | | |
| 419 | | //------------------------------------------------- |
| 420 | | // device_start - device-specific startup |
| 421 | | //------------------------------------------------- |
| 422 | | |
| 423 | | void einstein_adc_daisy_device::device_start() |
| 424 | | { |
| 425 | | } |
| 426 | | |
| 427 | | //************************************************************************** |
| 428 | | // DAISY CHAIN INTERFACE |
| 429 | | //************************************************************************** |
| 430 | | |
| 431 | | //------------------------------------------------- |
| 432 | | // z80daisy_irq_state - return the overall IRQ |
| 433 | | // state for this device |
| 434 | | //------------------------------------------------- |
| 435 | | |
| 436 | | int einstein_adc_daisy_device::z80daisy_irq_state() |
| 437 | | { |
| 438 | | einstein_state *einstein = (einstein_state *)device().machine->driver_data; |
| 439 | | |
| 440 | | if (einstein->interrupt & einstein->interrupt_mask & EINSTEIN_ADC_INT) |
| 441 | | return Z80_DAISY_INT; |
| 442 | | |
| 443 | | return 0; |
| 444 | | } |
| 445 | | |
| 446 | | |
| 447 | | //------------------------------------------------- |
| 448 | | // z80daisy_irq_ack - acknowledge an IRQ and |
| 449 | | // return the appropriate vector |
| 450 | | //------------------------------------------------- |
| 451 | | |
| 452 | | int einstein_adc_daisy_device::z80daisy_irq_ack() |
| 453 | | { |
| 454 | | return 0xfb; |
| 455 | | } |
| 456 | | |
| 457 | | //------------------------------------------------- |
| 458 | | // z80daisy_irq_reti - clear the interrupt |
| 459 | | // pending state to allow other interrupts through |
| 460 | | //------------------------------------------------- |
| 461 | | |
| 462 | | void einstein_adc_daisy_device::z80daisy_irq_reti() |
| 463 | | { |
| 464 | | } |
| 465 | | |
| 466 | | const device_type EINSTEIN_ADC_DAISY = einstein_adc_daisy_device_config::static_alloc_device_config; |
| 467 | | |
| 468 | | // ======================> einstein_fire_daisy_device_config |
| 469 | | |
| 470 | | class einstein_fire_daisy_device_config : public device_config, |
| 471 | | public device_config_z80daisy_interface |
| 472 | | { |
| 473 | | friend class einstein_fire_daisy_device; |
| 474 | | |
| 475 | | // construction/destruction |
| 476 | | einstein_fire_daisy_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock); |
| 477 | | |
| 478 | | public: |
| 479 | | // allocators |
| 480 | | static device_config *static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock); |
| 481 | | virtual device_t *alloc_device(running_machine &machine) const; |
| 482 | | |
| 483 | | // basic information getters |
| 484 | | virtual const char *name() const { return "Einstein fire button daisy chain"; } |
| 485 | | }; |
| 486 | | |
| 487 | | |
| 488 | | |
| 489 | | // ======================> einstein_fire_daisy_device |
| 490 | | |
| 491 | | class einstein_fire_daisy_device : public device_t, |
| 492 | | public device_z80daisy_interface |
| 493 | | { |
| 494 | | friend class einstein_fire_daisy_device_config; |
| 495 | | |
| 496 | | // construction/destruction |
| 497 | | einstein_fire_daisy_device(running_machine &_machine, const einstein_fire_daisy_device_config &_config); |
| 498 | | |
| 499 | | private: |
| 500 | | virtual void device_start(); |
| 501 | | // z80daisy_interface overrides |
| 502 | | virtual int z80daisy_irq_state(); |
| 503 | | virtual int z80daisy_irq_ack(); |
| 504 | | virtual void z80daisy_irq_reti(); |
| 505 | | |
| 506 | | // internal state |
| 507 | | const einstein_fire_daisy_device_config &m_config; |
| 508 | | }; |
| 509 | | |
| 510 | | //************************************************************************** |
| 511 | | // DEVICE CONFIGURATION |
| 512 | | //************************************************************************** |
| 513 | | |
| 514 | | //------------------------------------------------- |
| 515 | | // einstein_fire_daisy_device_config - constructor |
| 516 | | //------------------------------------------------- |
| 517 | | |
| 518 | | einstein_fire_daisy_device_config::einstein_fire_daisy_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock) |
| 519 | | : device_config(mconfig, static_alloc_device_config, tag, owner, clock), |
| 520 | | device_config_z80daisy_interface(mconfig, *this) |
| 521 | | { |
| 522 | | } |
| 523 | | |
| 524 | | |
| 525 | | //------------------------------------------------- |
| 526 | | // static_alloc_device_config - allocate a new |
| 527 | | // configuration object |
| 528 | | //------------------------------------------------- |
| 529 | | |
| 530 | | device_config *einstein_fire_daisy_device_config::static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock) |
| 531 | | { |
| 532 | | return global_alloc(einstein_fire_daisy_device_config(mconfig, tag, owner, clock)); |
| 533 | | } |
| 534 | | |
| 535 | | |
| 536 | | //------------------------------------------------- |
| 537 | | // alloc_device - allocate a new device object |
| 538 | | //------------------------------------------------- |
| 539 | | |
| 540 | | device_t *einstein_fire_daisy_device_config::alloc_device(running_machine &machine) const |
| 541 | | { |
| 542 | | return auto_alloc(&machine, einstein_fire_daisy_device(machine, *this)); |
| 543 | | } |
| 544 | | |
| 545 | | //************************************************************************** |
| 546 | | // LIVE DEVICE |
| 547 | | //************************************************************************** |
| 548 | | |
| 549 | | //------------------------------------------------- |
| 550 | | // z80ctc_device - constructor |
| 551 | | //------------------------------------------------- |
| 552 | | |
| 553 | | einstein_fire_daisy_device::einstein_fire_daisy_device(running_machine &_machine, const einstein_fire_daisy_device_config &_config) |
| 554 | | : device_t(_machine, _config), |
| 555 | | device_z80daisy_interface(_machine, _config, *this), |
| 556 | | m_config(_config) |
| 557 | | { |
| 558 | | } |
| 559 | | |
| 560 | | //------------------------------------------------- |
| 561 | | // device_start - device-specific startup |
| 562 | | //------------------------------------------------- |
| 563 | | |
| 564 | | void einstein_fire_daisy_device::device_start() |
| 565 | | { |
| 566 | | } |
| 567 | | |
| 568 | | //************************************************************************** |
| 569 | | // DAISY CHAIN INTERFACE |
| 570 | | //************************************************************************** |
| 571 | | |
| 572 | | //------------------------------------------------- |
| 573 | | // z80daisy_irq_state - return the overall IRQ |
| 574 | | // state for this device |
| 575 | | //------------------------------------------------- |
| 576 | | |
| 577 | | int einstein_fire_daisy_device::z80daisy_irq_state() |
| 578 | | { |
| 579 | | einstein_state *einstein = (einstein_state *)device().machine->driver_data; |
| 580 | | |
| 581 | | if (einstein->interrupt & einstein->interrupt_mask & EINSTEIN_FIRE_INT) |
| 582 | | return Z80_DAISY_INT; |
| 583 | | |
| 584 | | return 0; |
| 585 | | } |
| 586 | | |
| 587 | | |
| 588 | | //------------------------------------------------- |
| 589 | | // z80daisy_irq_ack - acknowledge an IRQ and |
| 590 | | // return the appropriate vector |
| 591 | | //------------------------------------------------- |
| 592 | | |
| 593 | | int einstein_fire_daisy_device::z80daisy_irq_ack() |
| 594 | | { |
| 595 | | return 0xfd; |
| 596 | | } |
| 597 | | |
| 598 | | //------------------------------------------------- |
| 599 | | // z80daisy_irq_reti - clear the interrupt |
| 600 | | // pending state to allow other interrupts through |
| 601 | | //------------------------------------------------- |
| 602 | | |
| 603 | | void einstein_fire_daisy_device::z80daisy_irq_reti() |
| 604 | | { |
| 605 | | } |
| 606 | | |
| 607 | | const device_type EINSTEIN_FIRE_DAISY = einstein_fire_daisy_device_config::static_alloc_device_config; |
| 608 | | |
| 609 | 128 | /* int priority */ |
| 610 | 129 | /* keyboard int->ctc/adc->pio */ |
| 611 | 130 | static const z80_daisy_config einstein_daisy_chain[] = |