summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--src/devices/machine/com8116.cpp64
-rw-r--r--src/devices/machine/com8116.h56
-rw-r--r--src/mame/drivers/ampex.cpp7
-rw-r--r--src/mame/drivers/vt100.cpp30
4 files changed, 112 insertions, 45 deletions
diff --git a/src/devices/machine/com8116.cpp b/src/devices/machine/com8116.cpp
index 1569e83176a..9c23104f414 100644
--- a/src/devices/machine/com8116.cpp
+++ b/src/devices/machine/com8116.cpp
@@ -9,7 +9,9 @@
#include "emu.h"
#include "com8116.h"
-//#define VERBOSE 1
+#define LOG_SELECTED (1 << 0)
+#define LOG_TABLE (1 << 1)
+//#define VERBOSE (LOG_TABLE)
#include "logmacro.h"
@@ -20,6 +22,9 @@
// device type definition
DEFINE_DEVICE_TYPE(COM8116, com8116_device, "com8116", "COM8116 Dual BRG")
+DEFINE_DEVICE_TYPE(COM8116_003, com8116_003_device, "com8116_003", "COM8116-003 Dual BRG")
+DEFINE_DEVICE_TYPE(COM5016_5, com5016_5_device, "com5016_5", "COM5016-5 Dual BRG")
+DEFINE_DEVICE_TYPE(COM5016_013, com5016_013_device, "com5016_013", "COM5016-013 Dual BRG")
// Parts with T after the number do not have an internal oscillator and require an external clock source
// The SMC/COM 5xxx parts are all dual 5v/12v parts, while the 8xxx parts are 5v only
@@ -29,53 +34,53 @@ DEFINE_DEVICE_TYPE(COM8116, com8116_device, "com8116", "COM8116 Dual BRG")
// and Motorola K1135A/B (K1135B outputs undivided 5.0688 MHz on pin 1)
// SMC/COM8156(T) is the same chip but clocked twice as fast and 32x clocks per baud instead of 16x
// baud rates are 50, 75, 110, 134.5, 150, 300, 600, 1200, 1800, 2000, 2400, 3600, 4800, 7200, 9600, 19200
-const int com8116_device::divisors_16X_5_0688MHz[] =
+const int com8116_device::divisors_16X_5_0688MHz[16] =
{ 6336, 4224, 2880, 2355, 2112, 1056, 528, 264, 176, 158, 132, 88, 66, 44, 33, 16 };
// SMC/COM8116-003
// from http://www.vintagecomputer.net/fjkraan/comp/divcomp/doc/SMC_BaudGen.pdf page 283 (pdf page 20)
// baud rates are 50, 75, 110, 134.5, 150, 200, 300, 600, 1200, 1800, 2000, 2400, 3600, 4800, 9600, 19200
// SMC/COM8116T-020 should have similar output rates, but clock is unknown and probably different
-const int com8116_device::divisors_16X_6_01835MHz[] =
+const int com8116_device::divisors_16X_6_01835MHz[16] =
{ 7523, 5015, 3420, 2797, 2508, 1881, 1254, 627, 313, 209, 188, 157, 104, 78, 39, 20 };
// SMC/COM5016(T)-5 and WD WD-1943-05; Synertek SY2661-1 and 2 are NOT the same as this despite using same clock speed, see below
// SMC/COM8156(T)-5 is the same chip but clocked twice as fast and 32x clocks per baud instead of 16x
// Motorola K1135C is similar, with undivided 4.9152 MHz on pin 1
// baud rates are 50, 75, 110, 134.5, 150, 300, 600, 1200, 1800, 2000, 2400, 3600, 4800, 7200, 9600, 19200
-const int com8116_device::divisors_16X_4_9152MHz[] =
+const int com8116_device::divisors_16X_4_9152MHz[16] =
{ 6144, 4096, 2793, 2284, 2048, 1024, 512, 256, 171, 154, 128, 85, 64, 43, 32, 16 };
// SMC/COM5016(T)-6 and WD WD-1943-06
// baud rates are 50, 75, 110, 134.5, 150, 200, 300, 600, 1200, 1800, 2400, 3600, 4800, 7200, 9600, 19200
-const int com8116_device::divisors_32X_5_0688MHz[] =
+const int com8116_device::divisors_32X_5_0688MHz[16] =
{ 3168, 2112, 1440, 1177, 1056, 792, 528, 264, 132, 88, 66, 44, 33, 22, 16, 8 };
// SMC/COM5016(T)-013 (from http://bitsavers.informatik.uni-stuttgart.de/pdf/dec/terminal/vt100/EK-VT100-TM-003_VT100_Technical_Manual_Jul82.pdf page 4-27 (pdf page 78))
// and from http://www.vintagecomputer.net/fjkraan/comp/divcomp/doc/SMC_BaudGen.pdf page 283 (pdf page 20)
// SMC/COM5106-013A is the same chip clocked twice as fast, but with 32x clocks per baud instead of 16x
// baud rates are 50, 75, 110, 134.5, 150, 200, 300, 600, 1200, 1800, 2000, 2400, 3600, 4800, 9600, 19200
-const int com8116_device::divisors_16X_2_7648MHz[] =
+const int com8116_device::divisors_16X_2_7648MHz[16] =
{ 3456, 2304, 1571, 1285, 1152, 864, 576, 288, 144, 96, 86, 72, 48, 36, 18, 9 };
// SMC/COM5026(T)-030 (non-standard serial rates, from http://bitsavers.informatik.uni-stuttgart.de/pdf/standardMicrosystems/_dataBooks/1979_StandardMicrosystems.pdf page 135)
-const int com8116_device::divisors_16X_5_0688MHz_030[] =
+const int com8116_device::divisors_16X_5_0688MHz_030[16] =
{ 731, 733, 735, 737, 741, 743, 745, 751, 6970, 5569, 5433, 4752, 4269, 1920, 1584, 301 };
// SMC/COM5036(T)-080 (from http://bitsavers.informatik.uni-stuttgart.de/pdf/standardMicrosystems/_dataBooks/1979_StandardMicrosystems.pdf page 135)
-const int com8116_device::divisors_16X_4_6080MHz[] =
+const int com8116_device::divisors_16X_4_6080MHz[16] =
{ 5760, 3840, 2618, 2141, 1920, 960, 480, 240, 160, 144, 120, 80, 60, 40, 30, 15 };
// COM8046 combines the -6 and STD tables into one device as a 32-entry table
// Synertek SY2661-1 (from http://bitsavers.informatik.uni-stuttgart.de/pdf/synertek/_dataBooks/Synertek_1981-1982_Data_Catalog.pdf page 3-40 (pdf page 139))
// baud rates are 50, 75, 110, 134.5, 150, 200, 300, 600, 1050, 1200, 1800, 2000, 2400, 4800, 9600, 19200
-const int com8116_device::divisors_16X_4_9152MHz_SY2661_1[] =
+const int com8116_device::divisors_16X_4_9152MHz_SY2661_1[16] =
{ 6144, 4096, 2793, 2284, 2048, 1536, 1024, 512, 292, 256, 171, 154, 128, 64, 32, 16 };
// Synertek SY2661-2 (from http://bitsavers.informatik.uni-stuttgart.de/pdf/synertek/_dataBooks/Synertek_1981-1982_Data_Catalog.pdf page 3-40 (pdf page 139))
// baud rates are 45.5, 50, 75, 110, 134.5, 150, 300, 600, 1200, 1800, 2000, 2400, 4800, 9600, 19200, 38400
-const int com8116_device::divisors_16X_4_9152MHz_SY2661_2[] =
+const int com8116_device::divisors_16X_4_9152MHz_SY2661_2[16] =
{ 6752, 6144, 4096, 2793, 2284, 2048, 1024, 512, 256, 171, 154, 128, 64, 32, 16, 8 };
//**************************************************************************
@@ -86,11 +91,32 @@ const int com8116_device::divisors_16X_4_9152MHz_SY2661_2[] =
// com8116_device - constructor
//-------------------------------------------------
-com8116_device::com8116_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- device_t(mconfig, COM8116, tag, owner, clock),
+com8116_device::com8116_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, const int *divisors) :
+ device_t(mconfig, type, tag, owner, clock),
m_fx4_handler(*this),
m_fr_handler(*this),
- m_ft_handler(*this)
+ m_ft_handler(*this),
+ m_divisors(divisors)
+{
+}
+
+com8116_device::com8116_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
+ com8116_device(mconfig, COM8116, tag, owner, clock, divisors_16X_5_0688MHz)
+{
+}
+
+com8116_003_device::com8116_003_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
+ com8116_device(mconfig, COM8116_003, tag, owner, clock, divisors_16X_6_01835MHz)
+{
+}
+
+com5016_5_device::com5016_5_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
+ com8116_device(mconfig, COM5016_5, tag, owner, clock, divisors_16X_4_9152MHz)
+{
+}
+
+com5016_013_device::com5016_013_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
+ com8116_device(mconfig, COM5016_013, tag, owner, clock, divisors_16X_2_7648MHz)
{
}
@@ -112,8 +138,8 @@ void com8116_device::device_start()
m_fr_timer = timer_alloc(TIMER_FR);
m_ft_timer = timer_alloc(TIMER_FT);
- m_fr_divisors = divisors_16X_5_0688MHz;
- m_ft_divisors = divisors_16X_5_0688MHz;
+ for (int i = 0; i < 16; i++)
+ LOGMASKED(LOG_TABLE, "Output Frequency %01X: 16X %f Hz\n", i, double(clock()) / m_divisors[i] / 16.0);
// register for state saving
save_item(NAME(m_fx4));
@@ -167,9 +193,9 @@ void com8116_device::device_timer(emu_timer &timer, device_timer_id id, int para
void com8116_device::str_w(uint8_t data)
{
int fr_divider = data & 0x0f;
- int fr_clock = clock() / m_fr_divisors[fr_divider];
+ int fr_clock = clock() / m_divisors[fr_divider];
- LOG("COM8116 Receiver Divisor Select %01x: %u (%u Hz)\n", data & 0x0f, m_fr_divisors[fr_divider], fr_clock);
+ LOGMASKED(LOG_SELECTED, "Receiver Divisor Select %01X: %u (%u Hz)\n", data & 0x0f, m_divisors[fr_divider], fr_clock);
m_fr_timer->adjust(attotime::from_nsec(3500), 0, attotime::from_hz(fr_clock * 2));
}
@@ -187,9 +213,9 @@ WRITE8_MEMBER( com8116_device::str_w )
void com8116_device::stt_w(uint8_t data)
{
int ft_divider = data & 0x0f;
- int ft_clock = clock() / m_ft_divisors[ft_divider];
+ int ft_clock = clock() / m_divisors[ft_divider];
- LOG("COM8116 Transmitter Divisor Select %01x: %u (%u Hz)\n", data & 0x0f, m_ft_divisors[ft_divider], ft_clock);
+ LOGMASKED(LOG_SELECTED, "Transmitter Divisor Select %01X: %u (%u Hz)\n", data & 0x0f, m_divisors[ft_divider], ft_clock);
m_ft_timer->adjust(attotime::from_nsec(3500), 0, attotime::from_hz(ft_clock * 2));
}
diff --git a/src/devices/machine/com8116.h b/src/devices/machine/com8116.h
index 7d06cc3426d..b36200d53b4 100644
--- a/src/devices/machine/com8116.h
+++ b/src/devices/machine/com8116.h
@@ -65,15 +65,17 @@ public:
DECLARE_WRITE8_MEMBER( stt_w );
protected:
- static const int divisors_16X_5_0688MHz[];
- static const int divisors_16X_6_01835MHz[];
- static const int divisors_16X_4_9152MHz[];
- static const int divisors_32X_5_0688MHz[];
- static const int divisors_16X_2_7648MHz[];
- static const int divisors_16X_5_0688MHz_030[];
- static const int divisors_16X_4_6080MHz[];
- static const int divisors_16X_4_9152MHz_SY2661_1[];
- static const int divisors_16X_4_9152MHz_SY2661_2[];
+ com8116_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, const int *divisors);
+
+ static const int divisors_16X_5_0688MHz[16];
+ static const int divisors_16X_6_01835MHz[16];
+ static const int divisors_16X_4_9152MHz[16];
+ static const int divisors_32X_5_0688MHz[16];
+ static const int divisors_16X_2_7648MHz[16];
+ static const int divisors_16X_5_0688MHz_030[16];
+ static const int divisors_16X_4_6080MHz[16];
+ static const int divisors_16X_4_9152MHz_SY2661_1[16];
+ static const int divisors_16X_4_9152MHz_SY2661_2[16];
// device-level overrides
virtual void device_start() override;
@@ -96,8 +98,7 @@ private:
int m_fr;
int m_ft;
- const int *m_fr_divisors;
- const int *m_ft_divisors;
+ const int *const m_divisors;
// timers
emu_timer *m_fx4_timer;
@@ -106,7 +107,40 @@ private:
};
+// ======================> com8116_003_device
+
+class com8116_003_device : public com8116_device
+{
+public:
+ // construction/destruction
+ com8116_003_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+};
+
+
+// ======================> com5016_5_device
+
+class com5016_5_device : public com8116_device
+{
+public:
+ // construction/destruction
+ com5016_5_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+};
+
+
+// ======================> com5016_013_device
+
+class com5016_013_device : public com8116_device
+{
+public:
+ // construction/destruction
+ com5016_013_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+};
+
+
// device type definition
DECLARE_DEVICE_TYPE(COM8116, com8116_device)
+DECLARE_DEVICE_TYPE(COM8116_003, com8116_003_device)
+DECLARE_DEVICE_TYPE(COM5016_5, com5016_5_device)
+DECLARE_DEVICE_TYPE(COM5016_013, com5016_013_device)
#endif // MAME_MACHINE_COM8116_H
diff --git a/src/mame/drivers/ampex.cpp b/src/mame/drivers/ampex.cpp
index f6c31165582..13b5d8951f6 100644
--- a/src/mame/drivers/ampex.cpp
+++ b/src/mame/drivers/ampex.cpp
@@ -19,7 +19,7 @@ the PCB, which go so far as to include the standard 8224 clock generator.
#include "emu.h"
#include "cpu/z80/z80.h"
#include "machine/ay31015.h"
-//#include "machine/com8116.h"
+#include "machine/com8116.h"
#include "video/tms9927.h"
#include "screen.h"
@@ -32,6 +32,7 @@ public:
: driver_device(mconfig, type, tag)
, m_maincpu(*this, "maincpu")
, m_uart(*this, "uart")
+ , m_dbrg(*this, "dbrg")
, m_p_chargen(*this, "chargen")
{ }
@@ -65,6 +66,7 @@ private:
required_device<cpu_device> m_maincpu;
required_device<ay31015_device> m_uart;
+ required_device<com8116_device> m_dbrg;
required_region_ptr<u8> m_p_chargen;
};
@@ -88,7 +90,6 @@ WRITE8_MEMBER(ampex_state::write_5840)
READ8_MEMBER(ampex_state::read_5841)
{
- logerror("%s: Read from 5841\n", machine().describe_context());
u8 result = m_uart->get_output_pin(AY31015_DAV) << 3;
result |= m_uart->get_output_pin(AY31015_OR) << 4;
result |= m_uart->get_output_pin(AY31015_PE) << 5;
@@ -212,6 +213,8 @@ MACHINE_CONFIG_START(ampex_state::ampex)
MCFG_DEVICE_ADD("uart", AY31015, 0) // COM8017, actually
MCFG_AY31015_STATUS_CHANGED_CB(WRITE8(ampex_state, uart_status_update))
+
+ MCFG_DEVICE_ADD("dbrg", COM5016_5, XTAL(4'915'200))
MACHINE_CONFIG_END
ROM_START( dialog80 )
diff --git a/src/mame/drivers/vt100.cpp b/src/mame/drivers/vt100.cpp
index d51e4cc0724..7b7cba9885f 100644
--- a/src/mame/drivers/vt100.cpp
+++ b/src/mame/drivers/vt100.cpp
@@ -34,7 +34,6 @@
#define RS232_TAG "rs232"
-#define COM5016T_TAG "com5016t"
class vt100_state : public driver_device
{
@@ -44,8 +43,7 @@ public:
m_maincpu(*this, "maincpu"),
m_crtc(*this, "vt100_video"),
m_keyboard(*this, "keyboard"),
- m_uart(*this, "i8251"),
- m_dbrg(*this, COM5016T_TAG),
+ m_dbrg(*this, "dbrg"),
m_nvr(*this, "nvr"),
m_p_ram(*this, "p_ram")
{
@@ -54,7 +52,6 @@ public:
required_device<cpu_device> m_maincpu;
required_device<vt100_video_device> m_crtc;
required_device<vt100_keyboard_device> m_keyboard;
- required_device<i8251_device> m_uart;
required_device<com8116_device> m_dbrg;
required_device<er1400_device> m_nvr;
DECLARE_READ8_MEMBER(vt100_flags_r);
@@ -160,8 +157,8 @@ static ADDRESS_MAP_START(vt100_io, AS_IO, 8, vt100_state)
ADDRESS_MAP_UNMAP_HIGH
ADDRESS_MAP_GLOBAL_MASK(0xff)
// 0x00, 0x01 PUSART (Intel 8251)
- AM_RANGE (0x00, 0x00) AM_DEVREADWRITE("i8251", i8251_device, data_r, data_w)
- AM_RANGE (0x01, 0x01) AM_DEVREADWRITE("i8251", i8251_device, status_r, control_w)
+ AM_RANGE (0x00, 0x00) AM_DEVREADWRITE("pusart", i8251_device, data_r, data_w)
+ AM_RANGE (0x01, 0x01) AM_DEVREADWRITE("pusart", i8251_device, status_r, control_w)
// 0x02 Baud rate generator
AM_RANGE (0x02, 0x02) AM_WRITE(vt100_baud_rate_w)
// 0x22 Modem buffer
@@ -259,7 +256,7 @@ GFXDECODE_END
MACHINE_CONFIG_START(vt100_state::vt100)
/* basic machine hardware */
- MCFG_CPU_ADD("maincpu",I8080, XTAL(24'883'200) / 9)
+ MCFG_CPU_ADD("maincpu", I8080, XTAL(24'883'200) / 9)
MCFG_CPU_PROGRAM_MAP(vt100_mem)
MCFG_CPU_IO_MAP(vt100_io)
MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(vt100_state,vt100_irq_callback)
@@ -283,18 +280,18 @@ MACHINE_CONFIG_START(vt100_state::vt100)
MCFG_VT_VIDEO_VERT_FREQ_INTR_CALLBACK(WRITELINE(vt100_state, vert_freq_intr_w))
MCFG_VT_VIDEO_LBA7_CALLBACK(DEVWRITELINE("nvr", er1400_device, clock_w))
- MCFG_DEVICE_ADD("i8251", I8251, 0) // 2.7648Mhz phi-clock (not used for tx clock or rx clock?)
+ MCFG_DEVICE_ADD("pusart", I8251, XTAL(24'883'200) / 9)
MCFG_I8251_TXD_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_txd))
MCFG_I8251_DTR_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_dtr))
MCFG_I8251_RTS_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_rts))
MCFG_RS232_PORT_ADD(RS232_TAG, default_rs232_devices, nullptr)
- MCFG_RS232_RXD_HANDLER(DEVWRITELINE("i8251", i8251_device, write_rxd))
- MCFG_RS232_DSR_HANDLER(DEVWRITELINE("i8251", i8251_device, write_dsr))
+ MCFG_RS232_RXD_HANDLER(DEVWRITELINE("pusart", i8251_device, write_rxd))
+ MCFG_RS232_DSR_HANDLER(DEVWRITELINE("pusart", i8251_device, write_dsr))
- MCFG_DEVICE_ADD(COM5016T_TAG, COM8116, 5068800/*XTAL(24'883'200) / 9*/) // COM5016T-013, 2.7648Mhz Clock, currently hacked wrongly
- MCFG_COM8116_FR_HANDLER(DEVWRITELINE("i8251", i8251_device, write_rxc))
- MCFG_COM8116_FT_HANDLER(DEVWRITELINE("i8251", i8251_device, write_txc))
+ MCFG_DEVICE_ADD("dbrg", COM5016_013, XTAL(24'883'200) / 9) // COM5016T-013, 2.7648Mhz Clock
+ MCFG_COM8116_FR_HANDLER(DEVWRITELINE("pusart", i8251_device, write_rxc))
+ MCFG_COM8116_FT_HANDLER(DEVWRITELINE("pusart", i8251_device, write_txc))
MCFG_DEVICE_ADD("nvr", ER1400, 0)
@@ -313,6 +310,13 @@ MACHINE_CONFIG_DERIVED(vt100_state::vt102, vt100)
MCFG_CPU_PROGRAM_MAP(vt100_mem)
MCFG_CPU_IO_MAP(vt100_io)
MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(vt100_state,vt100_irq_callback)
+
+ MCFG_DEVICE_MODIFY("pusart")
+ MCFG_DEVICE_CLOCK(XTAL(24'073'400) / 8)
+
+ MCFG_DEVICE_REPLACE("dbrg", COM8116_003, XTAL(24'073'400) / 4)
+ MCFG_COM8116_FR_HANDLER(DEVWRITELINE("pusart", i8251_device, write_rxc))
+ MCFG_COM8116_FT_HANDLER(DEVWRITELINE("pusart", i8251_device, write_txc))
MACHINE_CONFIG_END
/* VT1xx models: