mirror of
https://github.com/holub/mame
synced 2025-10-05 08:41:31 +03:00
com8116: Simplify read/write handlers (nw)
adm23: Add baud rate switches (nw)
This commit is contained in:
parent
15a3023fb4
commit
9902aea9cf
@ -381,6 +381,6 @@ void softbox_device::ieee488_ifc(int state)
|
||||
|
||||
WRITE8_MEMBER( softbox_device::dbrg_w )
|
||||
{
|
||||
m_dbrg->write_str(data & 0x0f);
|
||||
m_dbrg->write_stt(data >> 4);
|
||||
m_dbrg->str_w(data & 0x0f);
|
||||
m_dbrg->stt_w(data >> 4);
|
||||
}
|
||||
|
@ -204,7 +204,7 @@ void com8116_device::device_timer(emu_timer &timer, device_timer_id id, int para
|
||||
// str_w -
|
||||
//-------------------------------------------------
|
||||
|
||||
void com8116_device::write_str(uint8_t data)
|
||||
void com8116_device::str_w(uint8_t data)
|
||||
{
|
||||
int fr_divider = data & 0x0f;
|
||||
int fr_clock = clock() / m_divisors[fr_divider];
|
||||
@ -219,7 +219,7 @@ void com8116_device::write_str(uint8_t data)
|
||||
// stt_w -
|
||||
//-------------------------------------------------
|
||||
|
||||
void com8116_device::write_stt(uint8_t data)
|
||||
void com8116_device::stt_w(uint8_t data)
|
||||
{
|
||||
int ft_divider = data & 0x0f;
|
||||
int ft_clock = clock() / m_divisors[ft_divider];
|
||||
@ -234,10 +234,10 @@ void com8116_device::write_stt(uint8_t data)
|
||||
// str_stt_w -
|
||||
//-------------------------------------------------
|
||||
|
||||
WRITE8_MEMBER(com8116_device::str_stt_w)
|
||||
void com8116_device::str_stt_w(uint8_t data)
|
||||
{
|
||||
write_str(data >> 4);
|
||||
write_stt(data & 0x0f);
|
||||
str_w(data >> 4);
|
||||
stt_w(data & 0x0f);
|
||||
}
|
||||
|
||||
|
||||
@ -245,8 +245,8 @@ WRITE8_MEMBER(com8116_device::str_stt_w)
|
||||
// stt_str_w -
|
||||
//-------------------------------------------------
|
||||
|
||||
WRITE8_MEMBER(com8116_device::stt_str_w)
|
||||
void com8116_device::stt_str_w(uint8_t data)
|
||||
{
|
||||
write_stt(data >> 4);
|
||||
write_str(data & 0x0f);
|
||||
stt_w(data >> 4);
|
||||
str_w(data & 0x0f);
|
||||
}
|
||||
|
@ -43,12 +43,10 @@ public:
|
||||
auto fr_handler() { return m_fr_handler.bind(); }
|
||||
auto ft_handler() { return m_ft_handler.bind(); }
|
||||
|
||||
void write_str(uint8_t data);
|
||||
void write_stt(uint8_t data);
|
||||
DECLARE_WRITE8_MEMBER(str_w) { write_str(data); }
|
||||
DECLARE_WRITE8_MEMBER(stt_w) { write_stt(data); }
|
||||
DECLARE_WRITE8_MEMBER(str_stt_w);
|
||||
DECLARE_WRITE8_MEMBER(stt_str_w);
|
||||
void str_w(uint8_t data);
|
||||
void stt_w(uint8_t data);
|
||||
void str_stt_w(uint8_t data);
|
||||
void stt_str_w(uint8_t data);
|
||||
|
||||
protected:
|
||||
com8116_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, const int *divisors);
|
||||
|
@ -36,15 +36,17 @@ public:
|
||||
: driver_device(mconfig, type, tag)
|
||||
, m_maincpu(*this, "maincpu")
|
||||
, m_acia(*this, "acia%u", 1U)
|
||||
, m_brg(*this, "brg")
|
||||
, m_vtac(*this, "vtac")
|
||||
, m_chargen(*this, "chargen")
|
||||
, m_baud(*this, "BAUD")
|
||||
{
|
||||
}
|
||||
|
||||
void adm31(machine_config &mconfig);
|
||||
|
||||
protected:
|
||||
virtual void machine_start() override;
|
||||
virtual void machine_reset() override;
|
||||
|
||||
private:
|
||||
u32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
|
||||
@ -53,13 +55,17 @@ private:
|
||||
|
||||
required_device<cpu_device> m_maincpu;
|
||||
required_device_array<acia6850_device, 2> m_acia;
|
||||
required_device<com8116_device> m_brg;
|
||||
required_device<crt5027_device> m_vtac;
|
||||
required_region_ptr<u8> m_chargen;
|
||||
required_ioport m_baud;
|
||||
};
|
||||
|
||||
|
||||
void adm31_state::machine_start()
|
||||
void adm31_state::machine_reset()
|
||||
{
|
||||
// Baud rate switches read by CPU on ADM-42, but not on ADM-31?
|
||||
m_brg->stt_str_w(m_baud->read());
|
||||
}
|
||||
|
||||
|
||||
@ -274,6 +280,40 @@ static INPUT_PORTS_START(adm31)
|
||||
PORT_DIPNAME(0x80, 0x80, "Polling Option") PORT_DIPLOCATION("S6:8")
|
||||
PORT_DIPSETTING(0x80, "Disable")
|
||||
PORT_DIPSETTING(0x00, "Enable")
|
||||
|
||||
PORT_START("BAUD")
|
||||
PORT_DIPNAME(0x0f, 0x0e, "Modem Baud Rate") PORT_DIPLOCATION("BS1:1,2,3,4")
|
||||
PORT_DIPSETTING(0x00, "50")
|
||||
PORT_DIPSETTING(0x01, "75")
|
||||
PORT_DIPSETTING(0x02, "110")
|
||||
PORT_DIPSETTING(0x03, "134.5")
|
||||
PORT_DIPSETTING(0x04, "150")
|
||||
PORT_DIPSETTING(0x05, "300")
|
||||
PORT_DIPSETTING(0x06, "600")
|
||||
PORT_DIPSETTING(0x07, "1200")
|
||||
PORT_DIPSETTING(0x08, "1800")
|
||||
PORT_DIPSETTING(0x09, "2000")
|
||||
PORT_DIPSETTING(0x0a, "2400")
|
||||
PORT_DIPSETTING(0x0b, "3600")
|
||||
PORT_DIPSETTING(0x0c, "4800")
|
||||
PORT_DIPSETTING(0x0d, "7200")
|
||||
PORT_DIPSETTING(0x0e, "9600")
|
||||
PORT_DIPNAME(0x0f, 0x07, "Printer Baud Rate") PORT_DIPLOCATION("BS2:1,2,3,4")
|
||||
PORT_DIPSETTING(0x00, "50")
|
||||
PORT_DIPSETTING(0x01, "75")
|
||||
PORT_DIPSETTING(0x02, "110")
|
||||
PORT_DIPSETTING(0x03, "134.5")
|
||||
PORT_DIPSETTING(0x04, "150")
|
||||
PORT_DIPSETTING(0x05, "300")
|
||||
PORT_DIPSETTING(0x06, "600")
|
||||
PORT_DIPSETTING(0x07, "1200")
|
||||
PORT_DIPSETTING(0x08, "1800")
|
||||
PORT_DIPSETTING(0x09, "2000")
|
||||
PORT_DIPSETTING(0x0a, "2400")
|
||||
PORT_DIPSETTING(0x0b, "3600")
|
||||
PORT_DIPSETTING(0x0c, "4800")
|
||||
PORT_DIPSETTING(0x0d, "7200")
|
||||
PORT_DIPSETTING(0x0e, "9600")
|
||||
INPUT_PORTS_END
|
||||
|
||||
void adm31_state::adm31(machine_config &config)
|
||||
@ -291,11 +331,11 @@ void adm31_state::adm31(machine_config &config)
|
||||
ACIA6850(config, m_acia[1]);
|
||||
m_acia[0]->irq_handler().set("mainirq", FUNC(input_merger_device::in_w<1>));
|
||||
|
||||
com8116_device &brg(COM8116(config, "brg", 5.0688_MHz_XTAL));
|
||||
brg.fr_handler().set(m_acia[0], FUNC(acia6850_device::write_rxc));
|
||||
brg.fr_handler().append(m_acia[0], FUNC(acia6850_device::write_txc));
|
||||
brg.ft_handler().set(m_acia[1], FUNC(acia6850_device::write_rxc));
|
||||
brg.ft_handler().append(m_acia[1], FUNC(acia6850_device::write_txc));
|
||||
COM8116(config, m_brg, 5.0688_MHz_XTAL);
|
||||
m_brg->fr_handler().set(m_acia[0], FUNC(acia6850_device::write_rxc));
|
||||
m_brg->fr_handler().append(m_acia[0], FUNC(acia6850_device::write_txc));
|
||||
m_brg->ft_handler().set(m_acia[1], FUNC(acia6850_device::write_rxc));
|
||||
m_brg->ft_handler().append(m_acia[1], FUNC(acia6850_device::write_txc));
|
||||
|
||||
screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
|
||||
screen.set_raw(19.584_MHz_XTAL, 1020, 0, 800, 320, 0, 288);
|
||||
|
@ -340,8 +340,8 @@ void ampex_state::machine_start()
|
||||
m_uart->write_swe(0);
|
||||
|
||||
// Are rates hardwired to DIP switches? They don't seem to be software-controlled...
|
||||
m_dbrg->write_str(0xe);
|
||||
m_dbrg->write_stt(0xe);
|
||||
m_dbrg->str_w(0xe);
|
||||
m_dbrg->stt_w(0xe);
|
||||
|
||||
// Make up some settings for the UART (probably also actually controlled by DIP switches)
|
||||
m_uart->write_nb1(1);
|
||||
|
@ -336,10 +336,10 @@ WRITE_LINE_MEMBER(bitgraph_state::system_clock_write)
|
||||
WRITE16_MEMBER(bitgraph_state::baud_write)
|
||||
{
|
||||
DBG_LOG(1,"Baud", ("%04X\n", data));
|
||||
m_dbrgb->write_str(data & 15); // 2 DBG
|
||||
m_dbrga->write_stt((data >> 4) & 15); // 1 KBD
|
||||
m_dbrgb->write_stt((data >> 8) & 15); // 3 PNT
|
||||
m_dbrga->write_str((data >> 12) & 15); // 0 HOST
|
||||
m_dbrgb->str_w(data & 15); // 2 DBG
|
||||
m_dbrga->stt_w((data >> 4) & 15); // 1 KBD
|
||||
m_dbrgb->stt_w((data >> 8) & 15); // 3 PNT
|
||||
m_dbrga->str_w((data >> 12) & 15); // 0 HOST
|
||||
}
|
||||
|
||||
WRITE_LINE_MEMBER(bitgraph_state::com8116_a_fr_w)
|
||||
|
@ -430,7 +430,7 @@ void hp64k_state::machine_reset()
|
||||
m_floppy0_wpt = false;
|
||||
m_floppy1_wpt = false;
|
||||
m_beeper->set_state(0);
|
||||
m_baud_rate->write_str((m_s5_sw->read() >> 1) & 0xf);
|
||||
m_baud_rate->str_w((m_s5_sw->read() >> 1) & 0xf);
|
||||
m_16x_clk = (m_rs232_sw->read() & 0x02) != 0;
|
||||
m_loopback = false;
|
||||
m_txd_state = true;
|
||||
|
@ -251,8 +251,8 @@ INPUT_PORTS_END
|
||||
void icebox_state::machine_reset()
|
||||
{
|
||||
u8 data = ioport("BAUD")->read();
|
||||
m_brg->write_str(data & 15); // Terminal
|
||||
m_brg->write_stt((data >> 4) & 15); // Printer
|
||||
m_brg->str_w(data & 15); // Terminal
|
||||
m_brg->stt_w((data >> 4) & 15); // Printer
|
||||
m_maincpu->set_pc(0xf000);
|
||||
m_f1 = 0;
|
||||
}
|
||||
|
@ -160,8 +160,8 @@ void ob68k1a_state::machine_start()
|
||||
void ob68k1a_state::machine_reset()
|
||||
{
|
||||
// initialize COM8116
|
||||
m_dbrg->write_stt(0x0e);
|
||||
m_dbrg->write_str(0x0e);
|
||||
m_dbrg->stt_w(0x0e);
|
||||
m_dbrg->str_w(0x0e);
|
||||
|
||||
// set reset vector
|
||||
void *ram = m_maincpu->space(AS_PROGRAM).get_write_ptr(0);
|
||||
|
@ -1417,10 +1417,10 @@ WRITE_LINE_MEMBER(rainbow_state::mpsc_irq)
|
||||
// PORT 0x06 : Communication bit rates (see page 21 of PC 100 SPEC)
|
||||
WRITE8_MEMBER(rainbow_state::comm_bitrate_w)
|
||||
{
|
||||
m_dbrg->write_str(data & 0x0f); // PDF is wrong, low nibble is RECEIVE clock (verified in SETUP).
|
||||
m_dbrg->str_w(data & 0x0f); // PDF is wrong, low nibble is RECEIVE clock (verified in SETUP).
|
||||
logerror("\n(COMM.) receive bitrate = %d ($%02x)\n", comm_rates[data & 0x0f] , data & 0x0f);
|
||||
|
||||
m_dbrg->write_stt( ((data & 0xf0) >> 4) );
|
||||
m_dbrg->stt_w( ((data & 0xf0) >> 4) );
|
||||
logerror("(COMM.) transmit bitrate = %d ($%02x)\n", comm_rates[((data & 0xf0) >> 4)] ,(data & 0xf0) >> 4);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user