wy50, wy60: Add AUX ports

This commit is contained in:
AJR 2023-12-10 16:40:28 -05:00
parent 164fff9a74
commit 8aa103ebc4
2 changed files with 40 additions and 9 deletions

View File

@ -53,6 +53,7 @@ public:
, m_pvtc(*this, "pvtc")
, m_sio(*this, "sio")
, m_beep(*this, "beep")
, m_aux(*this, "aux")
, m_chargen(*this, "chargen")
, m_videoram(*this, "videoram%u", 0U)
{
@ -78,6 +79,7 @@ private:
void earom_w(u8 data);
u8 p1_r();
void p1_w(u8 data);
u8 p3_r();
void prg_map(address_map &map);
void io_map(address_map &map);
@ -89,6 +91,7 @@ private:
required_device<scn2672_device> m_pvtc;
required_device<scn2661b_device> m_sio;
required_device<beep_device> m_beep;
required_device<rs232_port_device> m_aux;
required_region_ptr<u8> m_chargen;
required_shared_ptr_array<u8, 2> m_videoram;
@ -239,20 +242,22 @@ void wy50_state::earom_w(u8 data)
u8 wy50_state::p1_r()
{
// P1.0 = AUX RDY
// P1.0 = AUX RDY (DTR)
// P1.1 = NVD OUT
// P1.4 = KEY (inverted, active high)
return 0xed | (m_earom->data_r() << 1) | (m_keyboard->sense_r() ? 0x00 : 0x10);
return 0xe4 | m_aux->dsr_r() | (m_earom->data_r() << 1) | (m_aux->cts_r() << 2) | (m_keyboard->sense_r() ? 0x00 : 0x10);
}
void wy50_state::p1_w(u8 data)
{
// P1.2 = EXFONT
// P1.3 = AUX RTS
// P1.3 = AUX RTS (DSR)
// P1.5 = BEEPER
// P1.6 = REV/DIM PROT
// P1.7 (inverted) = 80/132
m_aux->write_dtr(BIT(data, 3));
m_beep->set_state(BIT(data, 5));
m_rev_prot = BIT(data, 6);
@ -265,6 +270,11 @@ void wy50_state::p1_w(u8 data)
}
}
u8 wy50_state::p3_r()
{
return m_aux->rxd_r() | 0xfe;
}
void wy50_state::prg_map(address_map &map)
{
map(0x0000, 0x1fff).rom().region("maincpu", 0);
@ -298,6 +308,8 @@ void wy50_state::wy50(machine_config &config)
m_maincpu->set_addrmap(AS_IO, &wy50_state::io_map);
m_maincpu->port_in_cb<1>().set(FUNC(wy50_state::p1_r));
m_maincpu->port_out_cb<1>().set(FUNC(wy50_state::p1_w));
m_maincpu->port_in_cb<3>().set(FUNC(wy50_state::p3_r));
m_maincpu->port_out_cb<3>().set(m_aux, FUNC(rs232_port_device::write_txd)).bit(1);
WY50_KEYBOARD(config, m_keyboard);
@ -330,6 +342,8 @@ void wy50_state::wy50(machine_config &config)
modem.cts_handler().set(m_sio, FUNC(scn2661b_device::cts_w));
modem.dcd_handler().set(m_sio, FUNC(scn2661b_device::dcd_w));
RS232_PORT(config, m_aux, default_rs232_devices, "loopback");
SPEAKER(config, "speaker").front_center();
// Star Micronics QMB06 PZT Buzzer (2048Hz peak) + LC filter, output frequency is approximated here
BEEP(config, m_beep, 1000).add_route(ALL_OUTPUTS, "speaker", 0.10);

View File

@ -29,6 +29,7 @@ public:
, m_keyboard(*this, "keyboard")
, m_pvtc(*this, "pvtc")
, m_sio(*this, "sio")
, m_aux(*this, "aux")
, m_charram(*this, "charram")
, m_attrram(*this, "attrram")
, m_fontram(*this, "fontram", 0x2000, ENDIANNESS_LITTLE)
@ -59,6 +60,7 @@ private:
void p1_w(u8 data);
u8 p1_r();
u8 p3_r();
void ea_w(int state);
void prog_map(address_map &map);
@ -69,6 +71,7 @@ private:
required_device<wyse_keyboard_port_device> m_keyboard;
required_device<scn2672_device> m_pvtc;
required_device<scn2661b_device> m_sio;
required_device<rs232_port_device> m_aux;
required_shared_ptr<u8> m_charram;
required_shared_ptr<u8> m_attrram;
memory_share_creator<u8> m_fontram;
@ -186,6 +189,7 @@ void wy60_state::sio_w(offs_t offset, u8 data)
void wy60_state::p1_w(u8 data)
{
// P1.0 -> _80/132
if (BIT(data, 0) != m_is_132)
{
m_is_132 = BIT(data, 0);
@ -193,19 +197,30 @@ void wy60_state::p1_w(u8 data)
m_pvtc->set_unscaled_clock(m_is_132 ? 39.71_MHz_XTAL / 9 : 26.58_MHz_XTAL / 10);
}
// P1.1 -> EEPROM SDA
// P1.2 -> EEPROM SCL
// N.B. The current i2cmem emulation is a bit sensitive to the order of these writes.
m_eeprom->write_scl(BIT(data, 2));
m_eeprom->write_sda(BIT(data, 1));
m_keyboard->cmd_w(!BIT(data, 5));
// P1.3 -> AUX DSR
m_aux->write_dtr(BIT(data, 3));
// TODO: P1.3 -> AUX DSR
// P1.5 -> KBD CMD (transmitted through 74LS368)
m_keyboard->cmd_w(!BIT(data, 5));
}
u8 wy60_state::p1_r()
{
// TODO: P1.4 <- AUX DTR
return (m_eeprom->read_sda() << 1) | (m_keyboard->data_r() ? 0 : 0x40) | 0xad;
// P1.1 <- EEPROM SDA
// P1.4 <- AUX DTR
// P1.6 <- KBD DATA (received through 74LS368)
return (m_eeprom->read_sda() << 1) | (m_aux->dsr_r() << 4) | (m_keyboard->data_r() ? 0 : 0x40) | 0xad;
}
u8 wy60_state::p3_r()
{
return m_aux->rxd_r() | 0xfe;
}
void wy60_state::ea_w(int state)
@ -250,7 +265,9 @@ void wy60_state::wy60(machine_config &config)
maincpu.set_addrmap(AS_IO, &wy60_state::ext_map);
maincpu.port_out_cb<1>().set(FUNC(wy60_state::p1_w));
maincpu.port_in_cb<1>().set(FUNC(wy60_state::p1_r));
maincpu.port_out_cb<3>().set(FUNC(wy60_state::ea_w)).bit(5);
maincpu.port_out_cb<3>().set(m_aux, FUNC(rs232_port_device::write_txd)).bit(1);
maincpu.port_out_cb<3>().append(FUNC(wy60_state::ea_w)).bit(5);
maincpu.port_in_cb<3>().set(FUNC(wy60_state::p3_r));
I2C_X2404P(config, m_eeprom);
@ -284,7 +301,7 @@ void wy60_state::wy60(machine_config &config)
modem.cts_handler().set(m_sio, FUNC(scn2661b_device::cts_w));
modem.dcd_handler().set(m_sio, FUNC(scn2661b_device::dcd_w));
// TODO: AUX port connected to 8051
RS232_PORT(config, m_aux, default_rs232_devices, "loopback");
}
// CPU: 8051(202008-03)