summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/machine/com8116.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/machine/com8116.cpp')
-rw-r--r--src/devices/machine/com8116.cpp74
1 files changed, 33 insertions, 41 deletions
diff --git a/src/devices/machine/com8116.cpp b/src/devices/machine/com8116.cpp
index 7847c496b61..ca268f0ed81 100644
--- a/src/devices/machine/com8116.cpp
+++ b/src/devices/machine/com8116.cpp
@@ -9,8 +9,8 @@
#include "emu.h"
#include "com8116.h"
-#define LOG_SELECTED (1 << 0)
-#define LOG_TABLE (1 << 1)
+#define LOG_SELECTED (1U << 1)
+#define LOG_TABLE (1U << 2)
//#define VERBOSE (LOG_TABLE)
#include "logmacro.h"
@@ -45,7 +45,7 @@ const int com8116_device::divisors_16X_5_0688MHz[16] =
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/COM5016(T)-5 and WD WD-1943-05; Synertek SY2661-1 and 2 are NOT the same as this despite using same clock speed
// 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
@@ -80,16 +80,6 @@ const int com8116_device::divisors_16X_4_6080MHz[16] =
// 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[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[16] =
- { 6752, 6144, 4096, 2793, 2284, 2048, 1024, 512, 256, 171, 154, 128, 64, 32, 16, 8 };
-
//**************************************************************************
// LIVE DEVICE
//**************************************************************************
@@ -144,19 +134,14 @@ k1135ab_device::k1135ab_device(const machine_config &mconfig, const char *tag, d
void com8116_device::device_start()
{
- // resolve callbacks
- m_fx4_handler.resolve();
- m_fr_handler.resolve_safe();
- m_ft_handler.resolve_safe();
-
// allocate timers
- if (!m_fx4_handler.isnull())
+ if (!m_fx4_handler.isunset())
{
- m_fx4_timer = timer_alloc(TIMER_FX4);
+ m_fx4_timer = timer_alloc(FUNC(com8116_device::fx4_tick), this);
m_fx4_timer->adjust(attotime::from_hz((clock() / 4) * 2), 0, attotime::from_hz((clock() / 4)) * 2);
}
- m_fr_timer = timer_alloc(TIMER_FR);
- m_ft_timer = timer_alloc(TIMER_FT);
+ m_fr_timer = timer_alloc(FUNC(com8116_device::fr_tick), this);
+ m_ft_timer = timer_alloc(FUNC(com8116_device::ft_tick), this);
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);
@@ -181,28 +166,35 @@ void com8116_device::device_reset()
//-------------------------------------------------
-// device_timer - handler timer events
+// fx4_tick - toggle the FX4 timer output
//-------------------------------------------------
-void com8116_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
+TIMER_CALLBACK_MEMBER(com8116_device::fx4_tick)
{
- switch (id)
- {
- case TIMER_FX4:
- m_fx4 = !m_fx4;
- m_fx4_handler(m_fx4);
- break;
-
- case TIMER_FR:
- m_fr = !m_fr;
- m_fr_handler(m_fr);
- break;
-
- case TIMER_FT:
- m_ft = !m_ft;
- m_ft_handler(m_ft);
- break;
- }
+ m_fx4 = !m_fx4;
+ m_fx4_handler(m_fx4);
+}
+
+
+//-------------------------------------------------
+// fr_tick - toggle the FR timer output
+//-------------------------------------------------
+
+TIMER_CALLBACK_MEMBER(com8116_device::fr_tick)
+{
+ m_fr = !m_fr;
+ m_fr_handler(m_fr);
+}
+
+
+//-------------------------------------------------
+// ft_tick - toggle the FT timer output
+//-------------------------------------------------
+
+TIMER_CALLBACK_MEMBER(com8116_device::ft_tick)
+{
+ m_ft = !m_ft;
+ m_ft_handler(m_ft);
}