summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Curt Coder <curtcoder@mail.com>2014-01-15 17:10:28 +0000
committer Curt Coder <curtcoder@mail.com>2014-01-15 17:10:28 +0000
commit1310c56964ab76d4412e732106b5c7f52d8d5213 (patch)
tree0b70ab5df8a920752ae7ed5dd2ae3b6f0b0b3b43
parent5dff500e5b065c10c24192b820bb6f1bbba8e2d7 (diff)
(MESS) compclr2: Emulated the keyboard and floppy WIP. (nw)
(MESS) dai: Updated to use new TMS5501. (nw) tms5501: Rewrote the emulation to use devcb2 and diserial. [Curt Coder] flopimg: Added preliminary support for the 8-N-1 serial encoding scheme used on Compucolor II floppies. [Curt Coder]
-rw-r--r--.gitattributes8
-rw-r--r--src/emu/machine/machine.mak9
-rw-r--r--src/emu/machine/tms5501.c546
-rw-r--r--src/emu/machine/tms5501.h200
-rw-r--r--src/lib/formats/ccvf_dsk.c181
-rw-r--r--src/lib/formats/ccvf_dsk.h59
-rw-r--r--src/lib/formats/flopimg.c42
-rw-r--r--src/lib/formats/flopimg.h10
-rw-r--r--src/lib/lib.mak1
-rw-r--r--src/mess/drivers/compucolor.c369
-rw-r--r--src/mess/drivers/dai.c7
-rw-r--r--src/mess/includes/dai.h10
-rw-r--r--src/mess/machine/compclr_flp.c255
-rw-r--r--src/mess/machine/compclr_flp.h130
-rw-r--r--src/mess/machine/dai.c29
-rw-r--r--src/mess/machine/tms5501.c463
-rw-r--r--src/mess/machine/tms5501.h101
-rw-r--r--src/mess/mess.mak3
18 files changed, 1634 insertions, 789 deletions
diff --git a/.gitattributes b/.gitattributes
index 376c593477d..8a31f6f7eda 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -2087,6 +2087,8 @@ src/emu/machine/timekpr.c svneol=native#text/plain
src/emu/machine/timekpr.h svneol=native#text/plain
src/emu/machine/tmp68301.c svneol=native#text/plain
src/emu/machine/tmp68301.h svneol=native#text/plain
+src/emu/machine/tms5501.c svneol=native#text/plain
+src/emu/machine/tms5501.h svneol=native#text/plain
src/emu/machine/tms6100.c svneol=native#text/plain
src/emu/machine/tms6100.h svneol=native#text/plain
src/emu/machine/tms9901.c svneol=native#text/plain
@@ -2722,6 +2724,8 @@ src/lib/formats/cbm_crt.c svneol=native#text/plain
src/lib/formats/cbm_crt.h svneol=native#text/plain
src/lib/formats/cbm_tap.c svneol=native#text/plain
src/lib/formats/cbm_tap.h svneol=native#text/plain
+src/lib/formats/ccvf_dsk.c svneol=native#text/plain
+src/lib/formats/ccvf_dsk.h svneol=native#text/plain
src/lib/formats/cgen_cas.c svneol=native#text/plain
src/lib/formats/cgen_cas.h svneol=native#text/plain
src/lib/formats/coco_cas.c svneol=native#text/plain
@@ -7849,6 +7853,8 @@ src/mess/machine/cococart.c svneol=native#text/plain
src/mess/machine/cococart.h svneol=native#text/plain
src/mess/machine/coleco.c svneol=native#text/plain
src/mess/machine/coleco.h svneol=native#text/plain
+src/mess/machine/compclr_flp.c svneol=native#text/plain
+src/mess/machine/compclr_flp.h svneol=native#text/plain
src/mess/machine/compiskb.c svneol=native#text/plain
src/mess/machine/compiskb.h svneol=native#text/plain
src/mess/machine/concept.c svneol=native#text/plain
@@ -8409,8 +8415,6 @@ src/mess/machine/ti99/tn_usbsm.c svneol=native#text/plain
src/mess/machine/ti99/tn_usbsm.h svneol=native#text/plain
src/mess/machine/ti99/videowrp.c svneol=native#text/plain
src/mess/machine/ti99/videowrp.h svneol=native#text/plain
-src/mess/machine/tms5501.c svneol=native#text/plain
-src/mess/machine/tms5501.h svneol=native#text/plain
src/mess/machine/trs80.c svneol=native#text/plain
src/mess/machine/trs80m2kb.c svneol=native#text/plain
src/mess/machine/trs80m2kb.h svneol=native#text/plain
diff --git a/src/emu/machine/machine.mak b/src/emu/machine/machine.mak
index f4d2a1b71f5..3a4458ee36b 100644
--- a/src/emu/machine/machine.mak
+++ b/src/emu/machine/machine.mak
@@ -1349,6 +1349,15 @@ endif
#-------------------------------------------------
#
+#@src/emu/machine/tms5501.h,MACHINES += TMS5501
+#-------------------------------------------------
+
+ifneq ($(filter TMS5501,$(MACHINES)),)
+MACHINEOBJS += $(MACHINEOBJ)/tms5501.o
+endif
+
+#-------------------------------------------------
+#
#@src/emu/machine/tms6100.h,MACHINES += TMS6100
#-------------------------------------------------
diff --git a/src/emu/machine/tms5501.c b/src/emu/machine/tms5501.c
new file mode 100644
index 00000000000..c38cc508647
--- /dev/null
+++ b/src/emu/machine/tms5501.c
@@ -0,0 +1,546 @@
+// license:BSD-3-Clause
+// copyright-holders:Curt Coder
+/**********************************************************************
+
+ TMS5501 Multifunction Input/Output Controller emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#include "tms5501.h"
+
+
+
+//**************************************************************************
+// MACROS / CONSTANTS
+//**************************************************************************
+
+#define LOG 0
+
+
+const UINT8 tms5501_device::rst_vector[] = { 0xc7, 0xcf, 0xd7, 0xdf, 0xe7, 0xef, 0xf7, 0xff };
+
+
+
+//**************************************************************************
+// DEVICE DEFINITIONS
+//**************************************************************************
+
+// device type definition
+const device_type TMS5501 = &device_creator<tms5501_device>;
+
+
+// I/O address map
+DEVICE_ADDRESS_MAP_START( io_map, 8, tms5501_device )
+ AM_RANGE(0x00, 0x00) AM_READ(rb_r)
+ AM_RANGE(0x01, 0x01) AM_READ(xi_r)
+ AM_RANGE(0x02, 0x02) AM_READ(rst_r)
+ AM_RANGE(0x03, 0x03) AM_READ(sta_r)
+ AM_RANGE(0x04, 0x04) AM_WRITE(cmd_w)
+ AM_RANGE(0x05, 0x05) AM_WRITE(rr_w)
+ AM_RANGE(0x06, 0x06) AM_WRITE(tb_w)
+ AM_RANGE(0x07, 0x07) AM_WRITE(xo_w)
+ AM_RANGE(0x08, 0x08) AM_WRITE(mr_w)
+ AM_RANGE(0x09, 0x0d) AM_WRITE(tmr_w)
+ADDRESS_MAP_END
+
+
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+//-------------------------------------------------
+// tms5501_device - constructor
+//-------------------------------------------------
+
+tms5501_device::tms5501_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
+ device_t(mconfig, TMS5501, "TMS5501", tag, owner, clock, "tms5501", __FILE__),
+ device_serial_interface(mconfig, *this),
+ m_write_irq(*this),
+ m_write_xmt(*this),
+ m_read_xi(*this),
+ m_write_xo(*this),
+ m_irq(IRQ_TB),
+ m_rb(0),
+ m_sta(STA_XBE | STA_SR),
+ m_cmd(0),
+ m_rr(0),
+ m_tb(0),
+ m_mr(0),
+ m_sens(0),
+ m_xi7(0)
+{
+}
+
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void tms5501_device::device_start()
+{
+ // resolve callbacks
+ m_write_irq.resolve_safe();
+ m_write_xmt.resolve_safe();
+ m_read_xi.resolve_safe(0);
+ m_write_xo.resolve_safe();
+
+ // create timers
+ m_timer[TIMER_1] = timer_alloc(TIMER_1);
+ m_timer[TIMER_2] = timer_alloc(TIMER_2);
+ m_timer[TIMER_3] = timer_alloc(TIMER_3);
+ m_timer[TIMER_4] = timer_alloc(TIMER_4);
+ m_timer[TIMER_5] = timer_alloc(TIMER_5);
+
+ // state saving
+ save_item(NAME(m_rb));
+ save_item(NAME(m_sta));
+ save_item(NAME(m_cmd));
+ save_item(NAME(m_rr));
+ save_item(NAME(m_tb));
+ save_item(NAME(m_mr));
+ save_item(NAME(m_sens));
+ save_item(NAME(m_xi7));
+}
+
+
+//-------------------------------------------------
+// device_reset - device-specific reset
+//-------------------------------------------------
+
+void tms5501_device::device_reset()
+{
+ receive_register_reset();
+ transmit_register_reset();
+
+ m_write_xmt(1);
+
+ check_interrupt();
+}
+
+
+//-------------------------------------------------
+// device_timer - handle timer events
+//-------------------------------------------------
+
+void tms5501_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
+{
+ switch (id)
+ {
+ case TIMER_1:
+ set_interrupt(IRQ_TMR1);
+ break;
+
+ case TIMER_2:
+ set_interrupt(IRQ_TMR2);
+ break;
+
+ case TIMER_3:
+ set_interrupt(IRQ_TMR3);
+ break;
+
+ case TIMER_4:
+ set_interrupt(IRQ_TMR4);
+ break;
+
+ case TIMER_5:
+ if (!(m_cmd & CMD_XI7))
+ {
+ set_interrupt(IRQ_TMR5);
+ }
+ break;
+
+ default:
+ device_serial_interface::device_timer(timer, id, param, ptr);
+ }
+}
+
+
+//-------------------------------------------------
+// tra_callback -
+//-------------------------------------------------
+
+void tms5501_device::tra_callback()
+{
+ if (m_write_xmt.isnull())
+ transmit_register_send_bit();
+ else
+ m_write_xmt(transmit_register_get_data_bit());
+}
+
+
+//-------------------------------------------------
+// tra_complete -
+//-------------------------------------------------
+
+void tms5501_device::tra_complete()
+{
+ if (!(m_sta & STA_XBE))
+ {
+ transmit_register_setup(m_tb);
+
+ m_sta |= STA_XBE;
+
+ set_interrupt(IRQ_TB);
+ }
+}
+
+
+//-------------------------------------------------
+// rcv_callback -
+//-------------------------------------------------
+
+void tms5501_device::rcv_callback()
+{
+ int bit = get_in_data_bit();
+
+ receive_register_update_bit(bit);
+
+ if (bit)
+ {
+ m_sta |= STA_SR;
+ }
+ else
+ {
+ m_sta &= ~STA_SR;
+ }
+
+ if (is_receive_register_synchronized())
+ {
+ m_sta |= STA_SBD;
+ }
+
+ if (is_receive_register_shifting())
+ {
+ m_sta |= STA_FBD;
+ }
+}
+
+
+//-------------------------------------------------
+// rcv_complete -
+//-------------------------------------------------
+
+void tms5501_device::rcv_complete()
+{
+ receive_register_extract();
+ m_rb = get_received_char();
+
+ if (m_sta & STA_RBL)
+ {
+ m_sta |= STA_OE;
+ }
+
+ m_sta |= STA_RBL;
+
+ set_interrupt(IRQ_RB);
+}
+
+
+//-------------------------------------------------
+// input_callback -
+//-------------------------------------------------
+
+void tms5501_device::input_callback(UINT8 state)
+{
+ m_input_state = state;
+}
+
+
+//-------------------------------------------------
+// rb_r - read receiver buffer
+//-------------------------------------------------
+
+READ8_MEMBER( tms5501_device::rb_r )
+{
+ m_sta &= ~STA_RBL;
+
+ return m_rb;
+}
+
+
+//-------------------------------------------------
+// xi_r - read external inputs
+//-------------------------------------------------
+
+READ8_MEMBER( tms5501_device::xi_r )
+{
+ UINT8 data = m_read_xi(0);
+
+ if (m_cmd & CMD_XI7)
+ {
+ data = (m_xi7 << 7) | (data & 0x7f);
+ }
+
+ return data;
+}
+
+
+//-------------------------------------------------
+// rst_r - read interrupt address
+//-------------------------------------------------
+
+READ8_MEMBER( tms5501_device::rst_r )
+{
+ return get_vector();
+}
+
+
+//-------------------------------------------------
+// sta_r - read TMS5510 status
+//-------------------------------------------------
+
+READ8_MEMBER( tms5501_device::sta_r )
+{
+ return m_sta;
+}
+
+
+//-------------------------------------------------
+// cmd_w - issue discrete commands
+//-------------------------------------------------
+
+WRITE8_MEMBER( tms5501_device::cmd_w )
+{
+ if (LOG) logerror("TMS5501 '%s' Command %02x\n", tag(), data);
+
+ m_cmd = data;
+
+ if (m_cmd & CMD_RST)
+ {
+ m_sta &= ~(STA_SBD | STA_FBD | STA_RBL | STA_OE);
+ m_sta |= (STA_XBE | STA_SR);
+
+ receive_register_reset();
+ transmit_register_reset();
+
+ m_write_xmt(1);
+
+ m_irq = 0;
+ set_interrupt(IRQ_TB);
+
+ m_timer[TIMER_1]->enable(false);
+ m_timer[TIMER_2]->enable(false);
+ m_timer[TIMER_3]->enable(false);
+ m_timer[TIMER_4]->enable(false);
+ m_timer[TIMER_5]->enable(false);
+ }
+ else if (m_cmd & CMD_BRK)
+ {
+ receive_register_reset();
+ transmit_register_reset();
+
+ m_write_xmt(0);
+ }
+}
+
+
+//-------------------------------------------------
+// rr_w - load rate register
+//-------------------------------------------------
+
+WRITE8_MEMBER( tms5501_device::rr_w )
+{
+ if (LOG) logerror("TMS5501 '%s' Rate Register %02x\n", tag(), data);
+
+ m_rr = data;
+
+ stop_bits_t stop_bits = (m_rr & RR_STOP) ? STOP_BITS_1 : STOP_BITS_2;
+
+ set_data_frame(1, 8, PARITY_NONE, stop_bits);
+
+ int rate = 0;
+
+ if (m_rr & RR_9600) rate = 9600;
+ else if (m_rr & RR_4800) rate = 4800;
+ else if (m_rr & RR_2400) rate = 2400;
+ else if (m_rr & RR_1200) rate = 1200;
+ else if (m_rr & RR_300) rate = 300;
+ else if (m_rr & RR_150) rate = 150;
+ else if (m_rr & RR_110) rate = 110;
+
+ if (m_cmd & CMD_TST1)
+ {
+ rate *= 8;
+ }
+
+ set_rcv_rate(rate);
+ set_tra_rate(rate);
+}
+
+
+//-------------------------------------------------
+// tb_w - load transmitter buffer
+//-------------------------------------------------
+
+WRITE8_MEMBER( tms5501_device::tb_w )
+{
+ if (LOG) logerror("TMS5501 '%s' Transmitter Buffer %02x\n", tag(), data);
+
+ m_tb = data;
+
+ if (is_transmit_register_empty())
+ {
+ transmit_register_setup(m_tb);
+
+ m_sta |= STA_XBE;
+
+ set_interrupt(IRQ_TB);
+ }
+ else
+ {
+ m_sta &= ~STA_XBE;
+ }
+}
+
+
+//-------------------------------------------------
+// xo_w - load output port
+//-------------------------------------------------
+
+WRITE8_MEMBER( tms5501_device::xo_w )
+{
+ if (LOG) logerror("TMS5501 '%s' Output %02x\n", tag(), data);
+
+ m_write_xo(data);
+}
+
+
+//-------------------------------------------------
+// mr_w - load mask register
+//-------------------------------------------------
+
+WRITE8_MEMBER( tms5501_device::mr_w )
+{
+ if (LOG) logerror("TMS5501 '%s' Mask Register %02x\n", tag(), data);
+
+ m_mr = data;
+}
+
+
+//-------------------------------------------------
+// tmr_w - load interval timer
+//-------------------------------------------------
+
+WRITE8_MEMBER( tms5501_device::tmr_w )
+{
+ if (LOG) logerror("TMS5501 '%s' Timer %u %02x\n", tag(), offset, data);
+
+ m_timer[offset]->adjust(attotime::from_double((double) data / (clock() / 128.0)));
+}
+
+
+//-------------------------------------------------
+// rcv_w - receive data write
+//-------------------------------------------------
+
+WRITE_LINE_MEMBER( tms5501_device::rcv_w )
+{
+ device_serial_interface::rx_w(state);
+}
+
+
+//-------------------------------------------------
+// xi7_w -
+//-------------------------------------------------
+
+WRITE_LINE_MEMBER( tms5501_device::xi7_w )
+{
+ if (m_cmd & CMD_XI7)
+ {
+ if (!m_xi7 && state)
+ {
+ set_interrupt(IRQ_XI7);
+ }
+ }
+
+ m_xi7 = state;
+}
+
+
+//-------------------------------------------------
+// sens_w -
+//-------------------------------------------------
+
+WRITE_LINE_MEMBER( tms5501_device::sens_w )
+{
+ if (!m_sens && state)
+ {
+ set_interrupt(IRQ_SENS);
+ }
+
+ m_sens = state;
+}
+
+
+//-------------------------------------------------
+// set_interrupt -
+//-------------------------------------------------
+
+void tms5501_device::set_interrupt(UINT8 mask)
+{
+ m_irq |= mask;
+
+ if (LOG) logerror("TMS5501 '%s' Interrupt %02x\n", tag(), mask);
+
+ check_interrupt();
+}
+
+
+//-------------------------------------------------
+// check_interrupt -
+//-------------------------------------------------
+
+void tms5501_device::check_interrupt()
+{
+ int state = (m_irq & m_mr) ? ASSERT_LINE : CLEAR_LINE;
+
+ if (state == ASSERT_LINE)
+ {
+ if (LOG) logerror("TMS5501 '%s' Interrupt Assert\n", tag());
+
+ m_sta |= STA_IP;
+ }
+ else
+ {
+ m_sta &= ~STA_IP;
+ }
+
+ if (m_cmd & CMD_IAE)
+ {
+ m_write_irq(state);
+ }
+ else
+ {
+ m_write_irq(CLEAR_LINE);
+ }
+}
+
+
+//-------------------------------------------------
+// get_vector -
+//-------------------------------------------------
+
+UINT8 tms5501_device::get_vector()
+{
+ UINT8 rst = 0;
+
+ for (int i = 0; i < 8; i++)
+ {
+ if (BIT((m_irq & m_mr), i))
+ {
+ rst = rst_vector[i];
+ m_irq &= ~(1 << i);
+
+ check_interrupt();
+
+ if (LOG) logerror("%s: TMS5501 '%s' Interrupt Acknowledge %02x\n", machine().describe_context(), tag(), rst);
+ break;
+ }
+ }
+
+ return rst;
+}
diff --git a/src/emu/machine/tms5501.h b/src/emu/machine/tms5501.h
new file mode 100644
index 00000000000..d4e76b806ae
--- /dev/null
+++ b/src/emu/machine/tms5501.h
@@ -0,0 +1,200 @@
+// license:BSD-3-Clause
+// copyright-holders:Curt Coder
+/**********************************************************************
+
+ TMS5501 Multifunction Input/Output Controller emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************
+ _____ _____
+ Vbb 1 |* \_/ | 40 XMT
+ Vcc 2 | | 39 XI0
+ Vdd 3 | | 38 XI1
+ VSS 4 | | 37 XI2
+ RCV 5 | | 36 XI3
+ D7 6 | | 35 XI4
+ D6 7 | | 34 XI5
+ D5 8 | | 33 XI6
+ D4 9 | | 32 XI7
+ D3 10 | | 31 _XO7
+ D2 11 | TMS5501 | 30 _XO6
+ D1 12 | | 29 _XO5
+ D0 13 | | 28 _XO4
+ A0 14 | | 27 _XO3
+ A1 15 | | 26 _XO2
+ A2 16 | | 25 _XO1
+ A3 17 | | 24 _XO0
+ CE 18 | | 23 INT
+ SYNC 19 | | 22 SENS
+ phi1 20 |_____________| 21 phi2
+
+**********************************************************************/
+
+#pragma once
+
+#ifndef __TMS5501__
+#define __TMS5501__
+
+#include "emu.h"
+
+
+
+//**************************************************************************
+// INTERFACE CONFIGURATION MACROS
+//**************************************************************************
+
+#define MCFG_TMS5501_IRQ_CALLBACK(_write) \
+ devcb = &tms5501_device::set_irq_wr_callback(*device, DEVCB2_##_write);
+
+#define MCFG_TMS5501_XMT_CALLBACK(_write) \
+ devcb = &tms5501_device::set_xmt_wr_callback(*device, DEVCB2_##_write);
+
+#define MCFG_TMS5501_XI_CALLBACK(_read) \
+ devcb = &tms5501_device::set_xi_rd_callback(*device, DEVCB2_##_read);
+
+#define MCFG_TMS5501_XO_CALLBACK(_write) \
+ devcb = &tms5501_device::set_xo_wr_callback(*device, DEVCB2_##_write);
+
+
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+// ======================> tms5501_device
+
+class tms5501_device : public device_t,
+ public device_serial_interface
+{
+public:
+ // construction/destruction
+ tms5501_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+ template<class _Object> static devcb2_base &set_irq_wr_callback(device_t &device, _Object object) { return downcast<tms5501_device &>(device).m_write_irq.set_callback(object); }
+ template<class _Object> static devcb2_base &set_xmt_wr_callback(device_t &device, _Object object) { return downcast<tms5501_device &>(device).m_write_xmt.set_callback(object); }
+ template<class _Object> static devcb2_base &set_xi_rd_callback(device_t &device, _Object object) { return downcast<tms5501_device &>(device).m_read_xi.set_callback(object); }
+ template<class _Object> static devcb2_base &set_xo_wr_callback(device_t &device, _Object object) { return downcast<tms5501_device &>(device).m_write_xo.set_callback(object); }
+
+ virtual DECLARE_ADDRESS_MAP(io_map, 8);
+
+ DECLARE_WRITE_LINE_MEMBER( rcv_w );
+
+ DECLARE_WRITE_LINE_MEMBER( sens_w );
+ DECLARE_WRITE_LINE_MEMBER( xi7_w );
+
+ UINT8 get_vector();
+
+protected:
+ // device-level overrides
+ virtual void device_start();
+ virtual void device_reset();
+ virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
+
+ // device_serial_interface overrides
+ virtual void tra_callback();
+ virtual void tra_complete();
+ virtual void rcv_callback();
+ virtual void rcv_complete();
+ virtual void input_callback(UINT8 state);
+
+ DECLARE_READ8_MEMBER( rb_r );
+ DECLARE_READ8_MEMBER( xi_r );
+ DECLARE_READ8_MEMBER( rst_r );
+ DECLARE_READ8_MEMBER( sta_r );
+ DECLARE_WRITE8_MEMBER( cmd_w );
+ DECLARE_WRITE8_MEMBER( rr_w );
+ DECLARE_WRITE8_MEMBER( tb_w );
+ DECLARE_WRITE8_MEMBER( xo_w );
+ DECLARE_WRITE8_MEMBER( mr_w );
+ DECLARE_WRITE8_MEMBER( tmr_w );
+
+private:
+ enum
+ {
+ TIMER_1 = 0,
+ TIMER_2,
+ TIMER_3,
+ TIMER_4,
+ TIMER_5
+ };
+
+ enum
+ {
+ IRQ_TMR1 = 0x01,
+ IRQ_TMR2 = 0x02,
+ IRQ_SENS = 0x04,
+ IRQ_TMR3 = 0x08,
+ IRQ_RB = 0x10,
+ IRQ_TB = 0x20,
+ IRQ_TMR4 = 0x40,
+ IRQ_TMR5 = 0x80,
+ IRQ_XI7 = 0x80
+ };
+
+ enum
+ {
+ STA_FE = 0x01,
+ STA_OE = 0x02,
+ STA_SR = 0x04,
+ STA_RBL = 0x08,
+ STA_XBE = 0x10,
+ STA_IP = 0x20,
+ STA_FBD = 0x40,
+ STA_SBD = 0x80
+ };
+
+ enum
+ {
+ CMD_RST = 0x01,
+ CMD_BRK = 0x02,
+ CMD_XI7 = 0x04,
+ CMD_IAE = 0x08,
+ CMD_TST1 = 0x10,
+ CMD_TST2 = 0x20
+ };
+
+ enum
+ {
+ RR_110 = 0x01,
+ RR_150 = 0x02,
+ RR_300 = 0x04,
+ RR_1200 = 0x08,
+ RR_2400 = 0x10,
+ RR_4800 = 0x20,
+ RR_9600 = 0x40,
+ RR_STOP = 0x80
+ };
+
+ static const UINT8 rst_vector[];
+
+ void set_interrupt(UINT8 mask);
+ void check_interrupt();
+
+ devcb2_write_line m_write_irq;
+ devcb2_write_line m_write_xmt;
+ devcb2_read8 m_read_xi;
+ devcb2_write8 m_write_xo;
+
+ UINT8 m_irq;
+ UINT8 m_rb;
+ UINT8 m_sta;
+ UINT8 m_cmd;
+ UINT8 m_rr;
+ UINT8 m_tb;
+ UINT8 m_mr;
+
+ int m_sens;
+ int m_xi7;
+
+ emu_timer *m_timer[5];
+};
+
+
+// device type definition
+extern const device_type TMS5501;
+
+
+
+#endif
diff --git a/src/lib/formats/ccvf_dsk.c b/src/lib/formats/ccvf_dsk.c
new file mode 100644
index 00000000000..b4954893cc9
--- /dev/null
+++ b/src/lib/formats/ccvf_dsk.c
@@ -0,0 +1,181 @@
+// license:BSD-3-Clause
+// copyright-holders:Curt Coder
+/*********************************************************************
+
+ formats/ccvf_dsk.c
+
+ Compucolor Virtual Floppy Disk Image format
+
+*********************************************************************/
+
+/*
+
+ TODO:
+
+ - parse ascii hex into binary on load()
+
+*/
+
+#include "emu.h"
+#include "formats/ccvf_dsk.h"
+
+ccvf_format::ccvf_format()
+{
+ formats = file_formats;
+}
+
+ccvf_format::ccvf_format(const format *_formats)
+{
+ formats = _formats;
+}
+
+const char *ccvf_format::name() const
+{
+ return "ccvf";
+}
+
+const char *ccvf_format::description() const
+{
+ return "Compucolor Virtual Floppy Disk Image";
+}
+
+const char *ccvf_format::extensions() const
+{
+ return "ccvf";
+}
+
+const ccvf_format::format ccvf_format::file_formats[] = {
+ {
+ floppy_image::FF_35, floppy_image::SSSD,
+ 4000, 10, 41, 1, 128, {}, -1, { 0,5,1,6,2,7,3,8,4,9 }
+ },
+ {}
+};
+
+int ccvf_format::identify(io_generic *io, UINT32 form_factor)
+{
+ char h[36];
+
+ io_generic_read(io, h, 0, 36);
+ if(!memcmp(h, "Compucolor Virtual Floppy Disk Image", 36))
+ return 100;
+
+ return 0;
+}
+
+floppy_image_format_t::desc_e* ccvf_format::get_desc_8n1(const format &f, int &current_size)
+{
+ static floppy_image_format_t::desc_e desc[] = {
+ /* 00 */ { SECTOR_LOOP_START, 0, -1 },
+ /* 01 */ { RAWBITS, 0xffff, 3 },
+ /* 02 */ { RAWBYTE, 0xff, 3 },
+ /* 03 */ { CRC_FCS_START, 1 },
+ /* 04 */ { _8N1, 0x55, 1 },
+ /* 05 */ { TRACK_ID_8N1 },
+ /* 06 */ { SECTOR_ID_8N1 },
+ /* 07 */ { CRC_END, 1 },
+ /* 08 */ { CRC, 1 },
+ /* 09 */ { _8N1, 0xff, 3 },
+ /* 10 */ { CRC_FCS_START, 2 },
+ /* 11 */ { _8N1, 0x5a, 1 },
+ /* 12 */ { SECTOR_DATA_8N1, -1 },
+ /* 13 */ { CRC_END, 2 },
+ /* 14 */ { CRC, 2 },
+ /* 15 */ { SECTOR_LOOP_END },
+ /* 16 */ { RAWBYTE, 0xff, 0 },
+ /* 17 */ { RAWBITS, 0xffff, 0 },
+ /* 18 */ { END }
+ };
+
+ current_size = 120 + (1+1+1+2)*10 + 3*10 + (1+f.sector_base_size+2)*10;
+
+ current_size *= f.sector_count;
+ return desc;
+}
+
+int ccvf_format::compute_track_size(const format &f) const
+{
+ int track_size;
+ if(f.sector_base_size)
+ track_size = f.sector_base_size * f.sector_count;
+ else {
+ track_size = 0;
+ for(int i=0; i != f.sector_count; i++)
+ track_size += f.per_sector_size[i];
+ }
+ return track_size;
+}
+
+void ccvf_format::build_sector_description(const format &f, UINT8 *sectdata, desc_s *sectors) const
+{
+ if(f.sector_base_id == -1) {
+ for(int i=0; i<f.sector_count; i++) {
+ int cur_offset = 0;
+ for(int j=0; j<f.sector_count; j++)
+ if(f.per_sector_id[j] < f.per_sector_id[i])
+ cur_offset += f.sector_base_size ? f.sector_base_size : f.per_sector_size[j];
+ sectors[i].data = sectdata + cur_offset;
+ sectors[i].size = f.sector_base_size ? f.sector_base_size : f.per_sector_size[i];
+ sectors[i].sector_id = f.per_sector_id[i];
+ }
+ } else {
+ int cur_offset = 0;
+ for(int i=0; i<f.sector_count; i++) {
+ sectors[i].data = sectdata + cur_offset;
+ sectors[i].size = f.sector_base_size ? f.sector_base_size : f.per_sector_size[i];
+ cur_offset += sectors[i].size;
+ sectors[i].sector_id = i + f.sector_base_id;
+ }
+ }
+}
+
+bool ccvf_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
+{
+ const format &f = formats[0];
+ int current_size;
+ floppy_image_format_t::desc_e *desc = get_desc_8n1(f, current_size);
+
+ int total_size = 200000000/f.cell_size;
+ int remaining_size = total_size - current_size;
+ if(remaining_size < 0)
+ throw emu_fatalerror("ccvf_format: Incorrect track layout, max_size=%d, current_size=%d", total_size, current_size);
+
+ // Fixup the end gap
+ desc[16].p2 = remaining_size / 16;
+ desc[17].p2 = remaining_size & 15;
+ desc[17].p1 >>= 16-(remaining_size & 15);
+
+ int track_size = compute_track_size(f);
+
+ UINT8 sectdata[40*512];
+ desc_s sectors[40];
+ build_sector_description(f, sectdata, sectors);
+
+ for(int track=0; track < f.track_count; track++)
+ for(int head=0; head < f.head_count; head++) {
+ io_generic_read(io, sectdata, (track*f.head_count + head)*track_size, track_size);
+ generate_track(desc, track, head, sectors, f.sector_count, total_size, image);
+ }
+
+ image->set_variant(f.variant);
+
+ return true;
+}
+
+void ccvf_format::extract_sectors(floppy_image *image, const format &f, desc_s *sdesc, int track, int head)
+{
+ // TODO
+}
+
+bool ccvf_format::save(io_generic *io, floppy_image *image)
+{
+ // TODO
+ return false;
+}
+
+bool ccvf_format::supports_save() const
+{
+ return false;
+}
+
+const floppy_format_type FLOPPY_CCVF_FORMAT = &floppy_image_format_creator<ccvf_format>;
diff --git a/src/lib/formats/ccvf_dsk.h b/src/lib/formats/ccvf_dsk.h
new file mode 100644
index 00000000000..d0f9f9ef168
--- /dev/null
+++ b/src/lib/formats/ccvf_dsk.h
@@ -0,0 +1,59 @@
+// license:BSD-3-Clause
+// copyright-holders:Curt Coder
+/*********************************************************************
+
+ formats/ccvf_dsk.h
+
+ Compucolor Virtual Floppy Disk Image format
+
+*********************************************************************/
+
+#ifndef CCVF_DSK_H_
+#define CCVF_DSK_H_
+
+#include "flopimg.h"
+
+class ccvf_format : public floppy_image_format_t {
+public:
+ struct format {
+ UINT32 form_factor; // See floppy_image for possible values
+ UINT32 variant; // See floppy_image for possible values
+
+ int cell_size; // See floppy_image_format_t for details
+ int sector_count;
+ int track_count;
+ int head_count;
+ int sector_base_size;
+ int per_sector_size[40]; // if sector_base_size is 0
+ int sector_base_id; // 0 or 1 usually, -1 if there's interleave
+ int per_sector_id[40]; // if sector_base_id is -1. If both per are used, then sector per_sector_id[i] has size per_sector_size[i]
+ };
+
+ ccvf_format();
+ ccvf_format(const format *formats);
+
+ virtual const char *name() const;
+ virtual const char *description() const;
+ virtual const char *extensions() const;
+
+ virtual int identify(io_generic *io, UINT32 form_factor);
+ virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image);
+ virtual bool save(io_generic *io, floppy_image *image);
+ virtual bool supports_save() const;
+
+protected:
+ const format *formats;
+
+ floppy_image_format_t::desc_e* get_desc_8n1(const format &f, int &current_size);
+ int compute_track_size(const format &f) const;
+ void build_sector_description(const format &d, UINT8 *sectdata, desc_s *sectors) const;
+ void extract_sectors(floppy_image *image, const format &f, desc_s *sdesc, int track, int head);
+
+ static const format file_formats[];
+};
+
+extern const floppy_format_type FLOPPY_CCVF_FORMAT;
+
+
+
+#endif
diff --git a/src/lib/formats/flopimg.c b/src/lib/formats/flopimg.c
index 5351cfd10ba..72c5acc7a1f 100644
--- a/src/lib/formats/flopimg.c
+++ b/src/lib/formats/flopimg.c
@@ -1077,6 +1077,7 @@ bool floppy_image_format_t::type_no_data(int type) const
type == CRC_AMIGA_START ||
type == CRC_CBM_START ||
type == CRC_MACHEAD_START ||
+ type == CRC_FCS_START ||
type == CRC_END ||
type == SECTOR_LOOP_START ||
type == SECTOR_LOOP_END ||
@@ -1115,6 +1116,9 @@ void floppy_image_format_t::collect_crcs(const desc_e *desc, gen_crc_info *crcs)
case CRC_MACHEAD_START:
crcs[desc[i].p1].type = CRC_MACHEAD;
break;
+ case CRC_FCS_START:
+ crcs[desc[i].p1].type = CRC_FCS;
+ break;
}
for(int i=0; desc[i].type != END; i++)
@@ -1133,6 +1137,7 @@ int floppy_image_format_t::crc_cells_size(int type) const
case CRC_AMIGA: return 64;
case CRC_CBM: return 10;
case CRC_MACHEAD: return 8;
+ case CRC_FCS: return 20;
default: return 0;
}
}
@@ -1200,6 +1205,16 @@ void floppy_image_format_t::gcr5_w(UINT32 *buffer, int &offset, int n, UINT32 va
raw_w(buffer, offset, 5, e1, size);
}
+void floppy_image_format_t::_8n1_w(UINT32 *buffer, int &offset, int n, UINT32 val, UINT32 size)
+{
+ bit_w(buffer, offset++, 0);
+ for(int i=n-1; i>=0; i--) {
+ int bit = (val >> i) & 1;
+ bit_w(buffer, offset++, bit, size);
+ }
+ bit_w(buffer, offset++, 1);
+}
+
void floppy_image_format_t::fixup_crc_amiga(UINT32 *buffer, const gen_crc_info *crc)
{
UINT16 res = 0;
@@ -1258,6 +1273,11 @@ void floppy_image_format_t::fixup_crc_machead(UINT32 *buffer, const gen_crc_info
raw_w(buffer, offset, 8, gcr6fw_tb[v]);
}
+void floppy_image_format_t::fixup_crc_fcs(UINT32 *buffer, const gen_crc_info *crc)
+{
+ // TODO
+}
+
void floppy_image_format_t::fixup_crcs(UINT32 *buffer, gen_crc_info *crcs)
{
for(int i=0; i != MAX_CRC_COUNT; i++)
@@ -1268,6 +1288,7 @@ void floppy_image_format_t::fixup_crcs(UINT32 *buffer, gen_crc_info *crcs)
case CRC_CCITT: fixup_crc_ccitt(buffer, crcs+i); break;
case CRC_CCITT_FM:fixup_crc_ccitt_fm(buffer, crcs+i); break;
case CRC_MACHEAD: fixup_crc_machead(buffer, crcs+i); break;
+ case CRC_FCS: fixup_crc_fcs(buffer, crcs+i); break;
}
if(crcs[i].fixup_mfm_clock) {
int offset = crcs[i].write + crc_cells_size(crcs[i].type);
@@ -1367,6 +1388,11 @@ void floppy_image_format_t::generate_track(const desc_e *desc, int track, int he
gcr5_w(buffer, offset, 8, desc[index].p1);
break;
+ case _8N1:
+ for(int i=0; i<desc[index].p2; i++)
+ _8n1_w(buffer, offset, 8, desc[index].p1);
+ break;
+
case RAW:
for(int i=0; i<desc[index].p2; i++)
raw_w(buffer, offset, 16, desc[index].p1);
@@ -1393,6 +1419,10 @@ void floppy_image_format_t::generate_track(const desc_e *desc, int track, int he
raw_w(buffer, offset, 8, gcr6fw_tb[track & 0x3f]);
break;
+ case TRACK_ID_8N1:
+ _8n1_w(buffer, offset, 8, track);
+ break;
+
case HEAD_ID:
mfm_w(buffer, offset, 8, head);
break;
@@ -1425,6 +1455,10 @@ void floppy_image_format_t::generate_track(const desc_e *desc, int track, int he
raw_w(buffer, offset, 8, gcr6fw_tb[sect[sector_idx].sector_id]);
break;
+ case SECTOR_ID_8N1:
+ _8n1_w(buffer, offset, 8, sect[sector_idx].sector_id);
+ break;
+
case SIZE_ID: {
int size = sect[sector_idx].size;
int id;
@@ -1497,6 +1531,7 @@ void floppy_image_format_t::generate_track(const desc_e *desc, int track, int he
case CRC_CCITT_START:
case CRC_CCITT_FM_START:
case CRC_MACHEAD_START:
+ case CRC_FCS_START:
crcs[desc[index].p1].start = offset;
break;
@@ -1572,6 +1607,13 @@ void floppy_image_format_t::generate_track(const desc_e *desc, int track, int he
break;
}
+ case SECTOR_DATA_8N1: {
+ const desc_s *csect = sect + (desc[index].p1 >= 0 ? desc[index].p1 : sector_idx);
+ for(int i=0; i != csect->size; i++)
+ _8n1_w(buffer, offset, 8, csect->data[i]);
+ break;
+ }
+
default:
printf("%d.%d.%d (%d) unhandled\n", desc[index].type, desc[index].p1, desc[index].p2, index);
break;
diff --git a/src/lib/formats/flopimg.h b/src/lib/formats/flopimg.h
index d693188f606..0a07887f506 100644
--- a/src/lib/formats/flopimg.h
+++ b/src/lib/formats/flopimg.h
@@ -302,12 +302,14 @@ protected:
MFM, //!< One byte in p1 to be mfm-encoded, msb first, repeated p2 times
MFMBITS, //!< A value of p2 bits in p1 to be mfm-encoded, msb first
GCR5, //!< One byte in p1 to be gcr5-encoded, repeated p2 times
+ _8N1, //!< One byte in p1 to be 8N1-encoded, repeated p2 times
RAW, //!< One 16 bits word in p1 to be written raw, msb first, repeated p2 times
RAWBYTE, //!< One 8 bit byte in p1 to be written raw, msb first, repeated p2 times
RAWBITS, //!< A value of p2 bits in p1 to be copied as-is, msb first
TRACK_ID, //!< Track id byte, mfm-encoded
TRACK_ID_FM, //!< Track id byte, fm-encoded
TRACK_ID_GCR6, //!< Track id low 6 bits, gcr6-encoded
+ TRACK_ID_8N1, //!< Track id byte, 8N1-encoded
HEAD_ID, //!< Head id byte, mfm-encoded
HEAD_ID_FM, //!< Head id byte, fm-encoded
HEAD_ID_SWAP, //!< Head id byte swapped (0->1, 1->0), mfm-encoded
@@ -316,6 +318,7 @@ protected:
SECTOR_ID_FM, //!< Sector id byte, fm-encoded
SECTOR_ID_GCR5, //!< Sector id byte, gcr5-encoded
SECTOR_ID_GCR6, //!< Sector id byte, gcr6-encoded
+ SECTOR_ID_8N1, //!< Sector id byte, 8N1-encoded
SIZE_ID, //!< Sector size code on one byte [log2(size/128)], mfm-encoded
SIZE_ID_FM, //!< Sector size code on one byte [log2(size/128)], fm-encoded
SECTOR_INFO_GCR6, //!< Sector info byte, gcr6-encoded
@@ -332,12 +335,14 @@ protected:
SECTOR_DATA_E, //!< Sector data to mfm-encode, even bits only, which in p1, -1 for the current one per the sector id
SECTOR_DATA_GCR5, //!< Sector data to gcr5-encode, which in p1, -1 for the current one per the sector id
SECTOR_DATA_MAC, //!< Transformed sector data + checksum, mac style, id in p1, -1 for the current one per the sector id
+ SECTOR_DATA_8N1, //!< Sector data to 8N1-encode, which in p1, -1 for the current one per the sector id
CRC_CCITT_START, //!< Start a CCITT CRC calculation, with the usual x^16 + x^12 + x^5 + 1 (11021) polynomial, p1 = crc id
CRC_CCITT_FM_START, //!< Start a CCITT CRC calculation, with the usual x^16 + x^12 + x^5 + 1 (11021) polynomial, p1 = crc id
CRC_AMIGA_START, //!< Start an amiga checksum calculation, p1 = crc id
CRC_CBM_START, //<! Start a CBM checksum calculation (xor of original data values, gcr5-encoded), p1 = crc id
CRC_MACHEAD_START, //!< Start of the mac gcr6 sector header checksum calculation (xor of pre-encode 6-bits values, gcr6-encoded)
+ CRC_FCS_START, //!< Start a Compucolor File Control System checksum calculation, p1 = crc id
CRC_END, //!< End the checksum, p1 = crc id
CRC, //!< Write a checksum in the apporpriate format, p1 = crc id
@@ -543,6 +548,8 @@ protected:
void mfm_half_w(UINT32 *buffer, int &offset, int start_bit, UINT32 val, UINT32 size = 1000);
//! GCR5-encode and write a series of bits
void gcr5_w(UINT32 *buffer, int &offset, int n, UINT32 val, UINT32 size = 1000);
+ //! 8N1-encode and write a series of bits
+ void _8n1_w(UINT32 *buffer, int &offset, int n, UINT32 val, UINT32 size = 1000);
//! GCR4 encode (Apple II sector header)
UINT16 gcr4_encode(UINT8 va);
//! GCR4 decode
@@ -553,7 +560,7 @@ protected:
void gcr6_decode(UINT8 e0, UINT8 e1, UINT8 e2, UINT8 e3, UINT8 &va, UINT8 &vb, UINT8 &vc);
private:
- enum { CRC_NONE, CRC_AMIGA, CRC_CBM, CRC_CCITT, CRC_CCITT_FM, CRC_MACHEAD };
+ enum { CRC_NONE, CRC_AMIGA, CRC_CBM, CRC_CCITT, CRC_CCITT_FM, CRC_MACHEAD, CRC_FCS };
enum { MAX_CRC_COUNT = 64 };
//! Holds data used internally for generating CRCs.
@@ -574,6 +581,7 @@ private:
void fixup_crc_ccitt(UINT32 *buffer, const gen_crc_info *crc);
void fixup_crc_ccitt_fm(UINT32 *buffer, const gen_crc_info *crc);
void fixup_crc_machead(UINT32 *buffer, const gen_crc_info *crc);
+ void fixup_crc_fcs(UINT32 *buffer, const gen_crc_info *crc);
void fixup_crcs(UINT32 *buffer, gen_crc_info *crcs);
void collect_crcs(const desc_e *desc, gen_crc_info *crcs);
diff --git a/src/lib/lib.mak b/src/lib/lib.mak
index 67f802941c1..e84530a3c91 100644
--- a/src/lib/lib.mak
+++ b/src/lib/lib.mak
@@ -116,6 +116,7 @@ FORMATSOBJS = \
$(LIBOBJ)/formats/bw12_dsk.o \
$(LIBOBJ)/formats/cbm_crt.o \
$(LIBOBJ)/formats/cbm_tap.o \
+ $(LIBOBJ)/formats/ccvf_dsk.o \
$(LIBOBJ)/formats/cgen_cas.o \
$(LIBOBJ)/formats/coco_cas.o \
$(LIBOBJ)/formats/coco_dsk.o \
diff --git a/src/mess/drivers/compucolor.c b/src/mess/drivers/compucolor.c
index de230a5fc0e..fc300876567 100644
--- a/src/mess/drivers/compucolor.c
+++ b/src/mess/drivers/compucolor.c
@@ -12,10 +12,11 @@
TODO:
- - keyboard
- - cursor
- floppy
- - option ROM
+ - video
+ - add-on ROM
+ - add-on RAM
+ - add-on unit
*/
@@ -26,7 +27,7 @@
#include "emu.h"
#include "cpu/i8085/i8085.h"
-#include "imagedev/floppy.h"
+#include "machine/compclr_flp.h"
#include "machine/ram.h"
#include "machine/serial.h"
#include "machine/tms5501.h"
@@ -40,9 +41,9 @@ public:
m_maincpu(*this, I8080_TAG),
m_mioc(*this, TMS5501_TAG),
m_vtac(*this, CRT5027_TAG),
- m_floppy0(*this, TMS5501_TAG":0"),
- m_floppy1(*this, TMS5501_TAG":1"),
m_rs232(*this, RS232_TAG),
+ m_floppy0(*this, "cd0"),
+ m_floppy1(*this, "cd1"),
m_char_rom(*this, "chargen"),
m_video_ram(*this, "videoram"),
m_y0(*this, "Y0"),
@@ -67,9 +68,9 @@ public:
required_device<cpu_device> m_maincpu;
required_device<tms5501_device> m_mioc;
required_device<crt5027_device> m_vtac;
- required_device<floppy_connector> m_floppy0;
- required_device<floppy_connector> m_floppy1;
required_device<rs232_port_device> m_rs232;
+ required_device<compucolor_floppy_port_device> m_floppy0;
+ required_device<compucolor_floppy_port_device> m_floppy1;
required_memory_region m_char_rom;
required_shared_ptr<UINT8> m_video_ram;
required_ioport m_y0;
@@ -104,7 +105,6 @@ public:
rgb_t m_palette[8];
UINT8 m_xo;
- UINT8 m_xo_kbd;
};
static ADDRESS_MAP_START( compucolor2_mem, AS_PROGRAM, 8, compucolor2_state )
@@ -114,187 +114,178 @@ static ADDRESS_MAP_START( compucolor2_mem, AS_PROGRAM, 8, compucolor2_state )
ADDRESS_MAP_END
static ADDRESS_MAP_START( compucolor2_io, AS_IO, 8, compucolor2_state )
- //AM_RANGE(0x00, 0x0f) AM_MIRROR(0x10) AM_DEVICE(TMS5501_TAG, tms5501_device, io_map)
+ AM_RANGE(0x00, 0x0f) AM_MIRROR(0x10) AM_DEVICE(TMS5501_TAG, tms5501_device, io_map)
AM_RANGE(0x60, 0x6f) AM_MIRROR(0x10) AM_DEVREADWRITE(CRT5027_TAG, crt5027_device, read, write)
AM_RANGE(0x80, 0x9f) AM_MIRROR(0x60) AM_ROM AM_REGION("ua1", 0)
ADDRESS_MAP_END
static INPUT_PORTS_START( compucolor2 )
PORT_START("Y0")
- PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('=')
- PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD )
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?')
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O')
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("_ CRT") PORT_CHAR('_')
+ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F15 PLOT ESC")
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("BL/A7 OFF")
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("BLINK ON")
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
+ PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_START("Y1")
- PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD )
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>')
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N')
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("^ USER") PORT_CHAR('^')
+ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F14 CHAR RECT")
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("A7 ON")
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("BG ON")
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
+ PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_START("Y2")
- PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD )
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=')
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("m M TERM MODE") PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M')
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("] BLCK") PORT_CHAR(']')
+ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F13 POINT X")
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RETURN ENTER") PORT_CODE(KEYCODE_ENTER) PORT_CHAR('\r')
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("FG ON")
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad =") PORT_CODE(KEYCODE_ENTER_PAD)
+ PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_START("Y3")
- PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD )
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<')
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("l L LOCL") PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L')
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\\ 45 UP") PORT_CHAR('\\')
+ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F12 POINT Y")
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ERASE PAGE")
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP))
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
+ PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_START("Y4")
- PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD )
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+')
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("k K ROLL") PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K')
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("[ VIS") PORT_CHAR('[')
+ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F11 POINT INC")
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ERASE LINE")
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC))
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad +") PORT_CODE(KEYCODE_PLUS_PAD)
+ PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_START("Y5")
- PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD )
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*')
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J')
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("z Z 45 DW") PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z')
+ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F10 X BAR XO")
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_DOWN) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN))
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_LEFT) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(UCHAR_MAMEKEY(LEFT))
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad X") PORT_CODE(KEYCODE_ASTERISK)
+ PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_START("Y6")
- PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD )
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')')
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I')
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("y Y TEST") PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y')
+ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F9 X BAR Y")
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TAB) PORT_CHAR(UCHAR_MAMEKEY(TAB))
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_RIGHT) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT))
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
+ PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_START("Y7")
- PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD )
-
- PORT_START("Y")
- PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD )
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(')
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("h H HALF") PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H')
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("x X XMIT") PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X')
+ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F8 X BAR XM")
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("HOME")
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED )
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
+ PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_START("Y8")
- PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD )
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'')
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("g G BELL") PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G')
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("w W BASIC") PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W')
+ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F7 X BAR INC")
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("LIST")
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED )
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
+ PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_START("Y9")
- PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD )
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&')
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F')
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("v V DEL LINE") PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V')
+ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F6 Y BAR YO")
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("POKE")
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED )
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
+ PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_START("Y10")
- PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD )
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%')
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("e E BSC RST") PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E')
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("u U INS LINE") PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U')
+ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F5 Y BAR X")
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("AUTO")
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PRINT")
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
+ PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_START("Y11")
- PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD )
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$')
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("d D DISK FCS") PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D')
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("t T TEXT EDIT") PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T')
+ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F4 Y BAR YM")
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("DELETE CHAR")
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("LOAD")
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
+ PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_START("Y12")
- PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD )
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#')
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("c C CURSOR X-Y") PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C')
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("s S ASMB") PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S')
+ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F3 Y BAR INC")
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("INSERT LINE")
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SAVE")
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
+ PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_START("Y13")
- PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD )
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"')
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("b B PLOT") PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B')
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("r R BAUD RATE") PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R')
+ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F2 VECT X1")
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("DELETE LINE")
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PLOT")
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
+ PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_START("Y14")
- PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD )
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!')
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("a A PROT BLND") PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A')
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("q Q INS CHAR") PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q')
+ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F1 VECT Y1")
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("INSERT CHAR")
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PUT")
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
+ PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_START("Y15")
- PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD )
- PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD )
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0')
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("@ NULL") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@')
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("p P CPU OP SYS") PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P')
+ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F0 VECT INC")
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("BREAK ATTN")
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("OUT")
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ')
+ PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_START("Y128")
- PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED )
- PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) // COMMAND, CONTROL
- PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) // SHIFT, SHIFT, COMMAND
- PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) // REPEAT
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CPU RESET")
+ PORT_BIT( 0x0e, IP_ACTIVE_LOW, IPT_UNUSED )
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL))
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1)
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("REPEAT")
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CAPS LOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK))
INPUT_PORTS_END
@@ -338,14 +329,14 @@ UINT32 compucolor2_state::screen_update(screen_device &screen, bitmap_rgb32 &bit
static struct tms9927_interface crtc_intf =
{
8, // pixels per video memory address
- NULL // "self-load data"?
+ NULL // self-load data
};
READ8_MEMBER( compucolor2_state::xi_r )
{
UINT8 data = 0xff;
- switch (m_xo_kbd & 0x0f)
+ switch (m_xo & 0x0f)
{
case 0: data &= m_y0->read(); break;
case 1: data &= m_y1->read(); break;
@@ -365,9 +356,9 @@ READ8_MEMBER( compucolor2_state::xi_r )
case 15: data &= m_y15->read(); break;
}
- if (BIT(m_xo_kbd, 7))
+ if (BIT(m_xo, 7))
{
- data = m_y128->read() | (data & 0x0f);
+ data = (m_y128->read() & 0xf0) | (data & 0x0f);
}
return data;
@@ -392,36 +383,23 @@ WRITE8_MEMBER( compucolor2_state::xo_w )
m_xo = data;
- floppy_image_device *floppy = NULL;
-
switch ((m_xo >> 4) & 0x03)
{
- case 0:
- // keyboard
- m_xo_kbd = m_xo;
- logerror("keyboard Y%u\n", m_xo_kbd&0x0f);
- break;
-
case 1:
- // floppy 0
- floppy = m_floppy0->get_device();
- logerror("internal floppy");
- break;
+ m_floppy0->select_w(0);
+ m_floppy0->rw_w(BIT(data, 3));
+ m_floppy0->stepper_w(data & 0x07);
- case 2:
- // floppy 1
- floppy = m_floppy1->get_device();
- logerror("external floppy");
+ m_floppy1->select_w(1);
break;
- }
- if (floppy)
- {
- logerror(" stp %u rw %u\n", data&0x07,BIT(data,3));
- // TODO stepper
+ case 2:
+ m_floppy1->select_w(0);
+ m_floppy1->rw_w(BIT(data, 3));
+ m_floppy1->stepper_w(data & 0x07);
- // motor
- floppy->mon_w(0);
+ m_floppy0->select_w(1);
+ break;
}
}
@@ -434,23 +412,26 @@ WRITE_LINE_MEMBER( compucolor2_state::xmt_w )
break;
case 1:
- // TODO floppy 0
+ m_floppy0->tx(state);
break;
case 2:
- // TODO floppy 1
+ m_floppy1->tx(state);
break;
}
}
IRQ_CALLBACK_MEMBER( compucolor2_state::int_ack )
{
- return 0;// m_mioc->get_vector();
+ return m_mioc->get_vector();
}
void compucolor2_state::machine_start()
{
m_maincpu->set_irq_acknowledge_callback(device_irq_acknowledge_delegate(FUNC(compucolor2_state::int_ack), this));
+
+ // state saving
+ save_item(NAME(m_xo));
}
void compucolor2_state::palette_init()
@@ -461,10 +442,6 @@ void compucolor2_state::palette_init()
}
}
-static SLOT_INTERFACE_START( compucolor2_floppies )
- SLOT_INTERFACE( "525sssd", FLOPPY_525_SSSD )
-SLOT_INTERFACE_END
-
static MACHINE_CONFIG_START( compucolor2, compucolor2_state )
// basic machine hardware
MCFG_CPU_ADD(I8080_TAG, I8080, XTAL_17_9712MHz/9)
@@ -480,18 +457,20 @@ static MACHINE_CONFIG_START( compucolor2, compucolor2_state )
MCFG_SCREEN_VISIBLE_AREA(0, 64*8-1, 0, 32*8-1)
MCFG_DEVICE_ADD(CRT5027_TAG, CRT5027, XTAL_17_9712MHz/12)
MCFG_DEVICE_CONFIG(crtc_intf)
- //MCFG_TMS9927_VSYN_CALLBACK(DEVWRITELINE(TMS5501_TAG, tms5501_device, sens_w))
+ MCFG_TMS9927_VSYN_CALLBACK(DEVWRITELINE(TMS5501_TAG, tms5501_device, sens_w))
// devices
MCFG_DEVICE_ADD(TMS5501_TAG, TMS5501, XTAL_17_9712MHz/9)
- //MCFG_TMS5501_IRQ_CALLBACK(INPUTLINE(I8080_TAG, I8085_INTR_LINE))
- //MCFG_TMS5501_XMT_CALLBACK(WRITELINE(compucolor2_state, xmt_w))
- //MCFG_TMS5501_XI_CALLBACK(READ8(compucolor2_state, xi_r))
- //MCFG_TMS5501_XO_CALLBACK(WRITE8(compucolor2_state, xo_w))
- MCFG_FLOPPY_DRIVE_ADD(TMS5501_TAG":0", compucolor2_floppies, "525sssd", floppy_image_device::default_floppy_formats)
- MCFG_FLOPPY_DRIVE_ADD(TMS5501_TAG":1", compucolor2_floppies, NULL, floppy_image_device::default_floppy_formats)
+ MCFG_TMS5501_IRQ_CALLBACK(INPUTLINE(I8080_TAG, I8085_INTR_LINE))
+ MCFG_TMS5501_XMT_CALLBACK(WRITELINE(compucolor2_state, xmt_w))
+ MCFG_TMS5501_XI_CALLBACK(READ8(compucolor2_state, xi_r))
+ MCFG_TMS5501_XO_CALLBACK(WRITE8(compucolor2_state, xo_w))
MCFG_RS232_PORT_ADD(RS232_TAG, default_rs232_devices, NULL)
- //MCFG_SERIAL_OUT_RX_HANDLER(DEVWRITELINE(TMS5501_TAG, tms5501_device, rcv_w))
+ MCFG_SERIAL_OUT_RX_HANDLER(DEVWRITELINE(TMS5501_TAG, tms5501_device, rcv_w))
+ MCFG_COMPUCOLOR_FLOPPY_PORT_ADD("cd0", compucolor_floppy_port_devices, "floppy")
+ MCFG_SERIAL_OUT_RX_HANDLER(DEVWRITELINE(TMS5501_TAG, tms5501_device, rcv_w))
+ MCFG_COMPUCOLOR_FLOPPY_PORT_ADD("cd1", compucolor_floppy_port_devices, NULL)
+ MCFG_SERIAL_OUT_RX_HANDLER(DEVWRITELINE(TMS5501_TAG, tms5501_device, rcv_w))
// internal ram
MCFG_RAM_ADD(RAM_TAG)
@@ -525,4 +504,4 @@ ROM_START( compclr2 )
ROM_LOAD( "82s129.ug5", 0x00, 0x20, NO_DUMP ) // Color PROM
ROM_END
-COMP( 1977, compclr2, 0, 0, compucolor2, compucolor2, driver_device, 0, "Intelligent Systems Corporation", "Compucolor II", GAME_IS_SKELETON | GAME_NOT_WORKING | GAME_NO_SOUND )
+COMP( 1977, compclr2, 0, 0, compucolor2, compucolor2, driver_device, 0, "Intelligent Systems Corporation", "Compucolor II", GAME_NOT_WORKING | GAME_NO_SOUND_HW )
diff --git a/src/mess/drivers/dai.c b/src/mess/drivers/dai.c
index 2bb107a8b83..d1400ad97d0 100644
--- a/src/mess/drivers/dai.c
+++ b/src/mess/drivers/dai.c
@@ -76,7 +76,7 @@ static ADDRESS_MAP_START( dai_mem , AS_PROGRAM, 8, dai_state )
AM_RANGE( 0xfc00, 0xfcff) AM_READWRITE(dai_pit_r, dai_pit_w) // AM_DEVREADWRITE("pit8253", pit8253_device, read, write)
AM_RANGE( 0xfd00, 0xfdff) AM_READWRITE(dai_io_discrete_devices_r, dai_io_discrete_devices_w )
AM_RANGE( 0xfe00, 0xfeff) AM_DEVREADWRITE("ppi8255", i8255_device, read, write)
- AM_RANGE( 0xff00, 0xffff) AM_DEVREADWRITE("tms5501", tms5501_device, read, write )
+ AM_RANGE( 0xff00, 0xff0f) AM_MIRROR(0xf0) AM_DEVICE("tms5501", tms5501_device, io_map)
ADDRESS_MAP_END
@@ -232,7 +232,10 @@ static MACHINE_CONFIG_START( dai, dai_state )
MCFG_CASSETTE_ADD( "cassette", dai_cassette_interface )
/* tms5501 */
- MCFG_TMS5501_ADD( "tms5501", 2000000, dai_tms5501_interface )
+ MCFG_DEVICE_ADD("tms5501", TMS5501, 2000000)
+ MCFG_TMS5501_IRQ_CALLBACK(INPUTLINE("maincpu", I8085_INTR_LINE))
+ MCFG_TMS5501_XI_CALLBACK(READ8(dai_state, dai_keyboard_r))
+ MCFG_TMS5501_XO_CALLBACK(WRITE8(dai_state, dai_keyboard_w))
/* internal ram */
MCFG_RAM_ADD(RAM_TAG)
diff --git a/src/mess/includes/dai.h b/src/mess/includes/dai.h
index 76fbd4ff2d5..b71f6f92549 100644
--- a/src/mess/includes/dai.h
+++ b/src/mess/includes/dai.h
@@ -59,16 +59,19 @@ public:
dai_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
+ m_maincpu(*this, "maincpu"),
m_pit(*this, "pit8253"),
m_tms5501(*this, "tms5501"),
m_sound(*this, "custom"),
- m_maincpu(*this, "maincpu"),
m_cassette(*this, "cassette"),
m_ram(*this, RAM_TAG) { }
+ required_device<cpu_device> m_maincpu;
required_device<pit8253_device> m_pit;
required_device<tms5501_device> m_tms5501;
required_device<dai_sound_device> m_sound;
+ required_device<cassette_image_device> m_cassette;
+ required_device<ram_device> m_ram;
UINT8 m_paddle_select;
UINT8 m_paddle_enable;
@@ -89,10 +92,8 @@ public:
virtual void video_start();
virtual void palette_init();
UINT32 screen_update_dai(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- required_device<cpu_device> m_maincpu;
- required_device<cassette_image_device> m_cassette;
- required_device<ram_device> m_ram;
void dai_update_memory(int dai_rom_bank);
+ IRQ_CALLBACK_MEMBER(int_ack);
protected:
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
@@ -103,7 +104,6 @@ protected:
extern const struct pit8253_interface dai_pit8253_intf;
extern const i8255_interface dai_ppi82555_intf;
-extern const tms5501_interface dai_tms5501_interface;
/*----------- defined in video/dai.c -----------*/
diff --git a/src/mess/machine/compclr_flp.c b/src/mess/machine/compclr_flp.c
new file mode 100644
index 00000000000..08067a53cef
--- /dev/null
+++ b/src/mess/machine/compclr_flp.c
@@ -0,0 +1,255 @@
+// license:BSD-3-Clause
+// copyright-holders:Curt Coder
+/**********************************************************************
+
+ Compucolor Floppy Disk Drive emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+*********************************************************************/
+
+#include "compclr_flp.h"
+
+
+
+//**************************************************************************
+// DEVICE DEFINITIONS
+//**************************************************************************
+
+const device_type COMPUCOLOR_FLOPPY_PORT = &device_creator<compucolor_floppy_port_device>;
+const device_type COMPUCOLOR_FLOPPY = &device_creator<compucolor_floppy_device>;
+
+
+//-------------------------------------------------
+// SLOT_INTERFACE( compucolor_floppy_port_devices )
+//-------------------------------------------------
+
+SLOT_INTERFACE_START( compucolor_floppy_port_devices )
+ SLOT_INTERFACE("floppy", COMPUCOLOR_FLOPPY)
+SLOT_INTERFACE_END
+
+
+//-------------------------------------------------
+// FLOPPY_FORMATS( floppy_formats )
+//-------------------------------------------------
+
+FLOPPY_FORMATS_MEMBER( compucolor_floppy_device::floppy_formats )
+ FLOPPY_CCVF_FORMAT
+FLOPPY_FORMATS_END
+
+
+//-------------------------------------------------
+// SLOT_INTERFACE( compucolor_floppies )
+//-------------------------------------------------
+
+static SLOT_INTERFACE_START( compucolor_floppies )
+ SLOT_INTERFACE_INTERNAL( "525sssd", FLOPPY_525_SSSD )
+SLOT_INTERFACE_END
+
+
+//-------------------------------------------------
+// MACHINE_DRIVER( compucolor_floppy )
+//-------------------------------------------------
+
+static MACHINE_CONFIG_FRAGMENT( compucolor_floppy )
+ MCFG_FLOPPY_DRIVE_ADD("floppy", compucolor_floppies, "525sssd", compucolor_floppy_device::floppy_formats)
+MACHINE_CONFIG_END
+
+
+//-------------------------------------------------
+// machine_config_additions - device-specific
+// machine configurations
+//-------------------------------------------------
+
+machine_config_constructor compucolor_floppy_device::device_mconfig_additions() const
+{
+ return MACHINE_CONFIG_NAME( compucolor_floppy );
+}
+
+
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+//-------------------------------------------------
+// device_compucolor_floppy_port_interface - constructor
+//-------------------------------------------------
+
+device_compucolor_floppy_port_interface::device_compucolor_floppy_port_interface(const machine_config &mconfig, device_t &device)
+ : device_serial_port_interface(mconfig, device)
+{
+}
+
+
+//-------------------------------------------------
+// compucolor_floppy_port_device - constructor
+//-------------------------------------------------
+
+compucolor_floppy_port_device::compucolor_floppy_port_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
+ : serial_port_device(mconfig, COMPUCOLOR_FLOPPY_PORT, "Compucolor Floppy Port", tag, owner, clock, "rs232", __FILE__)
+{
+}
+
+
+//-------------------------------------------------
+// compucolor_floppy_device - constructor
+//-------------------------------------------------
+
+compucolor_floppy_device::compucolor_floppy_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
+ : device_t(mconfig, COMPUCOLOR_FLOPPY, "Compucolor floppy", tag, owner, clock, "compclr_flp", __FILE__),
+ device_compucolor_floppy_port_interface(mconfig, *this),
+ m_floppy(*this, "floppy:525sssd"),
+ m_period(attotime::from_hz(9600*8))
+{
+ m_owner = dynamic_cast<compucolor_floppy_port_device *>(this->owner());
+}
+
+
+//-------------------------------------------------
+// device_config_complete -
+//-------------------------------------------------
+
+void compucolor_floppy_port_device::device_config_complete()
+{
+ serial_port_device::device_config_complete();
+
+ m_dev = dynamic_cast<device_compucolor_floppy_port_interface *>(get_card_device());
+}
+
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void compucolor_floppy_port_device::device_start()
+{
+ serial_port_device::device_start();
+}
+
+
+void compucolor_floppy_device::device_start()
+{
+ // allocate timer
+ m_timer = timer_alloc();
+ m_timer->adjust(attotime::from_hz(9600*8));
+
+ // state saving
+ save_item(NAME(m_stp));
+ save_item(NAME(m_sel));
+}
+
+
+//-------------------------------------------------
+// device_timer - handle timer events
+//-------------------------------------------------
+
+void compucolor_floppy_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
+{
+ if (!m_sel && !m_rw)
+ {
+ m_owner->out_rx(read_bit());
+ }
+}
+
+
+//-------------------------------------------------
+// tx_w -
+//-------------------------------------------------
+
+void compucolor_floppy_device::tx(UINT8 state)
+{
+ if (!m_sel && m_rw)
+ {
+ write_bit(state);
+ }
+}
+
+
+//-------------------------------------------------
+// rw_w -
+//-------------------------------------------------
+
+void compucolor_floppy_device::rw_w(int state)
+{
+ m_rw = state;
+
+ if (m_rw)
+ {
+ m_owner->out_rx(1);
+ }
+}
+
+
+//-------------------------------------------------
+// stepper_w -
+//-------------------------------------------------
+
+void compucolor_floppy_device::stepper_w(UINT8 data)
+{
+ if (!m_sel)
+ {
+ if ((m_stp == 1 && data == 4) || (m_stp == 2 && data == 1) || (m_stp == 4 && data == 2))
+ {
+ // step in
+ m_floppy->dir_w(1);
+ m_floppy->stp_w(0);
+ m_floppy->stp_w(1);
+ }
+ else if ((m_stp == 1 && data == 2) || (m_stp == 2 && data == 4) || (m_stp == 4 && data == 1))
+ {
+ // step out
+ m_floppy->dir_w(0);
+ m_floppy->stp_w(0);
+ m_floppy->stp_w(1);
+ }
+ }
+
+ m_stp = data;
+}
+
+
+//-------------------------------------------------
+// select_w -
+//-------------------------------------------------
+
+void compucolor_floppy_device::select_w(int state)
+{
+ m_floppy->mon_w(state);
+
+ m_sel = state;
+
+ if (m_sel)
+ {
+ m_owner->out_rx(1);
+ }
+}
+
+
+//-------------------------------------------------
+// read_bit -
+//-------------------------------------------------
+
+bool compucolor_floppy_device::read_bit()
+{
+ attotime edge = m_floppy ? m_floppy->get_next_transition(machine().time()) : attotime::never;
+ attotime next = m_ctime + m_period;
+
+ if (edge.is_never() || edge >= next)
+ {
+ return 0;
+ }
+
+ return 1;
+}
+
+
+//-------------------------------------------------
+// write_bit -
+//-------------------------------------------------
+
+void compucolor_floppy_device::write_bit(bool bit)
+{
+ // TODO
+}
diff --git a/src/mess/machine/compclr_flp.h b/src/mess/machine/compclr_flp.h
new file mode 100644
index 00000000000..929f5ddf040
--- /dev/null
+++ b/src/mess/machine/compclr_flp.h
@@ -0,0 +1,130 @@
+// license:BSD-3-Clause
+// copyright-holders:Curt Coder
+/**********************************************************************
+
+ Compucolor Floppy Disk Drive emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+*********************************************************************/
+
+#pragma once
+
+#ifndef __COMPCLR_FLP__
+#define __COMPCLR_FLP__
+
+#include "emu.h"
+#include "formats/ccvf_dsk.h"
+#include "imagedev/floppy.h"
+#include "machine/serial.h"
+
+
+
+//**************************************************************************
+// INTERFACE MACROS
+//**************************************************************************
+
+#define MCFG_COMPUCOLOR_FLOPPY_PORT_ADD(_tag, _slot_intf, _def_slot) \
+ MCFG_DEVICE_ADD(_tag, COMPUCOLOR_FLOPPY_PORT, 0) \
+ MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false)
+
+
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+// ======================> device_compucolor_floppy_port_interface
+
+class device_compucolor_floppy_port_interface : public device_serial_port_interface
+{
+public:
+ device_compucolor_floppy_port_interface(const machine_config &mconfig, device_t &device);
+ virtual ~device_compucolor_floppy_port_interface() { }
+
+ virtual void rw_w(int state) = 0;
+ virtual void stepper_w(UINT8 data) = 0;
+ virtual void select_w(int state) = 0;
+};
+
+
+// ======================> compucolor_floppy_port_device
+
+class compucolor_floppy_port_device : public serial_port_device
+{
+public:
+ compucolor_floppy_port_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+ virtual ~compucolor_floppy_port_device() { }
+
+ DECLARE_WRITE_LINE_MEMBER( rw_w ) { if (m_dev) m_dev->rw_w(state); }
+ void stepper_w(UINT8 data) { if (m_dev) m_dev->stepper_w(data); }
+ DECLARE_WRITE_LINE_MEMBER( select_w ) { if (m_dev) m_dev->select_w(state); }
+
+protected:
+ // device-level overrides
+ virtual void device_start();
+ virtual void device_config_complete();
+
+private:
+ device_compucolor_floppy_port_interface *m_dev;
+};
+
+
+// ======================> compucolor_floppy_device
+
+class compucolor_floppy_device : public device_t,
+ public device_compucolor_floppy_port_interface
+{
+public:
+ // construction/destruction
+ compucolor_floppy_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+ DECLARE_FLOPPY_FORMATS( floppy_formats );
+
+ // optional information overrides
+ virtual machine_config_constructor device_mconfig_additions() const;
+
+protected:
+ // device-level overrides
+ virtual void device_start();
+ virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
+
+ // device_serial_port_interface overrides
+ virtual void tx(UINT8 state);
+
+ // device_compucolor_floppy_port_interface overrides
+ virtual void rw_w(int state);
+ virtual void stepper_w(UINT8 data);
+ virtual void select_w(int state);
+
+private:
+ required_device<floppy_image_device> m_floppy;
+
+ bool read_bit();
+ void write_bit(bool bit);
+
+ int m_rw;
+ int m_stp;
+ int m_sel;
+
+ attotime m_ctime;
+ attotime m_period;
+
+ compucolor_floppy_port_device *m_owner;
+
+ emu_timer *m_timer;
+};
+
+
+// device type definition
+extern const device_type COMPUCOLOR_FLOPPY_PORT;
+extern const device_type COMPUCOLOR_FLOPPY;
+
+
+// slot devices
+SLOT_INTERFACE_EXTERN( compucolor_floppy_port_devices );
+
+
+
+#endif
diff --git a/src/mess/machine/dai.c b/src/mess/machine/dai.c
index 6ca24519b09..b07b139aadf 100644
--- a/src/mess/machine/dai.c
+++ b/src/mess/machine/dai.c
@@ -25,7 +25,7 @@ void dai_state::device_timer(emu_timer &timer, device_timer_id id, int param, vo
m_maincpu->set_pc(0xc000);
break;
case TIMER_TMS5501:
- m_tms5501->set_pio_bit_7((ioport("IN8")->read() & 0x04) ? 1:0);
+ m_tms5501->xi7_w((ioport("IN8")->read() & 0x04) ? 1:0);
timer_set(attotime::from_hz(100), TIMER_TMS5501);
break;
default:
@@ -41,8 +41,8 @@ void dai_state::device_timer(emu_timer &timer, device_timer_id id, int param, vo
WRITE8_MEMBER(dai_state::dai_stack_interrupt_circuit_w)
{
- m_tms5501->set_sensor(1);
- m_tms5501->set_sensor(0);
+ m_tms5501->sens_w(1);
+ m_tms5501->sens_w(0);
}
void dai_state::dai_update_memory(int dai_rom_bank)
@@ -70,22 +70,6 @@ WRITE8_MEMBER(dai_state::dai_keyboard_w)
m_keyboard_scan_mask = data;
}
-static TMS5501_IRQ_CALLBACK(dai_interrupt_callback)
-{
- dai_state *drvstate = device.machine().driver_data<dai_state>();
- if (intreq)
- drvstate->m_maincpu->set_input_line_and_vector(0, HOLD_LINE, vector);
- else
- drvstate->m_maincpu->set_input_line(0, CLEAR_LINE);
-}
-
-TMS5501_INTERFACE( dai_tms5501_interface )
-{
- DEVCB_DRIVER_MEMBER(dai_state, dai_keyboard_r),
- DEVCB_DRIVER_MEMBER(dai_state, dai_keyboard_w),
- dai_interrupt_callback
-};
-
I8255A_INTERFACE( dai_ppi82555_intf )
{
DEVCB_NULL, /* Port A read */
@@ -117,8 +101,15 @@ const struct pit8253_interface dai_pit8253_intf =
}
};
+IRQ_CALLBACK_MEMBER(dai_state::int_ack)
+{
+ return m_tms5501->get_vector();
+}
+
void dai_state::machine_start()
{
+ m_maincpu->set_irq_acknowledge_callback(device_irq_acknowledge_delegate(FUNC(dai_state::int_ack),this));
+
membank("bank2")->configure_entries(0, 4, memregion("maincpu")->base() + 0x010000, 0x1000);
timer_set(attotime::zero, TIMER_BOOTSTRAP);
timer_set(attotime::from_hz(100), TIMER_TMS5501);
diff --git a/src/mess/machine/tms5501.c b/src/mess/machine/tms5501.c
deleted file mode 100644
index d53557637b1..00000000000
--- a/src/mess/machine/tms5501.c
+++ /dev/null
@@ -1,463 +0,0 @@
-/*********************************************************************
-
- tms5501.c
-
- TMS5501 input/output controller
-
- Krzysztof Strzecha, Nathan Woods, 2003
- Based on TMS9901 emulator by Raphael Nabet
-
- 21-May-2004 - Fixed interrupt queue overflow bug (not really fixed
- previously).
- 06-Mar-2004 - Fixed bug in sensor input.
- 01-Mar-2004 - Interrupt queue overrun problem fixed.
- 19-Oct-2003 - Status register added. Reset fixed. Some cleanups.
- INTA enable/disable.
-
- TODO:
- - SIO
-
-*********************************************************************/
-
-#include "emu.h"
-#include "tms5501.h"
-
-
-/***************************************************************************
- PARAMETERS/MACROS
-***************************************************************************/
-
-#define DEBUG_TMS5501 0
-
-#define LOG_TMS5501(message, data) do { if (DEBUG_TMS5501) logerror ("\nTMS5501 %s: %s %02x", tag(), message, data); } while (0)
-
-/* status register */
-#define TMS5501_FRAME_ERROR 0x01
-#define TMS5501_OVERRUN_ERROR 0x02
-#define TMS5501_SERIAL_RCVD 0x04
-#define TMS5501_RCV_BUFFER_LOADED 0x08
-#define TMS5501_XMIT_BUFFER_EMPTY 0x10
-#define TMS5501_INTERRUPT_PENDING 0x20
-#define TMS5501_FULL_BIT_DETECT 0x40
-#define TMS5501_START_BIT_DETECT 0x80
-
-/* command */
-#define TMS5501_RESET 0x01
-#define TMS5501_BREAK 0x02
-#define TMS5501_INT_7_SELECT 0x04
-#define TMS5501_INT_ACK_ENABLE 0x08
-#define TMS5501_TEST_BIT_1 0x10
-#define TMS5501_TEST_BIT_2 0x20
-#define TMS5501_COMMAND_LATCHED_BITS 0x3e
-
-/* interrupt mask register */
-#define TMS5501_TIMER_0_INT 0x01
-#define TMS5501_TIMER_1_INT 0x02
-#define TMS5501_SENSOR_INT 0x04
-#define TMS5501_TIMER_2_INT 0x08
-#define TMS5501_SERIAL_RCV_LOADED_INT 0x10
-#define TMS5501_SERIAL_XMIT_EMPTY_INT 0x20
-#define TMS5501_TIMER_3_INT 0x40
-#define TMS5501_TIMER_4_INT 0x80
-#define TMS5501_INT_7_INT 0x80
-
-#define TMS5501_PIO_INT_7 0x80
-
-// device type definition
-const device_type TMS5501 = &device_creator<tms5501_device>;
-
-
-static const UINT8 timer_name[] = { TMS5501_TIMER_0_INT, TMS5501_TIMER_1_INT, TMS5501_TIMER_2_INT, TMS5501_TIMER_3_INT, TMS5501_TIMER_4_INT };
-
-/***************************************************************************
- IMPLEMENTATION
-***************************************************************************/
-
-//-------------------------------------------------
-// tms5501_device - constructor
-//-------------------------------------------------
-
-tms5501_device::tms5501_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
- : device_t(mconfig, TMS5501, "TMS5501", tag, owner, clock, "tms5501", __FILE__)
-{
-}
-
-
-//-------------------------------------------------
-// device_config_complete - perform any
-// operations now that the configuration is
-// complete
-//-------------------------------------------------
-
-void tms5501_device::device_config_complete()
-{
- // inherit a copy of the static data
- const tms5501_interface *intf = reinterpret_cast<const tms5501_interface *>(static_config());
- if (intf != NULL)
- {
- *static_cast<tms5501_interface *>(this) = *intf;
- }
- // or initialize to defaults if none provided
- else
- {
- m_interrupt_cb = NULL;
- memset(&m_pio_read_cb, 0, sizeof(m_pio_read_cb));
- memset(&m_pio_write_cb, 0, sizeof(m_pio_write_cb));
- }
-}
-
-/*-------------------------------------------------
- find_first_bit
--------------------------------------------------*/
-
-int tms5501_device::find_first_bit(int value)
-{
- int bit = 0;
-
- if (! value)
- return -1;
-
- while (! (value & 1))
- {
- value >>= 1; /* try next bit */
- bit++;
- }
- return bit;
-}
-
-
-/*-------------------------------------------------
- tms5501_device::field_interrupts()
--------------------------------------------------*/
-
-void tms5501_device::field_interrupts()
-{
- static const UINT8 int_vectors[] = { 0xc7, 0xcf, 0xd7, 0xdf, 0xe7, 0xef, 0xf7, 0xff };
- UINT8 current_ints = m_pending_interrupts;
-
- /* disabling masked interrupts */
- current_ints &= m_interrupt_mask;
-
- LOG_TMS5501("Pending interrupts", m_pending_interrupts);
- LOG_TMS5501("Interrupt mask", m_interrupt_mask);
- LOG_TMS5501("Current interrupts", current_ints);
-
- if (current_ints)
- {
- /* selecting interrupt with highest priority */
- int level = find_first_bit(current_ints);
- LOG_TMS5501("Interrupt level", level);
-
- /* resetting proper bit in pending interrupts register */
- m_pending_interrupts &= ~(1<<level);
-
- /* selecting interrupt vector */
- m_interrupt_address = int_vectors[level];
- LOG_TMS5501("Interrupt vector", int_vectors[level]);
-
- if ((m_command & TMS5501_INT_ACK_ENABLE))
- {
- if (m_interrupt_cb)
- (m_interrupt_cb)(*this, 1, int_vectors[level]);
- }
- else
- m_status |= TMS5501_INTERRUPT_PENDING;
- }
- else
- {
- if ((m_command & TMS5501_INT_ACK_ENABLE))
- {
- if (m_interrupt_cb)
- (m_interrupt_cb)(*this, 0, 0);
- }
- else
- m_status &= ~TMS5501_INTERRUPT_PENDING;
- }
-}
-
-
-/*-------------------------------------------------
- tms5501_device::timer_decrementer
--------------------------------------------------*/
-
-void tms5501_device::timer_decrementer(UINT8 mask)
-{
- if ((mask != TMS5501_TIMER_4_INT) || ((mask == TMS5501_TIMER_4_INT) && (!(m_command & TMS5501_INT_7_SELECT))))
- m_pending_interrupts |= mask;
-
- field_interrupts();
-}
-
-
-/*-------------------------------------------------
- tms5501_device::timer_reload
--------------------------------------------------*/
-
-void tms5501_device::timer_reload(int timer)
-{
- if (m_timer_counter[timer])
- { /* reset clock interval */
- m_timer[timer]->adjust(attotime::from_double((double) m_timer_counter[timer] / (clock() / 128.)), timer_name[timer], attotime::from_double((double) m_timer_counter[timer] / (clock() / 128.)));
- }
- else
- { /* clock interval == 0 -> no timer */
- switch (timer)
- {
- case 0: timer_decrementer(TMS5501_TIMER_0_INT); break;
- case 1: timer_decrementer(TMS5501_TIMER_1_INT); break;
- case 2: timer_decrementer(TMS5501_TIMER_2_INT); break;
- case 3: timer_decrementer(TMS5501_TIMER_3_INT); break;
- case 4: timer_decrementer(TMS5501_TIMER_4_INT); break;
- }
- m_timer[timer]->enable(0);
- }
-}
-
-
-/*-------------------------------------------------
- device_reset - device-specific reset
--------------------------------------------------*/
-
-void tms5501_device::device_reset()
-{
- m_status &= ~(TMS5501_RCV_BUFFER_LOADED|TMS5501_FULL_BIT_DETECT|TMS5501_START_BIT_DETECT|TMS5501_OVERRUN_ERROR);
- m_status |= TMS5501_XMIT_BUFFER_EMPTY|TMS5501_SERIAL_RCVD;
-
- m_pending_interrupts = TMS5501_SERIAL_XMIT_EMPTY_INT;
-
- for (int i=0; i<5; i++)
- {
- m_timer_counter[i] = 0;
- m_timer[i]->enable(0);
- }
-
- LOG_TMS5501("Reset", 0);
-}
-
-
-/*-------------------------------------------------
- DEVICE_START( tms5501 )
--------------------------------------------------*/
-
-void tms5501_device::device_start()
-{
- // resolve callbacks
- m_pio_read_func.resolve(m_pio_read_cb, *this);
- m_pio_write_func.resolve(m_pio_write_cb, *this);
-
- // allocate timers
- for (int i = 0; i < 5; i++)
- {
- m_timer[i] = timer_alloc(TIMER_DECREMENTER);
- m_timer[i]->set_param(i);
- }
-
- m_interrupt_mask = 0;
- m_interrupt_address = 0;
-
- m_sensor = 0;
- m_sio_rate = 0;
- m_sio_input_buffer = 0;
- m_sio_output_buffer = 0;
- m_pio_input_buffer = 0;
- m_pio_output_buffer = 0;
-
- m_command = 0;
- LOG_TMS5501("Init", 0);
-}
-
-
-//-------------------------------------------------
-// device_timer - handler timer events
-//-------------------------------------------------
-
-void tms5501_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
-{
- switch (id)
- {
- case TIMER_DECREMENTER:
- timer_decrementer((UINT8)param);
- break;
- }
-}
-
-
-/*-------------------------------------------------
- tms5501_device::set_pio_bit_7
--------------------------------------------------*/
-
-DECLARE_WRITE_LINE_MEMBER( tms5501_device::set_pio_bit_7 )
-{
- if (m_command & TMS5501_INT_7_SELECT)
- {
- if (!(m_pio_input_buffer & TMS5501_PIO_INT_7) && state)
- m_pending_interrupts |= TMS5501_INT_7_INT;
- else
- m_pending_interrupts &= ~TMS5501_INT_7_INT;
- }
-
- m_pio_input_buffer &= ~TMS5501_PIO_INT_7;
- if (state)
- m_pio_input_buffer |= TMS5501_PIO_INT_7;
-
- if (m_pending_interrupts & TMS5501_INT_7_INT)
- field_interrupts();
-}
-
-
-/*-------------------------------------------------
- tms5501_device::set_sensor
--------------------------------------------------*/
-
-WRITE_LINE_MEMBER(tms5501_device::set_sensor)
-{
- if (!(m_sensor) && state)
- m_pending_interrupts |= TMS5501_SENSOR_INT;
- else
- m_pending_interrupts &= ~TMS5501_SENSOR_INT;
-
- m_sensor = state;
-
- if (m_pending_interrupts &= TMS5501_SENSOR_INT)
- field_interrupts();
-}
-
-
-/*-------------------------------------------------
- READ8_DEVICE_HANDLER( tms5501_r )
--------------------------------------------------*/
-
-READ8_MEMBER( tms5501_device::read )
-{
- UINT8 data = 0x00;
- offset &= 0x0f;
-
- switch (offset)
- {
- case 0x00: /* Serial input buffer */
- data = m_sio_input_buffer;
- m_status &= ~TMS5501_RCV_BUFFER_LOADED;
- LOG_TMS5501("Reading from serial input buffer", data);
- break;
- case 0x01: /* PIO input port */
- if (!m_pio_read_func.isnull())
- data = m_pio_read_func(0);
- LOG_TMS5501("Reading from PIO", data);
- break;
- case 0x02: /* Interrupt address register */
- data = m_interrupt_address;
- m_status &= ~TMS5501_INTERRUPT_PENDING;
- break;
- case 0x03: /* Status register */
- data = m_status;
- break;
- case 0x04: /* Command register */
- data = m_command;
- LOG_TMS5501("Command register read", data);
- break;
- case 0x05: /* Serial rate register */
- data = m_sio_rate;
- LOG_TMS5501("Serial rate read", data);
- break;
- case 0x06: /* Serial output buffer */
- case 0x07: /* PIO output */
- break;
- case 0x08: /* Interrupt mask register */
- data = m_interrupt_mask;
- LOG_TMS5501("Interrupt mask read", data);
- break;
- case 0x09: /* Timer 0 address */
- case 0x0a: /* Timer 1 address */
- case 0x0b: /* Timer 2 address */
- case 0x0c: /* Timer 3 address */
- case 0x0d: /* Timer 4 address */
- break;
- }
- return data;
-}
-
-
-/*-------------------------------------------------
- WRITE8_DEVICE_HANDLER( tms5501_w )
--------------------------------------------------*/
-
-WRITE8_MEMBER( tms5501_device::write )
-{
- offset &= 0x0f;
-
- switch (offset)
- {
- case 0x00: /* Serial input buffer */
- case 0x01: /* Keyboard input port, Page blanking signal */
- case 0x02: /* Interrupt address register */
- case 0x03: /* Status register */
- LOG_TMS5501("Writing to read only port", offset&0x000f);
- LOG_TMS5501("Data", data);
- break;
- case 0x04:
- /* Command register
- bit 0: reset
- bit 1: send break, '1' - serial output is high impedance
- bit 2: int 7 select: '0' - timer 5, '1' - IN7 of the DCE-bus
- bit 3: int ack enable, '0' - disabled, '1' - enabled
- bits 4-5: test bits, normally '0'
- bits 6-7: not used, normally '0'
- bits 1-5 are latched */
-
- m_command = data & TMS5501_COMMAND_LATCHED_BITS;
- LOG_TMS5501("Command register write", data);
-
- if (data & TMS5501_RESET)
- reset();
- break;
- case 0x05:
- /* Serial rate register
- bit 0: 110 baud
- bit 1: 150 baud
- bit 2: 300 baud
- bit 3: 1200 baud
- bit 4: 2400 baud
- bit 5: 4800 baud
- bit 6: 9600 baud
- bit 7: '0' - two stop bits, '1' - one stop bit */
-
- m_sio_rate = data;
- LOG_TMS5501("Serial rate write", data);
- break;
- case 0x06: /* Serial output buffer */
- m_sio_output_buffer = data;
- LOG_TMS5501("Serial output data", data);
- break;
- case 0x07: /* PIO output */
- m_pio_output_buffer = data;
- if (!m_pio_write_func.isnull())
- m_pio_write_func(0, m_pio_output_buffer);
- LOG_TMS5501("Writing to PIO", data);
- break;
- case 0x08:
- /* Interrupt mask register
- bit 0: Timer 1 has expired (UTIM)
- bit 1: Timer 2 has expired
- bit 2: External interrupt (STKIM)
- bit 3: Timer 3 has expired (SNDIM)
- bit 4: Serial receiver loaded
- bit 5: Serial transmitter empty
- bit 6: Timer 4 has expired (KBIM)
- bit 7: Timer 5 has expired or IN7 (CLKIM) */
-
- m_interrupt_mask = data;
- LOG_TMS5501("Interrupt mask write", data);
- break;
- case 0x09: /* Timer 0 counter */
- case 0x0a: /* Timer 1 counter */
- case 0x0b: /* Timer 2 counter */
- case 0x0c: /* Timer 3 counter */
- case 0x0d: /* Timer 4 counter */
- offset -= 9;
- m_timer_counter[offset] = data;
- timer_reload(offset);
- LOG_TMS5501("Write timer", offset);
- LOG_TMS5501("Timer counter set", data);
- break;
- }
-}
diff --git a/src/mess/machine/tms5501.h b/src/mess/machine/tms5501.h
deleted file mode 100644
index d1e81439bc5..00000000000
--- a/src/mess/machine/tms5501.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/*********************************************************************
-
- tms5501.h
-
- TMS 5501 code
-
-*********************************************************************/
-
-#ifndef __TMS5501_H__
-#define __TMS5501_H__
-
-
-/***************************************************************************
- DEVICE CONFIGURATION MACROS
-***************************************************************************/
-
-#define MCFG_TMS5501_ADD(_tag, _clock, _intrf) \
- MCFG_DEVICE_ADD(_tag, TMS5501, _clock) \
- MCFG_DEVICE_CONFIG(_intrf)
-
-#define TMS5501_INTERFACE(name) \
- const tms5501_interface (name) =
-
-
-/***************************************************************************
- TYPE DEFINITIONS
-***************************************************************************/
-
-typedef void (*tms5501_interrupt_cb)(device_t &device, int intreq, UINT8 vector);
-#define TMS5501_IRQ_CALLBACK(name) void name(device_t &device, int intreq, UINT8 vector)
-
-
-// ======================> tms5501_interface
-
-struct tms5501_interface
-{
- devcb_read8 m_pio_read_cb; // PIO read
- devcb_write8 m_pio_write_cb; // PIO write
- tms5501_interrupt_cb m_interrupt_cb; // interrupt callback
-};
-
-// ======================> tms5501_device
-
-class tms5501_device : public device_t,
- public tms5501_interface
-{
-public:
- // construction/destruction
- tms5501_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
-
- DECLARE_READ8_MEMBER( read );
- DECLARE_WRITE8_MEMBER( write );
- DECLARE_WRITE_LINE_MEMBER( set_pio_bit_7 );
- DECLARE_WRITE_LINE_MEMBER( set_sensor );
-
-protected:
- // device-level overrides
- virtual void device_config_complete();
- virtual void device_start();
- virtual void device_reset();
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
-
-public:
- int find_first_bit(int value);
- void field_interrupts();
- void timer_decrementer(UINT8 mask);
- void timer_reload(int timer);
-
- static const device_timer_id TIMER_DECREMENTER = 0;
-
- // internal registers
- UINT8 m_status; // status register
- UINT8 m_command; // command register, bits 1-5 are latched
-
- UINT8 m_sio_rate; // SIO configuration register
- UINT8 m_sio_input_buffer; // SIO input buffer
- UINT8 m_sio_output_buffer; // SIO output buffer
-
- UINT8 m_pio_input_buffer; // PIO input buffer
- UINT8 m_pio_output_buffer; // PIO output buffer
-
- UINT8 m_interrupt_mask; // interrupt mask register
- UINT8 m_pending_interrupts; // pending interrupts register
- UINT8 m_interrupt_address; // interrupt vector register
-
- int m_sensor; // sensor input
-
- // internal timers
- UINT8 m_timer_counter[5];
- emu_timer * m_timer[5];
-
- // PIO callbacks
- devcb_resolved_read8 m_pio_read_func;
- devcb_resolved_write8 m_pio_write_func;
-};
-
-
-// device type definition
-extern const device_type TMS5501;
-
-#endif /* __TMS5501_H__ */
diff --git a/src/mess/mess.mak b/src/mess/mess.mak
index 89c3981f235..99595fffb88 100644
--- a/src/mess/mess.mak
+++ b/src/mess/mess.mak
@@ -448,6 +448,7 @@ MACHINES += STVCD
MACHINES += TC0091LVC
MACHINES += TIMEKPR
MACHINES += TMP68301
+MACHINES += TMS5501
MACHINES += TMS6100
MACHINES += TMS9901
MACHINES += TMS9902
@@ -1147,7 +1148,6 @@ $(MESSOBJ)/dai.a: \
$(MESS_DRIVERS)/dai.o \
$(MESS_VIDEO)/dai.o \
$(MESS_AUDIO)/dai.o \
- $(MESS_MACHINE)/tms5501.o \
$(MESS_MACHINE)/dai.o \
$(MESSOBJ)/ddr.a: \
@@ -1391,6 +1391,7 @@ $(MESSOBJ)/intv.a: \
$(MESSOBJ)/isc.a: \
$(MESS_DRIVERS)/compucolor.o\
+ $(MESS_MACHINE)/compclr_flp.o\
$(MESSOBJ)/kaypro.a: \
$(MESS_DRIVERS)/kaypro.o \