Skip to content

Commit

Permalink
mc68681,micro3d: small cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
happppp committed Jan 17, 2025
1 parent d7492dd commit dfbcf4d
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 25 deletions.
30 changes: 15 additions & 15 deletions src/devices/machine/mc68681.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,14 @@
The extra baud rates are implemented by an 'X' bit for each channel. The X
bit chooses between two baud rate tables, in addition to the ACR[7] bit.
The X bit is changed by additional commands that are written to CRA and
CRB.
The X bit is changed by additional commands that are written to CRA and CRB.
The MISR is a read only register that takes the place of the 'BRG Test'
register on the MC68681.
The low power standby mode is entered and left by a command written to CRA
or CRB registers. Writing the commands to either register affects the whole
DUART, not just one channel. Resetting the DUART also leaves low power
mode.
DUART, not just one channel. Resetting the DUART also leaves low power mode.
*/

#include "emu.h"
Expand Down Expand Up @@ -70,8 +68,8 @@ static const int baud_rate_ACR_0_X_1[] = { 75, 110, 134, 150, 3600, 14400, 28800
static const int baud_rate_ACR_1[] = { 75, 110, 134, 150, 300, 600, 1200, 2000, 2400, 4800, 1800, 9600, 19200, 0, 0, 0 }; /* xr68c681 X=0 */
static const int baud_rate_ACR_1_X_1[] = { 50, 110, 134, 200, 3600, 14400, 28800, 57600, 115200, 4800, 7200, 9600, 38400, 0, 0, 0 };

static const int baud_rate_ACR_0_340[] = { 50, 110, 134, 200, 300, 600, 1200, 1050, 2400, 4800, 7200, 9600, 38400, 76800, 0, 0 }; /* xr68c681 ACR:7=0 */
static const int baud_rate_ACR_1_340[] = { 75, 110, 134, 150, 300, 600, 1200, 2000, 2400, 4800, 1800, 9600, 19200, 38400, 0, 0 }; /* xr68c681 ACR:7=1 */
static const int baud_rate_ACR_0_340[] = { 50, 110, 134, 200, 300, 600, 1200, 1050, 2400, 4800, 7200, 9600, 38400, 76800, 0, 0 }; /* xr68c681 ACR:7=0 */
static const int baud_rate_ACR_1_340[] = { 75, 110, 134, 150, 300, 600, 1200, 2000, 2400, 4800, 1800, 9600, 19200, 38400, 0, 0 }; /* xr68c681 ACR:7=1 */

#define INT_INPUT_PORT_CHANGE 0x80
#define INT_DELTA_BREAK_B 0x40
Expand Down Expand Up @@ -103,7 +101,7 @@ static const int baud_rate_ACR_1_340[] = { 75, 110, 134, 150, 300, 600, 1
DEFINE_DEVICE_TYPE(SCN2681, scn2681_device, "scn2681", "SCN2681 DUART")
DEFINE_DEVICE_TYPE(MC68681, mc68681_device, "mc68681", "MC68681 DUART")
DEFINE_DEVICE_TYPE(SC28C94, sc28c94_device, "sc28c94", "SC28C94 QUART")
DEFINE_DEVICE_TYPE(MC68340_DUART, mc68340_duart_device, "mc68340duart", "MC68340 DUART Device")
DEFINE_DEVICE_TYPE(MC68340_DUART, mc68340_duart_device, "mc68340duart", "MC68340 DUART")
DEFINE_DEVICE_TYPE(XR68C681, xr68c681_device, "xr68c681", "XR68C681 DUART")
DEFINE_DEVICE_TYPE(DUART_CHANNEL, duart_channel, "duart_channel", "DUART channel")

Expand Down Expand Up @@ -140,8 +138,8 @@ scn2681_device::scn2681_device(const machine_config &mconfig, const char *tag, d
}

mc68681_device::mc68681_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock)
: duart_base_device(mconfig, type, tag, owner, clock),
m_read_vector(false)
: duart_base_device(mconfig, type, tag, owner, clock)
, m_read_vector(false)
{
}

Expand Down Expand Up @@ -173,11 +171,11 @@ mc68340_duart_device::mc68340_duart_device(const machine_config &mconfig, const
}

xr68c681_device::xr68c681_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: mc68681_device(mconfig, XR68C681, tag, owner, clock),
m_XTXA(false),
m_XRXA(false),
m_XTXB(false),
m_XRXB(false)
: mc68681_device(mconfig, XR68C681, tag, owner, clock)
, m_XTXA(false)
, m_XRXA(false)
, m_XTXB(false)
, m_XRXB(false)
{
}

Expand Down Expand Up @@ -1300,8 +1298,10 @@ void duart_channel::tra_callback()
}
}
else
{
// loop back transmitted bit
rx_w(transmit_register_get_data_bit());
}

