summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author AJR <ajrhacker@users.noreply.github.com>2016-11-07 08:43:48 -0500
committer AJR <ajrhacker@users.noreply.github.com>2016-11-07 08:43:48 -0500
commitdc2ac35239dffeaf97f6c71c11a6e9964f08ec47 (patch)
treea55499d584a6f4ca857566e0ad81442edf2f20bb
parent124495739737547d4dd00e41b85efb8b1c4fa57f (diff)
amusco: Identify and hook up 8155 interface chips for LPT & RTC
i8155: Remove unnecessary tag() parameter from logerror calls (nw)
-rw-r--r--src/devices/machine/i8155.cpp42
-rw-r--r--src/mame/drivers/amusco.cpp95
2 files changed, 61 insertions, 76 deletions
diff --git a/src/devices/machine/i8155.cpp b/src/devices/machine/i8155.cpp
index 7e0d80aaf03..74989e51f81 100644
--- a/src/devices/machine/i8155.cpp
+++ b/src/devices/machine/i8155.cpp
@@ -117,7 +117,7 @@ inline void i8155_device::timer_output()
{
m_out_to_cb(m_to);
- if (LOG) logerror("8155 '%s' Timer Output: %u\n", tag(), m_to);
+ if (LOG) logerror("8155 Timer Output: %u\n", m_to);
}
inline void i8155_device::pulse_timer_output()
@@ -170,7 +170,7 @@ inline uint8_t i8155_device::read_port(int port)
default:
// strobed mode not implemented yet
- logerror("8155 '%s' Unsupported Port C mode!\n", tag());
+ logerror("8155 Unsupported Port C mode!\n");
break;
}
@@ -292,7 +292,7 @@ void i8155_device::device_timer(emu_timer &timer, device_timer_id id, int param,
if (m_counter == 0)
{
- if (LOG) logerror("8155 '%s' Timer Count Reached\n", tag());
+ if (LOG) logerror("8155 Timer Count Reached\n");
switch (m_command & COMMAND_TM_MASK)
{
@@ -300,7 +300,7 @@ void i8155_device::device_timer(emu_timer &timer, device_timer_id id, int param,
// stop timer
m_timer->enable(0);
- if (LOG) logerror("8155 '%s' Timer Stopped\n", tag());
+ if (LOG) logerror("8155 Timer Stopped\n");
break;
}
@@ -399,28 +399,28 @@ void i8155_device::register_w(int offset, uint8_t data)
case REGISTER_COMMAND:
m_command = data;
- if (LOG) logerror("8155 '%s' Port A Mode: %s\n", tag(), (data & COMMAND_PA) ? "output" : "input");
- if (LOG) logerror("8155 '%s' Port B Mode: %s\n", tag(), (data & COMMAND_PB) ? "output" : "input");
+ if (LOG) logerror("8155 Port A Mode: %s\n", (data & COMMAND_PA) ? "output" : "input");
+ if (LOG) logerror("8155 Port B Mode: %s\n", (data & COMMAND_PB) ? "output" : "input");
- if (LOG) logerror("8155 '%s' Port A Interrupt: %s\n", tag(), (data & COMMAND_IEA) ? "enabled" : "disabled");
- if (LOG) logerror("8155 '%s' Port B Interrupt: %s\n", tag(), (data & COMMAND_IEB) ? "enabled" : "disabled");
+ if (LOG) logerror("8155 Port A Interrupt: %s\n", (data & COMMAND_IEA) ? "enabled" : "disabled");
+ if (LOG) logerror("8155 Port B Interrupt: %s\n", (data & COMMAND_IEB) ? "enabled" : "disabled");
switch (data & COMMAND_PC_MASK)
{
case COMMAND_PC_ALT_1:
- if (LOG) logerror("8155 '%s' Port C Mode: Alt 1\n", tag());
+ if (LOG) logerror("8155 Port C Mode: Alt 1\n");
break;
case COMMAND_PC_ALT_2:
- if (LOG) logerror("8155 '%s' Port C Mode: Alt 2\n", tag());
+ if (LOG) logerror("8155 Port C Mode: Alt 2\n");
break;
case COMMAND_PC_ALT_3:
- if (LOG) logerror("8155 '%s' Port C Mode: Alt 3\n", tag());
+ if (LOG) logerror("8155 Port C Mode: Alt 3\n");
break;
case COMMAND_PC_ALT_4:
- if (LOG) logerror("8155 '%s' Port C Mode: Alt 4\n", tag());
+ if (LOG) logerror("8155 Port C Mode: Alt 4\n");
break;
}
@@ -432,7 +432,7 @@ void i8155_device::register_w(int offset, uint8_t data)
case COMMAND_TM_STOP:
// NOP if timer has not started, stop counting if the timer is running
- if (LOG) logerror("8155 '%s' Timer Command: Stop\n", tag());
+ if (LOG) logerror("8155 Timer Command: Stop\n");
m_to = 1;
timer_output();
m_timer->enable(0);
@@ -440,11 +440,11 @@ void i8155_device::register_w(int offset, uint8_t data)
case COMMAND_TM_STOP_AFTER_TC:
// stop immediately after present TC is reached (NOP if timer has not started)
- if (LOG) logerror("8155 '%s' Timer Command: Stop after TC\n", tag());
+ if (LOG) logerror("8155 Timer Command: Stop after TC\n");
break;
case COMMAND_TM_START:
- if (LOG) logerror("8155 '%s' Timer Command: Start\n", tag());
+ if (LOG) logerror("8155 Timer Command: Start\n");
if (m_timer->enabled())
{
@@ -474,33 +474,33 @@ void i8155_device::register_w(int offset, uint8_t data)
case REGISTER_TIMER_LOW:
m_count_length = (m_count_length & 0xff00) | data;
- if (LOG) logerror("8155 '%s' Count Length Low: %04x\n", tag(), m_count_length);
+ if (LOG) logerror("8155 Count Length Low: %04x\n", m_count_length);
break;
case REGISTER_TIMER_HIGH:
m_count_length = (data << 8) | (m_count_length & 0xff);
- if (LOG) logerror("8155 '%s' Count Length High: %04x\n", tag(), m_count_length);
+ if (LOG) logerror("8155 Count Length High: %04x\n", m_count_length);
switch (data & TIMER_MODE_MASK)
{
case TIMER_MODE_LOW:
// puts out LOW during second half of count
- if (LOG) logerror("8155 '%s' Timer Mode: LOW\n", tag());
+ if (LOG) logerror("8155 Timer Mode: LOW\n");
break;
case TIMER_MODE_SQUARE_WAVE:
// square wave, i.e. the period of the square wave equals the count length programmed with automatic reload at terminal count
- if (LOG) logerror("8155 '%s' Timer Mode: Square wave\n", tag());
+ if (LOG) logerror("8155 Timer Mode: Square wave\n");
break;
case TIMER_MODE_SINGLE_PULSE:
// single pulse upon TC being reached
- if (LOG) logerror("8155 '%s' Timer Mode: Single pulse\n", tag());
+ if (LOG) logerror("8155 Timer Mode: Single pulse\n");
break;
case TIMER_MODE_AUTOMATIC_RELOAD:
// automatic reload, i.e. single pulse every time TC is reached
- if (LOG) logerror("8155 '%s' Timer Mode: Automatic reload\n", tag());
+ if (LOG) logerror("8155 Timer Mode: Automatic reload\n");
break;
}
break;
diff --git a/src/mame/drivers/amusco.cpp b/src/mame/drivers/amusco.cpp
index 081b80008f8..88e9fd1ffd7 100644
--- a/src/mame/drivers/amusco.cpp
+++ b/src/mame/drivers/amusco.cpp
@@ -42,8 +42,8 @@
The program code reads from and writes to what must be a line printer and a RTC
(probably a MSM5832), though neither is present on the main board. The I/O write
patterns also suggest that each or both of these devices are accessed through an
- unknown interface chip or gate array (not i8255-compatible). The printer appears to
- use non-Epson control codes: ETB, DLE, DC4, DC2, SO, EM, DC1 and STX.
+ Intel 8155 or compatible interface chip. The printer appears to use non-Epson
+ control codes: ETB, DLE, DC4, DC2, SO, EM, DC1 and STX.
*****************************************************************************************
@@ -81,6 +81,7 @@
#include "emu.h"
#include "cpu/i86/i86.h"
#include "video/mc6845.h"
+#include "machine/i8155.h"
#include "machine/i8255.h"
#include "sound/sn76496.h"
#include "machine/pic8259.h"
@@ -116,10 +117,10 @@ public:
DECLARE_WRITE8_MEMBER(output_b_w);
DECLARE_WRITE8_MEMBER(output_c_w);
DECLARE_WRITE8_MEMBER(vram_w);
- DECLARE_READ8_MEMBER(lpt_r);
- DECLARE_WRITE8_MEMBER(lpt_w);
- DECLARE_READ8_MEMBER(rtc_r);
- DECLARE_WRITE8_MEMBER(rtc_w);
+ DECLARE_READ8_MEMBER(lpt_status_r);
+ DECLARE_WRITE8_MEMBER(lpt_data_w);
+ DECLARE_WRITE8_MEMBER(rtc_control_w);
+ DECLARE_WRITE8_MEMBER(rtc_data_w);
MC6845_ON_UPDATE_ADDR_CHANGED(crtc_addr);
MC6845_UPDATE_ROW(update_row);
@@ -255,63 +256,37 @@ WRITE8_MEMBER(amusco_state::vram_w)
// printf("%04x %04x\n",m_video_update_address,data);
}
-READ8_MEMBER(amusco_state::lpt_r)
+READ8_MEMBER(amusco_state::lpt_status_r)
{
- switch (offset)
- {
- case 2:
- // Bit 0 = busy
- // Bit 1 = paper jam (inverted)
- // Bit 3 = out of paper
- // Bit 4 = low paper
- return 2;
-
- default:
- logerror("Reading from printer port 28%dh\n", offset);
- return 0;
- }
+ // Bit 0 = busy
+ // Bit 1 = paper jam (active low)
+ // Bit 3 = out of paper
+ // Bit 4 = low paper
+ return 2;
}
-WRITE8_MEMBER(amusco_state::lpt_w)
+WRITE8_MEMBER(amusco_state::lpt_data_w)
{
- logerror("Writing %02Xh to printer port 28%dh\n", data, offset);
+ logerror("Writing %02Xh to printer\n", data);
}
-READ8_MEMBER(amusco_state::rtc_r)
+WRITE8_MEMBER(amusco_state::rtc_control_w)
{
- switch (offset)
- {
- case 3:
- return m_rtc->data_r(space, 0);
-
- default:
- logerror("Reading from RTC port 38%dh\n", offset);
- return 0;
- }
+ m_rtc->address_w(data & 0x0f);
+ m_rtc->cs_w(BIT(data, 6));
+ m_rtc->hold_w(BIT(data, 6));
+ m_rtc->write_w(BIT(data, 5));
+ m_rtc->read_w(BIT(data, 4));
+
+ // TO DO: MSM5832 WR emulation is inaccurate
+ if (BIT(data, 5))
+ m_rtc->data_w(space, 0, m_rtc_data);
}
-WRITE8_MEMBER(amusco_state::rtc_w)
+WRITE8_MEMBER(amusco_state::rtc_data_w)
{
- switch (offset)
- {
- case 1:
- m_rtc->address_w(data & 0x0f);
- m_rtc->cs_w(BIT(data, 6));
- m_rtc->hold_w(BIT(data, 6));
- m_rtc->write_w(BIT(data, 5));
- if (BIT(data, 5))
- m_rtc->data_w(space, 0, m_rtc_data);
- m_rtc->read_w(BIT(data, 4));
- break;
-
- case 3:
- m_rtc_data = data;
- break;
-
- default:
- logerror("Writing %02Xh to RTC port 38%dh\n", data, offset);
- break;
- }
+ // TO DO: MSM5832 should be able to latch this value itself
+ m_rtc_data = data;
}
static ADDRESS_MAP_START( amusco_io_map, AS_IO, 8, amusco_state )
@@ -322,8 +297,8 @@ static ADDRESS_MAP_START( amusco_io_map, AS_IO, 8, amusco_state )
AM_RANGE(0x0040, 0x0043) AM_DEVREADWRITE("ppi_inputs", i8255_device, read, write)
AM_RANGE(0x0060, 0x0060) AM_DEVWRITE("sn", sn76489a_device, write)
AM_RANGE(0x0070, 0x0071) AM_WRITE(vram_w)
- AM_RANGE(0x0280, 0x0283) AM_READWRITE(lpt_r, lpt_w)
- AM_RANGE(0x0380, 0x0383) AM_READWRITE(rtc_r, rtc_w)
+ AM_RANGE(0x0280, 0x0283) AM_DEVREADWRITE("lpt_interface", i8155_device, io_r, io_w)
+ AM_RANGE(0x0380, 0x0383) AM_DEVREADWRITE("rtc_interface", i8155_device, io_r, io_w)
ADDRESS_MAP_END
/* I/O byte R/W
@@ -441,8 +416,18 @@ static MACHINE_CONFIG_START( amusco, amusco_state )
MCFG_I8255_IN_PORTB_CB(IOPORT("IN1"))
MCFG_I8255_IN_PORTC_CB(IOPORT("IN2"))
+ MCFG_DEVICE_ADD("lpt_interface", I8155, 0)
+ MCFG_I8155_OUT_PORTA_CB(WRITE8(amusco_state, lpt_data_w))
+ MCFG_I8155_IN_PORTB_CB(READ8(amusco_state, lpt_status_r))
+ // Port C uses ALT 3 mode, which MAME does not currently emulate
+
MCFG_MSM5832_ADD("rtc", XTAL_32_768kHz)
+ MCFG_DEVICE_ADD("rtc_interface", I8155, 0)
+ MCFG_I8155_OUT_PORTA_CB(WRITE8(amusco_state, rtc_control_w))
+ MCFG_I8155_IN_PORTC_CB(DEVREAD8("rtc", msm5832_device, data_r))
+ MCFG_I8155_OUT_PORTC_CB(WRITE8(amusco_state, rtc_data_w))
+
/* video hardware */
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_REFRESH_RATE(60)