diff options
Diffstat (limited to 'src/devices/bus/a2bus/a2mockingboard.cpp')
-rw-r--r-- | src/devices/bus/a2bus/a2mockingboard.cpp | 107 |
1 files changed, 91 insertions, 16 deletions
diff --git a/src/devices/bus/a2bus/a2mockingboard.cpp b/src/devices/bus/a2bus/a2mockingboard.cpp index 6073e843371..380e9988a8b 100644 --- a/src/devices/bus/a2bus/a2mockingboard.cpp +++ b/src/devices/bus/a2bus/a2mockingboard.cpp @@ -41,11 +41,13 @@ DEFINE_DEVICE_TYPE(A2BUS_ECHOPLUS, a2bus_echoplus_device, "a2echop", "S void a2bus_ayboard_device::add_common_devices(machine_config &config) { MOS6522(config, m_via1, 1022727); + m_via1->readpa_handler().set(FUNC(a2bus_ayboard_device::via1_in_a)); m_via1->writepa_handler().set(FUNC(a2bus_ayboard_device::via1_out_a)); m_via1->writepb_handler().set(FUNC(a2bus_ayboard_device::via1_out_b)); m_via1->irq_handler().set(FUNC(a2bus_ayboard_device::via1_irq_w)); MOS6522(config, m_via2, 1022727); + m_via2->readpa_handler().set(FUNC(a2bus_ayboard_device::via2_in_a)); m_via2->writepa_handler().set(FUNC(a2bus_ayboard_device::via2_out_a)); m_via2->writepb_handler().set(FUNC(a2bus_ayboard_device::via2_out_b)); m_via2->irq_handler().set(FUNC(a2bus_ayboard_device::via2_irq_w)); @@ -101,6 +103,9 @@ void a2bus_echoplus_device::device_add_mconfig(machine_config &config) { add_common_devices(config); + config.device_remove(VIA2_TAG); + m_via1->writepb_handler().set(FUNC(a2bus_ayboard_device::via1_out_b)); + AY8913(config, m_ay2, 1022727); m_ay2->add_route(ALL_OUTPUTS, "rspeaker", 0.5); @@ -165,7 +170,7 @@ void a2bus_ayboard_device::device_reset() read_cnxx - called for reads from this card's cnxx space -------------------------------------------------*/ -uint8_t a2bus_ayboard_device::read_cnxx(uint8_t offset) +u8 a2bus_ayboard_device::read_cnxx(u8 offset) { if (offset <= 0x7f) { @@ -179,9 +184,15 @@ uint8_t a2bus_ayboard_device::read_cnxx(uint8_t offset) return 0; } -uint8_t a2bus_phasor_device::read_cnxx(uint8_t offset) +u8 a2bus_echoplus_device::read_cnxx(u8 offset) { - uint8_t ret = 0; + m_last_cnxx_addr = offset; + return m_via1->read(offset & 0xf); +} + +u8 a2bus_phasor_device::read_cnxx(u8 offset) +{ + u8 ret = 0; int via_sel; if (m_native) @@ -212,7 +223,7 @@ uint8_t a2bus_phasor_device::read_cnxx(uint8_t offset) write_cnxx - called for writes to this card's c0nx space -------------------------------------------------*/ -void a2bus_ayboard_device::write_cnxx(uint8_t offset, uint8_t data) +void a2bus_ayboard_device::write_cnxx(u8 offset, u8 data) { // When the SSI-263 is emulated, Cn40 will write to both the VIA and // the first SSI-263, and Cn20 will write to both the VIA and the @@ -227,7 +238,13 @@ void a2bus_ayboard_device::write_cnxx(uint8_t offset, uint8_t data) } } -void a2bus_phasor_device::write_cnxx(uint8_t offset, uint8_t data) +void a2bus_echoplus_device::write_cnxx(u8 offset, u8 data) +{ + m_last_cnxx_addr = offset; + m_via1->write(offset & 0xf, data); +} + +void a2bus_phasor_device::write_cnxx(u8 offset, u8 data) { if ((offset < 0x20) || (offset >= 0x80 && offset < 0xa0)) { @@ -277,12 +294,12 @@ WRITE_LINE_MEMBER( a2bus_ayboard_device::via2_irq_w ) } } -void a2bus_ayboard_device::via1_out_a(uint8_t data) +void a2bus_ayboard_device::via1_out_a(u8 data) { m_porta1 = data; } -void a2bus_ayboard_device::via1_out_b(uint8_t data) +void a2bus_ayboard_device::via1_out_b(u8 data) { if (!BIT(data, 2)) { @@ -310,7 +327,65 @@ void a2bus_ayboard_device::via1_out_b(uint8_t data) } } -void a2bus_phasor_device::via1_out_b(uint8_t data) +void a2bus_echoplus_device::via1_out_b(u8 data) +{ + if (!(m_last_cnxx_addr & 0x80)) + { + if (!BIT(data, 2)) + { + m_ay1->reset_w(); + } + else + { + switch (data & 3) + { + case 0: // BDIR=0, BC1=0 (inactive) + break; + + case 1: // BDIR=0, BC1=1 (read PSG) + m_porta1 = m_ay1->data_r(); + break; + + case 2: // BDIR=1, BC1=0 (write PSG) + m_ay1->data_w(m_porta1); + break; + + case 3: // BDIR=1, BC1=1 (latch) + m_ay1->address_w(m_porta1); + break; + } + } + } + else + { + if (!BIT(data, 2)) + { + m_ay2->reset_w(); + } + else + { + switch (data & 3) + { + case 0: // BDIR=0, BC1=0 (inactive) + break; + + case 1: // BDIR=0, BC1=1 (read PSG) + m_porta1 = m_ay2->data_r(); + break; + + case 2: // BDIR=1, BC1=0 (write PSG) + m_ay2->data_w(m_porta1); + break; + + case 3: // BDIR=1, BC1=1 (latch) + m_ay2->address_w(m_porta1); + break; + } + } + } +} + +void a2bus_phasor_device::via1_out_b(u8 data) { if (!(data & 4)) { @@ -359,12 +434,12 @@ void a2bus_phasor_device::via1_out_b(uint8_t data) } } -void a2bus_ayboard_device::via2_out_a(uint8_t data) +void a2bus_ayboard_device::via2_out_a(u8 data) { m_porta2 = data; } -void a2bus_ayboard_device::via2_out_b(uint8_t data) +void a2bus_ayboard_device::via2_out_b(u8 data) { if (!BIT(data, 2)) { @@ -392,7 +467,7 @@ void a2bus_ayboard_device::via2_out_b(uint8_t data) } } -void a2bus_phasor_device::via2_out_b(uint8_t data) +void a2bus_phasor_device::via2_out_b(u8 data) { if (!BIT(data, 2)) { @@ -463,20 +538,20 @@ void a2bus_phasor_device::set_clocks() } } -uint8_t a2bus_phasor_device::read_c0nx(uint8_t offset) +u8 a2bus_phasor_device::read_c0nx(u8 offset) { m_native = BIT(offset, 0); set_clocks(); return 0xff; } -void a2bus_phasor_device::write_c0nx(uint8_t offset, uint8_t data) +void a2bus_phasor_device::write_c0nx(u8 offset, u8 data) { m_native = BIT(offset, 0); set_clocks(); } -uint8_t a2bus_echoplus_device::read_c0nx(uint8_t offset) +u8 a2bus_echoplus_device::read_c0nx(u8 offset) { switch (offset) { @@ -487,7 +562,7 @@ uint8_t a2bus_echoplus_device::read_c0nx(uint8_t offset) return 0; } -void a2bus_echoplus_device::write_c0nx(uint8_t offset, uint8_t data) +void a2bus_echoplus_device::write_c0nx(u8 offset, u8 data) { switch (offset) { @@ -513,7 +588,7 @@ WRITE_LINE_MEMBER( a2bus_mockingboard_device::write_via1_cb2 ) m_last_cb2_state = state; } -void a2bus_mockingboard_device::via1_out_b(uint8_t data) +void a2bus_mockingboard_device::via1_out_b(u8 data) { m_portb1 = data; |