trunk/src/mame/drivers/dlair.c
| r31310 | r31311 | |
| 41 | 41 | #include "machine/ldv1000.h" |
| 42 | 42 | #include "machine/ldstub.h" |
| 43 | 43 | #include "machine/z80ctc.h" |
| 44 | | #include "machine/z80sio.h" |
| 44 | #include "machine/z80dart.h" |
| 45 | 45 | #include "sound/ay8910.h" |
| 46 | 46 | #include "sound/speaker.h" |
| 47 | 47 | #include "dlair.lh" |
| r31310 | r31311 | |
| 52 | 52 | public: |
| 53 | 53 | dlair_state(const machine_config &mconfig, device_type type, const char *tag) : |
| 54 | 54 | driver_device(mconfig, type, tag), |
| 55 | | m_ldv1000(*this, "ld_ldv1000"), |
| 56 | | m_pr7820(*this, "ld_pr7820"), |
| 57 | | m_22vp932(*this, "ld_22vp932") , |
| 58 | | m_videoram(*this, "videoram"), |
| 59 | 55 | m_maincpu(*this, "maincpu"), |
| 60 | 56 | m_speaker(*this, "speaker"), |
| 61 | 57 | m_gfxdecode(*this, "gfxdecode"), |
| 62 | | m_palette(*this, "palette") |
| 58 | m_palette(*this, "palette"), |
| 59 | m_ldv1000(*this, "ld_ldv1000"), |
| 60 | m_pr7820(*this, "ld_pr7820"), |
| 61 | m_22vp932(*this, "ld_22vp932"), |
| 62 | m_videoram(*this, "videoram") |
| 63 | 63 | { |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | required_device<cpu_device> m_maincpu; |
| 67 | optional_device<speaker_sound_device> m_speaker; |
| 68 | optional_device<gfxdecode_device> m_gfxdecode; |
| 69 | optional_device<palette_device> m_palette; |
| 70 | optional_device<pioneer_ldv1000_device> m_ldv1000; |
| 71 | optional_device<pioneer_pr7820_device> m_pr7820; |
| 72 | optional_device<phillips_22vp932_device> m_22vp932; |
| 73 | optional_shared_ptr<UINT8> m_videoram; |
| 74 | |
| 66 | 75 | void laserdisc_data_w(UINT8 data) |
| 67 | 76 | { |
| 68 | 77 | if (m_ldv1000 != NULL) m_ldv1000->data_w(data); |
| r31310 | r31311 | |
| 102 | 111 | return CLEAR_LINE; |
| 103 | 112 | } |
| 104 | 113 | |
| 105 | | optional_device<pioneer_ldv1000_device> m_ldv1000; |
| 106 | | optional_device<pioneer_pr7820_device> m_pr7820; |
| 107 | | optional_device<phillips_22vp932_device> m_22vp932; |
| 108 | | optional_shared_ptr<UINT8> m_videoram; |
| 109 | 114 | UINT8 m_last_misc; |
| 110 | 115 | UINT8 m_laserdisc_data; |
| 111 | 116 | DECLARE_WRITE8_MEMBER(misc_w); |
| r31310 | r31311 | |
| 123 | 128 | DECLARE_PALETTE_INIT(dleuro); |
| 124 | 129 | UINT32 screen_update_dleuro(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 125 | 130 | DECLARE_WRITE_LINE_MEMBER(write_speaker); |
| 126 | | DECLARE_WRITE_LINE_MEMBER(dleuro_interrupt); |
| 127 | | DECLARE_WRITE16_MEMBER(serial_transmit); |
| 128 | | DECLARE_READ16_MEMBER(serial_receive); |
| 129 | | required_device<cpu_device> m_maincpu; |
| 130 | | optional_device<speaker_sound_device> m_speaker; |
| 131 | | optional_device<gfxdecode_device> m_gfxdecode; |
| 132 | | optional_device<palette_device> m_palette; |
| 133 | 131 | }; |
| 134 | 132 | |
| 135 | 133 | |
| r31310 | r31311 | |
| 165 | 163 | * |
| 166 | 164 | *************************************/ |
| 167 | 165 | |
| 168 | | WRITE_LINE_MEMBER(dlair_state::dleuro_interrupt) |
| 169 | | { |
| 170 | | m_maincpu->set_input_line(0, state); |
| 171 | | } |
| 172 | | |
| 173 | | |
| 174 | | WRITE16_MEMBER(dlair_state::serial_transmit) |
| 175 | | { |
| 176 | | laserdisc_data_w(data); |
| 177 | | } |
| 178 | | |
| 179 | | |
| 180 | | READ16_MEMBER(dlair_state::serial_receive) |
| 181 | | { |
| 182 | | /* if we still have data to send, do it now */ |
| 183 | | if (offset == 0 && laserdisc_data_available_r() == ASSERT_LINE) |
| 184 | | return laserdisc_data_r(); |
| 185 | | |
| 186 | | return -1; |
| 187 | | } |
| 188 | | |
| 189 | | |
| 190 | | |
| 191 | 166 | WRITE_LINE_MEMBER(dlair_state::write_speaker) |
| 192 | 167 | { |
| 193 | 168 | m_speaker->level_w(state); |
| r31310 | r31311 | |
| 428 | 403 | static ADDRESS_MAP_START( dleuro_io_map, AS_IO, 8, dlair_state ) |
| 429 | 404 | ADDRESS_MAP_GLOBAL_MASK(0xff) |
| 430 | 405 | AM_RANGE(0x00, 0x03) AM_MIRROR(0x7c) AM_DEVREADWRITE("ctc", z80ctc_device, read, write) |
| 431 | | AM_RANGE(0x80, 0x83) AM_MIRROR(0x7c) AM_DEVREADWRITE("sio", z80sio_device, read_alt, write_alt) |
| 406 | AM_RANGE(0x80, 0x83) AM_MIRROR(0x7c) AM_DEVREADWRITE("sio", z80dart_device, ba_cd_r, ba_cd_w) |
| 432 | 407 | ADDRESS_MAP_END |
| 433 | 408 | |
| 434 | 409 | |
| r31310 | r31311 | |
| 730 | 705 | MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) |
| 731 | 706 | MCFG_Z80CTC_ZC0_CB(WRITELINE(dlair_state, write_speaker)) |
| 732 | 707 | |
| 733 | | MCFG_DEVICE_ADD("sio", Z80SIO, MASTER_CLOCK_EURO/4 /* same as "maincpu" */) |
| 734 | | MCFG_Z80SIO_INT_CALLBACK(WRITELINE(dlair_state, dleuro_interrupt)) |
| 735 | | MCFG_Z80SIO_TRANSMIT_CALLBACK(WRITE16(dlair_state,serial_transmit)) |
| 736 | | MCFG_Z80SIO_RECEIVE_CALLBACK(READ16(dlair_state,serial_receive)) |
| 708 | MCFG_Z80SIO0_ADD("sio", MASTER_CLOCK_EURO/4 /* same as "maincpu" */, 0, 0, 0, 0) |
| 709 | MCFG_Z80DART_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) |
| 710 | // TODO: hook up tx and rx callbacks |
| 737 | 711 | |
| 738 | 712 | MCFG_WATCHDOG_TIME_INIT(attotime::from_hz(MASTER_CLOCK_EURO/(16*16*16*16*16*8))) |
| 739 | 713 | |