// TxRDY is not set until the end of start bit time
if (++m_bits_transmitted > 1 && !m_tx_data_in_buffer)
Expand Down Expand Up @@ -1453,7 +1453,7 @@ void duart_channel::write_chan_reg(int reg, uint8_t data)
CSR = data;
tx_baud_rate = m_uart->calc_baud(m_ch, false, data & 0xf);
rx_baud_rate = m_uart->calc_baud(m_ch, true, (data>>4) & 0xf);
//printf("%s ch %d CSR %02x Tx baud %d Rx baud %d\n", tag(), m_ch, data, tx_baud_rate, rx_baud_rate);
//printf("%s ch %d CSR %02x Tx baud %d Rx baud %d\n", tag(), m_ch, data, tx_baud_rate, rx_baud_rate);
set_rcv_rate(rx_baud_rate);
set_tra_rate(tx_baud_rate);
break;
Expand Down
14 changes: 7 additions & 7 deletions src/mame/misc/micro3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,12 @@ void micro3d_state::hostmem(address_map &map)
map(0xa40002, 0xa40003).r(FUNC(micro3d_state::encoder_l_r));
}

void micro3d_state::cpu_space_map(address_map &map)
{
map(0xfffff0, 0xffffff).m(m_maincpu, FUNC(m68000_base_device::autovectors_map));
map(0xfffff6, 0xfffff7).lr16(NAME([this] () -> u16 { return m_duart->get_irq_vector(); }));
}


/*************************************
*
Expand Down Expand Up @@ -294,12 +300,6 @@ void micro3d_state::soundmem_io(address_map &map)
map(0xff01, 0xff01).w(FUNC(micro3d_state::snd_dac_b));
}

void micro3d_state::cpu_space_map(address_map &map)
{
map(0xfffff0, 0xffffff).m(m_maincpu, FUNC(m68000_base_device::autovectors_map));
map(0xfffff6, 0xfffff7).lr16(NAME([this] () -> u16 { return m_duart->get_irq_vector(); }));
}


/*************************************
*
Expand Down Expand Up @@ -480,7 +480,7 @@ ROM_START( f15se22 )
ROM_LOAD16_BYTE( "110-00001-007.u94", 0x0c0000, 0x20000, CRC(36e06cba) SHA1(5ffee5da6f475978be10fa5e1a2c24f00497ea5f) )
ROM_LOAD16_BYTE( "110-00001-008.u71", 0x100001, 0x20000, CRC(d96fd4e2) SHA1(001af758da437e955b4ee914eabeb9739ebc4454) )
ROM_LOAD16_BYTE( "110-00001-009.u95", 0x100000, 0x20000, CRC(33e3b473) SHA1(66deda79ba94f0ed722b399b3fc6062dcdd1a6c9) )
ROM_FILL( 0x140000, 0x40000, 0xff )
ROM_FILL( 0x140000, 0x40000, 0xff )

// Dr Math PCB (MPG 010-00002-001)
ROM_REGION32_BE( 0x100000, "drmath", 0 )
Expand Down
5 changes: 2 additions & 3 deletions src/mame/misc/micro3d_m.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -401,9 +401,9 @@ void micro3d_state::drmath_intr2_ack(uint32_t data)

/***************************************************************************
8031 port mappings:
8051 port mappings:
Port 1 Port 2
Port 1 Port 3
======= ======
0: S/H sel A (O) 0:
1: S/H sel B (O) 1:
Expand All @@ -416,7 +416,6 @@ void micro3d_state::drmath_intr2_ack(uint32_t data)
***************************************************************************/


void micro3d_state::snd_dac_a(uint8_t data)
{
m_noise[0]->dac_w(data);
Expand Down

0 comments on commit dfbcf4d

Please sign in to comment.