trunk/src/mame/audio/qix.c
| r20297 | r20298 | |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | |
| 102 | | static TIMER_CALLBACK( deferred_sndpia1_porta_w ) |
| 102 | TIMER_CALLBACK_MEMBER(qix_state::deferred_sndpia1_porta_w) |
| 103 | 103 | { |
| 104 | | pia6821_device *device = (pia6821_device *)ptr; |
| 105 | | device->porta_w(param); |
| 104 | m_sndpia1->porta_w(param); |
| 106 | 105 | } |
| 107 | 106 | |
| 108 | 107 | |
| 109 | 108 | WRITE8_MEMBER(qix_state::sync_sndpia1_porta_w) |
| 110 | 109 | { |
| 111 | | device_t *device = machine().device("sndpia1"); |
| 112 | 110 | /* we need to synchronize this so the sound CPU doesn't drop anything important */ |
| 113 | | machine().scheduler().synchronize(FUNC(deferred_sndpia1_porta_w), data, (void *)downcast<pia6821_device *>(device)); |
| 111 | machine().scheduler().synchronize(timer_expired_delegate(FUNC(qix_state::deferred_sndpia1_porta_w), this), data); |
| 114 | 112 | } |
| 115 | 113 | |
| 116 | 114 | |
| r20297 | r20298 | |
| 130 | 128 | |
| 131 | 129 | WRITE_LINE_MEMBER(qix_state::qix_pia_dint) |
| 132 | 130 | { |
| 133 | | pia6821_device *pia = downcast<pia6821_device *>(machine().device("sndpia0")); |
| 134 | | int combined_state = pia->irq_a_state() | pia->irq_b_state(); |
| 131 | int combined_state = m_sndpia0->irq_a_state() | m_sndpia0->irq_b_state(); |
| 135 | 132 | |
| 136 | 133 | /* DINT is connected to the data CPU's IRQ line */ |
| 137 | | machine().device("maincpu")->execute().set_input_line(M6809_IRQ_LINE, combined_state ? ASSERT_LINE : CLEAR_LINE); |
| 134 | m_maincpu->set_input_line(M6809_IRQ_LINE, combined_state ? ASSERT_LINE : CLEAR_LINE); |
| 138 | 135 | } |
| 139 | 136 | |
| 140 | 137 | |
| 141 | 138 | WRITE_LINE_MEMBER(qix_state::qix_pia_sint) |
| 142 | 139 | { |
| 143 | | pia6821_device *pia = downcast<pia6821_device *>(machine().device("sndpia1")); |
| 144 | | int combined_state = pia->irq_a_state() | pia->irq_b_state(); |
| 140 | int combined_state = m_sndpia1->irq_a_state() | m_sndpia1->irq_b_state(); |
| 145 | 141 | |
| 146 | 142 | /* SINT is connected to the sound CPU's IRQ line */ |
| 147 | 143 | machine().device("audiocpu")->execute().set_input_line(M6800_IRQ_LINE, combined_state ? ASSERT_LINE : CLEAR_LINE); |
trunk/src/mame/machine/qix.c
| r20297 | r20298 | |
| 226 | 226 | |
| 227 | 227 | WRITE_LINE_MEMBER(qix_state::qix_vsync_changed) |
| 228 | 228 | { |
| 229 | | pia6821_device *pia = machine().device<pia6821_device>("sndpia0"); |
| 230 | | pia->cb1_w(state); |
| 229 | m_sndpia0->cb1_w(state); |
| 231 | 230 | } |
| 232 | 231 | |
| 233 | 232 | |
| r20297 | r20298 | |
| 255 | 254 | |
| 256 | 255 | WRITE8_MEMBER(qix_state::qix_data_firq_w) |
| 257 | 256 | { |
| 258 | | machine().device("maincpu")->execute().set_input_line(M6809_FIRQ_LINE, ASSERT_LINE); |
| 257 | m_maincpu->set_input_line(M6809_FIRQ_LINE, ASSERT_LINE); |
| 259 | 258 | } |
| 260 | 259 | |
| 261 | 260 | |
| 262 | 261 | WRITE8_MEMBER(qix_state::qix_data_firq_ack_w) |
| 263 | 262 | { |
| 264 | | machine().device("maincpu")->execute().set_input_line(M6809_FIRQ_LINE, CLEAR_LINE); |
| 263 | m_maincpu->set_input_line(M6809_FIRQ_LINE, CLEAR_LINE); |
| 265 | 264 | } |
| 266 | 265 | |
| 267 | 266 | |
| 268 | 267 | READ8_MEMBER(qix_state::qix_data_firq_r) |
| 269 | 268 | { |
| 270 | | machine().device("maincpu")->execute().set_input_line(M6809_FIRQ_LINE, ASSERT_LINE); |
| 269 | m_maincpu->set_input_line(M6809_FIRQ_LINE, ASSERT_LINE); |
| 271 | 270 | return 0xff; |
| 272 | 271 | } |
| 273 | 272 | |
| 274 | 273 | |
| 275 | 274 | READ8_MEMBER(qix_state::qix_data_firq_ack_r) |
| 276 | 275 | { |
| 277 | | machine().device("maincpu")->execute().set_input_line(M6809_FIRQ_LINE, CLEAR_LINE); |
| 276 | m_maincpu->set_input_line(M6809_FIRQ_LINE, CLEAR_LINE); |
| 278 | 277 | return 0xff; |
| 279 | 278 | } |
| 280 | 279 | |
| r20297 | r20298 | |
| 288 | 287 | |
| 289 | 288 | WRITE8_MEMBER(qix_state::qix_video_firq_w) |
| 290 | 289 | { |
| 291 | | machine().device("videocpu")->execute().set_input_line(M6809_FIRQ_LINE, ASSERT_LINE); |
| 290 | m_videocpu->set_input_line(M6809_FIRQ_LINE, ASSERT_LINE); |
| 292 | 291 | } |
| 293 | 292 | |
| 294 | 293 | |
| 295 | 294 | WRITE8_MEMBER(qix_state::qix_video_firq_ack_w) |
| 296 | 295 | { |
| 297 | | machine().device("videocpu")->execute().set_input_line(M6809_FIRQ_LINE, CLEAR_LINE); |
| 296 | m_videocpu->set_input_line(M6809_FIRQ_LINE, CLEAR_LINE); |
| 298 | 297 | } |
| 299 | 298 | |
| 300 | 299 | |
| 301 | 300 | READ8_MEMBER(qix_state::qix_video_firq_r) |
| 302 | 301 | { |
| 303 | | machine().device("videocpu")->execute().set_input_line(M6809_FIRQ_LINE, ASSERT_LINE); |
| 302 | m_videocpu->set_input_line(M6809_FIRQ_LINE, ASSERT_LINE); |
| 304 | 303 | return 0xff; |
| 305 | 304 | } |
| 306 | 305 | |
| 307 | 306 | |
| 308 | 307 | READ8_MEMBER(qix_state::qix_video_firq_ack_r) |
| 309 | 308 | { |
| 310 | | machine().device("videocpu")->execute().set_input_line(M6809_FIRQ_LINE, CLEAR_LINE); |
| 309 | m_videocpu->set_input_line(M6809_FIRQ_LINE, CLEAR_LINE); |
| 311 | 310 | return 0xff; |
| 312 | 311 | } |
| 313 | 312 | |
| r20297 | r20298 | |
| 427 | 426 | |
| 428 | 427 | TIMER_CALLBACK_MEMBER(qix_state::pia_w_callback) |
| 429 | 428 | { |
| 430 | | pia6821_device *device = (pia6821_device *)ptr; |
| 431 | | device->write(device->machine().driver_data()->generic_space(), param >> 8, param & 0xff); |
| 429 | m_pia0->write(generic_space(), param >> 8, param & 0xff); |
| 432 | 430 | } |
| 433 | 431 | |
| 434 | 432 | |
| r20297 | r20298 | |
| 436 | 434 | { |
| 437 | 435 | /* make all the CPUs synchronize, and only AFTER that write the command to the PIA */ |
| 438 | 436 | /* otherwise the 68705 will miss commands */ |
| 439 | | machine().scheduler().synchronize(timer_expired_delegate(FUNC(qix_state::pia_w_callback),this), data | (offset << 8), (void *)downcast<pia6821_device *>(machine().device("pia0"))); |
| 437 | machine().scheduler().synchronize(timer_expired_delegate(FUNC(qix_state::pia_w_callback), this), data | (offset << 8)); |
| 440 | 438 | } |
| 441 | 439 | |
| 442 | 440 | |
| r20297 | r20298 | |
| 461 | 459 | * |
| 462 | 460 | *************************************/ |
| 463 | 461 | |
| 464 | | WRITE8_MEMBER(qix_state::slither_76489_0_w) |
| 462 | WRITE8_MEMBER(qix_state::slither_76489_0_w) |
| 465 | 463 | { |
| 466 | 464 | /* write to the sound chip */ |
| 467 | | m_sn1->write(space.machine().device<legacy_cpu_device>("maincpu")->space(), 0, data); |
| 465 | m_sn1->write(generic_space(), 0, data); |
| 468 | 466 | |
| 469 | 467 | /* clock the ready line going back into CB1 */ |
| 470 | | pia6821_device *pia = downcast<pia6821_device *>(machine().device("pia1")); |
| 471 | | pia->cb1_w(0); |
| 472 | | pia->cb1_w(1); |
| 468 | m_pia1->cb1_w(0); |
| 469 | m_pia1->cb1_w(1); |
| 473 | 470 | } |
| 474 | 471 | |
| 475 | 472 | |
| 476 | 473 | WRITE8_MEMBER(qix_state::slither_76489_1_w) |
| 477 | 474 | { |
| 478 | 475 | /* write to the sound chip */ |
| 479 | | m_sn2->write(machine().device<legacy_cpu_device>("maincpu")->space(), 0, data); |
| 476 | m_sn2->write(generic_space(), 0, data); |
| 480 | 477 | |
| 481 | 478 | /* clock the ready line going back into CB1 */ |
| 482 | | pia6821_device *pia = downcast<pia6821_device *>(machine().device("pia2")); |
| 483 | | pia->cb1_w(0); |
| 484 | | pia->cb1_w(1); |
| 479 | m_pia2->cb1_w(0); |
| 480 | m_pia2->cb1_w(1); |
| 485 | 481 | } |
| 486 | 482 | |
| 487 | 483 | |
trunk/src/mame/includes/qix.h
| r20297 | r20298 | |
| 6 | 6 | |
| 7 | 7 | ***************************************************************************/ |
| 8 | 8 | |
| 9 | #include "cpu/m6809/m6809.h" |
| 9 | 10 | #include "video/mc6845.h" |
| 10 | 11 | #include "machine/6821pia.h" |
| 11 | 12 | #include "sound/sn76496.h" |
| r20297 | r20298 | |
| 25 | 26 | public: |
| 26 | 27 | qix_state(const machine_config &mconfig, device_type type, const char *tag) |
| 27 | 28 | : driver_device(mconfig, type, tag) , |
| 29 | m_maincpu(*this, "maincpu"), |
| 30 | m_videocpu(*this, "videocpu"), |
| 31 | m_pia0(*this, "pia0"), |
| 32 | m_pia1(*this, "pia1"), |
| 33 | m_pia2(*this, "pia2"), |
| 34 | m_sndpia0(*this, "sndpia0"), |
| 35 | m_sndpia1(*this, "sndpia1"), |
| 36 | m_sndpia2(*this, "sndpia2"), |
| 28 | 37 | m_sn1 (*this, "sn1"), |
| 29 | 38 | m_sn2 (*this, "sn2"), |
| 30 | 39 | m_68705_port_out(*this, "68705_port_out"), |
| r20297 | r20298 | |
| 37 | 46 | m_discrete(*this, "discrete") { } |
| 38 | 47 | |
| 39 | 48 | /* devices */ |
| 49 | required_device<m6809_device> m_maincpu; |
| 50 | required_device<m6809_device> m_videocpu; |
| 51 | required_device<pia6821_device> m_pia0; |
| 52 | required_device<pia6821_device> m_pia1; |
| 53 | required_device<pia6821_device> m_pia2; |
| 54 | required_device<pia6821_device> m_sndpia0; |
| 55 | optional_device<pia6821_device> m_sndpia1; |
| 56 | optional_device<pia6821_device> m_sndpia2; |
| 40 | 57 | optional_device<sn76489_device> m_sn1; |
| 41 | 58 | optional_device<sn76489_device> m_sn2; |
| 42 | 59 | |
| r20297 | r20298 | |
| 87 | 104 | DECLARE_MACHINE_START(qixmcu); |
| 88 | 105 | DECLARE_VIDEO_START(qix); |
| 89 | 106 | TIMER_CALLBACK_MEMBER(pia_w_callback); |
| 107 | TIMER_CALLBACK_MEMBER(deferred_sndpia1_porta_w); |
| 90 | 108 | DECLARE_WRITE_LINE_MEMBER(qix_vsync_changed); |
| 91 | 109 | DECLARE_READ8_MEMBER(qixmcu_coin_r); |
| 92 | 110 | DECLARE_WRITE8_MEMBER(qixmcu_coin_w); |