Index: makefile
===================================================================
--- makefile	(revision 32810)
+++ makefile	(working copy)
@@ -24,7 +24,7 @@
 #-------------------------------------------------
 
 ifndef TARGET
-TARGET = mame
+TARGET = mess
 endif
 
 ifndef SUBTARGET
Index: src/emu/bus/bus.mak
===================================================================
--- src/emu/bus/bus.mak	(revision 32810)
+++ src/emu/bus/bus.mak	(working copy)
@@ -1250,6 +1250,7 @@
 BUSOBJS += $(BUSOBJ)/coco/coco_pak.o
 BUSOBJS += $(BUSOBJ)/coco/coco_fdc.o
 BUSOBJS += $(BUSOBJ)/coco/coco_multi.o
+BUSOBJS += $(BUSOBJ)/coco/coco_dwsock.o
 endif
 
 #-------------------------------------------------
Index: src/emu/bus/coco/coco_dwsock.c
===================================================================
--- src/emu/bus/coco/coco_dwsock.c	(revision 0)
+++ src/emu/bus/coco/coco_dwsock.c	(working copy)
@@ -0,0 +1,201 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/types.h>
+
+#include "emu.h"
+#include "osdcore.h"
+#include "includes/coco.h"
+
+#include "coco_dwsock.h"
+
+//**************************************************************************
+//  DEVICE DEFINITIONS
+//**************************************************************************
+
+const device_type COCO_DWSOCK = &device_creator<beckerport_device>;
+
+//-------------------------------------------------
+//  INPUT_PORTS( coco_drivewire )
+//-------------------------------------------------
+
+INPUT_PORTS_START( coco_drivewire )
+	PORT_START(DRIVEWIRE_PORT_TAG)
+	PORT_CONFNAME( 0xffff, 65504, "Drivewire Server TCP Port")            
+      PORT_CHANGED_MEMBER(DEVICE_SELF, beckerport_device,  beckerport_device::drivewire_port_changed, NULL )
+	PORT_CONFSETTING(      65500, "65500" )
+	PORT_CONFSETTING(      65501, "65501" )
+	PORT_CONFSETTING(      65502, "65502" )
+	PORT_CONFSETTING(      65503, "65503" )
+	PORT_CONFSETTING(      65504, "65504" )
+	PORT_CONFSETTING(      65505, "65505" )
+	PORT_CONFSETTING(      65506, "65506" )
+	PORT_CONFSETTING(      65507, "65507" )
+	PORT_CONFSETTING(      65508, "65508" )
+	PORT_CONFSETTING(      65509, "65509" )
+INPUT_PORTS_END
+
+//-------------------------------------------------
+//  input_ports - device-specific input ports
+//-------------------------------------------------
+
+ioport_constructor beckerport_device::device_input_ports() const
+{
+	return INPUT_PORTS_NAME( coco_drivewire );
+}
+
+//-------------------------------------------------
+//  drivewire_port_changed
+//-------------------------------------------------
+INPUT_CHANGED_MEMBER(beckerport_device::drivewire_port_changed)
+{
+    this->update_port();
+}
+
+//**************************************************************************
+//  LIVE DEVICE
+//**************************************************************************
+
+//-------------------------------------------------
+//  beckerport_device - constructor / destructor
+//-------------------------------------------------
+
+beckerport_device::beckerport_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
+ : device_t(mconfig, COCO_DWSOCK, "Virtual Becker Port", tag, owner, clock, "coco_dwsock", __FILE__),
+   m_dwconfigport(*this, DRIVEWIRE_PORT_TAG)
+{
+    m_pSocket = NULL;
+    m_head = 0;
+    m_rx_pending = 0;
+}
+
+beckerport_device::~beckerport_device()
+{
+    if (m_pSocket != NULL)
+        device_stop();
+}
+
+/*-------------------------------------------------
+    device_start
+-------------------------------------------------*/
+
+void beckerport_device::device_start(void)
+{
+    char chAddress[64];
+
+    /* format address string for opening the port */
+    snprintf(chAddress, sizeof(chAddress), "socket.%s:%d", m_hostname, m_dwtcpport);
+
+    fprintf(stderr, "Connecting to Drivewire server on %s:%d... ", m_hostname, m_dwtcpport);
+
+    UINT64 filesize; // unused
+    file_error filerr = osd_open(chAddress, 0, &m_pSocket, &filesize);
+    if (filerr != FILERR_NONE)
+    {
+        fprintf(stderr, "Error: osd_open returned error %i!\n", (int) filerr);
+        return;
+    }
+
+    fprintf(stderr, "Connected!\n");
+}
+
+/*-------------------------------------------------
+    device_stop
+-------------------------------------------------*/
+
+void beckerport_device::device_stop(void)
+{
+    if (m_pSocket != NULL)
+    {
+        printf("Closing connection to Drivewire server\n");
+        osd_close(m_pSocket);
+        m_pSocket = NULL;
+    }
+}
+
+/*-------------------------------------------------
+    device_config_complete
+-------------------------------------------------*/
+
+void beckerport_device::device_config_complete(void)
+{
+	m_hostname = "127.0.0.1";
+	m_dwtcpport = 65504;
+}
+
+/*-------------------------------------------------
+    read
+-------------------------------------------------*/
+
+READ8_MEMBER(beckerport_device::read)
+{
+    unsigned char data = 0x5a;
+
+    switch (offset)
+    {
+        case DWS_STATUS:
+            if (!m_rx_pending)
+            {
+                /* Try to read from dws */
+                file_error filerr = osd_read(m_pSocket, m_buf, 0, sizeof(m_buf), &m_rx_pending);
+                if (filerr != FILERR_NONE && filerr != FILERR_FAILURE)  // FILERR_FAILURE means no data available, so don't throw error message
+                    fprintf(stderr, "coco_dwsock.c: beckerport_device::read() socket read operation failed with file_error %i\n", filerr);
+                else
+                    m_head = 0;
+            }
+            //printf("beckerport_device: status read. %i bytes remaining.\n", m_rx_pending);
+            data = (m_rx_pending > 0) ? 2 : 0;
+            break;
+        case DWS_DATA:
+            if (!m_rx_pending) {
+                fprintf(stderr, "coco_dwsock.c: beckerport_device::read() buffer underrun\n");
+                break;
+            }
+            data = m_buf[m_head++];
+            m_rx_pending--;
+            //printf("beckerport_device: data read 1 byte (0x%02x).  %i bytes remaining.\n", data&0xff, m_rx_pending);
+            break;
+        default:
+            fprintf(stderr, "%s: read from bad offset %d\n", __FILE__, offset);
+    }
+
+    return (int)data;
+}
+
+/*-------------------------------------------------
+    write
+-------------------------------------------------*/
+
+WRITE8_MEMBER(beckerport_device::write)
+{
+    char d = (char)data;
+    file_error filerr;
+
+    switch (offset)
+    {
+        case DWS_STATUS:
+            //printf("beckerport_write: error: write (0x%02x) to status register\n", d);
+            break;
+        case DWS_DATA:
+            filerr = osd_write(m_pSocket, &d, 0, 1, NULL);
+            if (filerr != FILERR_NONE)
+                fprintf(stderr, "coco_dwsock.c: beckerport_device::write() socket write operation failed with file_error %i\n", filerr);
+            //printf("beckerport_write: data write one byte (0x%02x)\n", d & 0xff);
+            break;
+        default:
+            fprintf(stderr, "%s: write to bad offset %d\n", __FILE__, offset);
+    }
+}
+
+/*-------------------------------------------------
+    update_port
+-------------------------------------------------*/
+
+void beckerport_device::update_port(void)
+{
+    device_stop();
+    m_dwtcpport = m_dwconfigport->read_safe(65504);
+    device_start();
+}
+
Index: src/emu/bus/coco/coco_dwsock.h
===================================================================
--- src/emu/bus/coco/coco_dwsock.h	(revision 0)
+++ src/emu/bus/coco/coco_dwsock.h	(working copy)
@@ -0,0 +1,72 @@
+#ifndef _DWSOCK_H_
+#define _DWSOCK_H_
+
+#include "emu.h"
+#include "osdcore.h"
+
+//**************************************************************************
+//  MACROS / CONSTANTS
+//**************************************************************************
+
+#define DRIVEWIRE_PORT_TAG          "drivewire_port"
+
+//**************************************************************************
+//  INTERFACE CONFIGURATION MACROS
+//**************************************************************************
+
+//**************************************************************************
+//  TYPE DEFINITIONS
+//**************************************************************************
+
+// ======================> beckerport_device
+
+class beckerport_device : public device_t
+{
+public:
+    beckerport_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+    virtual ~beckerport_device();
+
+    // optional information overrides
+    virtual ioport_constructor device_input_ports() const;
+
+    virtual void device_start(void);
+    virtual void device_stop(void);
+    virtual void device_config_complete(void);
+
+    void    update_port(void);
+
+    // driver update handlers
+    DECLARE_INPUT_CHANGED_MEMBER(drivewire_port_changed);
+
+    virtual DECLARE_READ8_MEMBER(read);
+    virtual DECLARE_WRITE8_MEMBER(write);
+
+    // types
+    enum dwsock_ports {
+	    DWS_STATUS,
+	    DWS_DATA
+    };
+
+private:
+    /* IP hostname */
+    const char *            m_hostname;
+
+	/* IP port */
+	required_ioport         m_dwconfigport;
+	int                     m_dwtcpport;
+
+	osd_file *m_pSocket;
+
+	unsigned int m_rx_pending;
+	unsigned int m_head;
+	char m_buf[0x80];
+};
+
+// device type definition
+extern const device_type COCO_DWSOCK;
+
+// device iterator
+typedef device_type_iterator<&device_creator<beckerport_device>, beckerport_device> beckerport_device_iterator;
+
+#endif /* _DWSOCK_H_ */
+
Index: src/emu/bus/coco/coco_fdc.c
===================================================================
--- src/emu/bus/coco/coco_fdc.c	(revision 32810)
+++ src/emu/bus/coco/coco_fdc.c	(working copy)
@@ -639,6 +639,30 @@
 }
 
 //**************************************************************************
+//              COCO-3 HDB-DOS
+//**************************************************************************
+
+ROM_START( coco3_hdb1 )
+	ROM_REGION(0x8000,"eprom",ROMREGION_ERASE00)
+	ROM_LOAD("hdbdw3bc3.rom",   0x0000, 0x2000, CRC(309a9efd) SHA1(671605d61811953860466f771c1594bbade331f4))
+	ROM_RELOAD(0x2000, 0x2000)
+	ROM_RELOAD(0x4000, 0x2000)
+	ROM_RELOAD(0x6000, 0x2000)
+ROM_END
+
+const device_type COCO3_HDB1 = &device_creator<coco3_hdb1_device>;
+
+coco3_hdb1_device::coco3_hdb1_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
+		: coco_fdc_device(mconfig, COCO3_HDB1, "CoCo3 HDB-DOS", tag, owner, clock, "coco3_hdb1", __FILE__)
+{
+}
+
+const rom_entry *coco3_hdb1_device::device_rom_region() const
+{
+	return ROM_NAME( coco3_hdb1 );
+}
+
+//**************************************************************************
 //              CP400 FDC
 //**************************************************************************
 
Index: src/emu/bus/coco/coco_fdc.h
===================================================================
--- src/emu/bus/coco/coco_fdc.h	(revision 32810)
+++ src/emu/bus/coco/coco_fdc.h	(working copy)
@@ -95,6 +95,23 @@
 // device type definition
 extern const device_type COCO_FDC_V11;
 
+// ======================> coco3_hdb1_device
+
+class coco3_hdb1_device :
+		public coco_fdc_device
+{
+public:
+		// construction/destruction
+		coco3_hdb1_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+		// optional information overrides
+		virtual const rom_entry *device_rom_region() const;
+};
+
+
+// device type definition
+extern const device_type COCO3_HDB1;
+
 // ======================> cp400_fdc_device
 
 class cp400_fdc_device :
Index: src/emu/bus/coco/coco_multi.c
===================================================================
--- src/emu/bus/coco/coco_multi.c	(revision 32810)
+++ src/emu/bus/coco/coco_multi.c	(working copy)
@@ -75,6 +75,7 @@
 	SLOT_INTERFACE("pak", COCO_PAK)
 SLOT_INTERFACE_END
 static SLOT_INTERFACE_START(coco_cart_slot4)
+	SLOT_INTERFACE("cc3hdb1", COCO3_HDB1)
 	SLOT_INTERFACE("fdcv11", COCO_FDC_V11)
 	SLOT_INTERFACE("rs232", COCO_232)
 	SLOT_INTERFACE("orch90", COCO_ORCH90)
Index: src/mess/drivers/coco12.c
===================================================================
--- src/mess/drivers/coco12.c	(revision 32810)
+++ src/mess/drivers/coco12.c	(working copy)
@@ -29,6 +29,7 @@
 #include "bus/coco/coco_pak.h"
 #include "bus/coco/coco_fdc.h"
 #include "bus/coco/coco_multi.h"
+#include "bus/coco/coco_dwsock.h"
 #include "formats/coco_cas.h"
 
 //**************************************************************************
@@ -114,6 +115,17 @@
 
 
 //-------------------------------------------------
+//  INPUT_PORTS( coco_beckerport )
+//-------------------------------------------------
+
+INPUT_PORTS_START( coco_beckerport )
+	PORT_START(BECKERPORT_TAG)
+	PORT_CONFNAME( 0x01, 0x01, "Becker Port" )
+	PORT_CONFSETTING(    0x00, DEF_STR( Off ))
+	PORT_CONFSETTING(    0x01, DEF_STR( On ))
+INPUT_PORTS_END
+
+//-------------------------------------------------
 //  INPUT_PORTS( coco_rtc )
 //-------------------------------------------------
 
@@ -223,6 +235,7 @@
 	PORT_INCLUDE( coco_analog_control )
 	PORT_INCLUDE( coco_cart_autostart )
 	PORT_INCLUDE( coco_rtc )
+	PORT_INCLUDE( coco_beckerport )
 INPUT_PORTS_END
 
 
@@ -238,6 +251,7 @@
 SLOT_INTERFACE_START( coco_cart )
 	SLOT_INTERFACE("fdc", COCO_FDC)
 	SLOT_INTERFACE("fdcv11", COCO_FDC_V11)
+	SLOT_INTERFACE("cc3hdb1", COCO3_HDB1)
 	SLOT_INTERFACE("cp400_fdc", CP400_FDC)
 	SLOT_INTERFACE("rs232", COCO_232)
 	SLOT_INTERFACE("orch90", COCO_ORCH90)
@@ -300,6 +314,9 @@
 	MCFG_SAM6883_ADD(SAM_TAG, XTAL_3_579545MHz, MAINCPU_TAG, AS_PROGRAM)
 	MCFG_SAM6883_RES_CALLBACK(READ8(coco12_state, sam_read))
 
+	// Becker Port device
+	MCFG_DEVICE_ADD(DWSOCK_TAG, COCO_DWSOCK, 0)
+
 	MCFG_CASSETTE_ADD("cassette")
 	MCFG_CASSETTE_FORMATS(coco_cassette_formats)
 	MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_MUTED)
Index: src/mess/drivers/coco3.c
===================================================================
--- src/mess/drivers/coco3.c	(revision 32810)
+++ src/mess/drivers/coco3.c	(working copy)
@@ -222,6 +222,7 @@
 	PORT_INCLUDE( coco_rat_mouse )
 	PORT_INCLUDE( coco_lightgun )
 	PORT_INCLUDE( coco_rtc )
+	PORT_INCLUDE( coco_beckerport )
 INPUT_PORTS_END
 
 static DEVICE_INPUT_DEFAULTS_START( printer )
@@ -261,6 +262,9 @@
 	MCFG_PIA_IRQA_HANDLER(WRITELINE(coco_state, pia1_firq_a))
 	MCFG_PIA_IRQB_HANDLER(WRITELINE(coco_state, pia1_firq_b))
 
+	// Becker Port device
+	MCFG_DEVICE_ADD(DWSOCK_TAG, COCO_DWSOCK, 0)
+
 	MCFG_CASSETTE_ADD("cassette")
 	MCFG_CASSETTE_FORMATS(coco_cassette_formats)
 	MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_MUTED)
@@ -337,8 +341,11 @@
 	MCFG_CPU_PROGRAM_MAP(coco3_mem)
 MACHINE_CONFIG_END
 
+static MACHINE_CONFIG_DERIVED( coco3dw1, coco3 )
+	MCFG_COCO_CARTRIDGE_REMOVE(CARTRIDGE_TAG)
+	MCFG_COCO_CARTRIDGE_ADD(CARTRIDGE_TAG, coco_cart, "cc3hdb1")
+MACHINE_CONFIG_END
 
-
 //**************************************************************************
 //  ROMS
 //**************************************************************************
@@ -354,9 +361,8 @@
 ROM_END
 
 #define rom_coco3h  rom_coco3
+#define rom_coco3dw1 rom_coco3
 
-
-
 //**************************************************************************
 //  SYSTEM DRIVERS
 //**************************************************************************
@@ -364,3 +370,4 @@
 COMP(  1986,    coco3,      coco,   0,      coco3,     coco3, driver_device,     0,      "Tandy Radio Shack",            "Color Computer 3 (NTSC)", 0)
 COMP(  1986,    coco3p,     coco,   0,      coco3p,    coco3, driver_device,     0,      "Tandy Radio Shack",            "Color Computer 3 (PAL)", 0)
 COMP(  19??,    coco3h,     coco,   0,      coco3h,    coco3, driver_device,     0,      "Tandy Radio Shack",            "Color Computer 3 (NTSC; HD6309)", GAME_UNOFFICIAL)
+COMP(  19??,    coco3dw1,   coco,   0,      coco3dw1,  coco3, driver_device,     0,      "Tandy Radio Shack",            "Color Computer 3 (NTSC; HDB-DOS)", GAME_UNOFFICIAL)
Index: src/mess/includes/coco.h
===================================================================
--- src/mess/includes/coco.h	(revision 32810)
+++ src/mess/includes/coco.h	(working copy)
@@ -18,6 +18,7 @@
 #include "machine/6821pia.h"
 #include "bus/coco/cococart.h"
 #include "machine/coco_vhd.h"
+#include "bus/coco/coco_dwsock.h"
 #include "machine/ram.h"
 #include "sound/dac.h"
 #include "sound/wave.h"
@@ -31,6 +32,7 @@
 INPUT_PORTS_EXTERN( coco_analog_control );
 INPUT_PORTS_EXTERN( coco_cart_autostart );
 INPUT_PORTS_EXTERN( coco_rtc );
+INPUT_PORTS_EXTERN( coco_beckerport );
 
 SLOT_INTERFACE_EXTERN( coco_cart );
 
@@ -48,6 +50,7 @@
 #define DAC_TAG                     "dac"
 #define CARTRIDGE_TAG               "ext"
 #define RS232_TAG                   "rs232"
+#define DWSOCK_TAG                  "dwsock"
 #define VHD0_TAG                    "vhd0"
 #define VHD1_TAG                    "vhd1"
 
@@ -55,6 +58,7 @@
 #define CTRL_SEL_TAG                "ctrl_sel"
 #define HIRES_INTF_TAG              "hires_intf"
 #define CART_AUTOSTART_TAG          "cart_autostart"
+#define BECKERPORT_TAG              "beckerport"
 #define JOYSTICK_RX_TAG             "joystick_rx"
 #define JOYSTICK_RY_TAG             "joystick_ry"
 #define JOYSTICK_LX_TAG             "joystick_lx"
@@ -95,6 +99,8 @@
 	optional_device<rs232_port_device> m_rs232;
 	optional_device<coco_vhd_image_device> m_vhd_0;
 	optional_device<coco_vhd_image_device> m_vhd_1;
+	required_device<beckerport_device> m_beckerport;
+	required_ioport                    m_beckerportconfig;
 
 	// driver update handlers
 	DECLARE_INPUT_CHANGED_MEMBER(keyboard_changed);
Index: src/mess/machine/coco.c
===================================================================
--- src/mess/machine/coco.c	(revision 32810)
+++ src/mess/machine/coco.c	(working copy)
@@ -89,7 +89,9 @@
 	m_cassette(*this, "cassette"),
 	m_rs232(*this, RS232_TAG),
 	m_vhd_0(*this, VHD0_TAG),
-	m_vhd_1(*this, VHD1_TAG)
+	m_vhd_1(*this, VHD1_TAG),
+	m_beckerport(*this, DWSOCK_TAG),
+	m_beckerportconfig(*this, BECKERPORT_TAG)
 {
 }
 
@@ -1016,8 +1018,6 @@
 	poll_keyboard();
 }
 
-
-
 //-------------------------------------------------
 //  poll_hires_joystick
 //-------------------------------------------------
@@ -1159,6 +1159,11 @@
 
 READ8_MEMBER( coco_state::ff40_read )
 {
+    if (offset >= 1 && offset <= 2 && m_beckerportconfig->read_safe(0) == 1)
+    {
+        return m_beckerport->read(space, offset-1, mem_mask);
+    }
+
 	return m_cococart->read(space, offset, mem_mask);
 }
 
@@ -1170,6 +1175,11 @@
 
 WRITE8_MEMBER( coco_state::ff40_write )
 {
+    if (offset >= 1 && offset <= 2 && m_beckerportconfig->read_safe(0) == 1)
+    {
+        return m_beckerport->write(space, offset-1, data, mem_mask);
+    }
+
 	m_cococart->write(space, offset, data, mem_mask);
 }
 
@@ -1184,8 +1194,6 @@
 	m_pia_1->cb1_w(state);
 }
 
-
-
 /***************************************************************************
   DISASSEMBLY OVERRIDE (OS9 syscalls)
  ***************************************************************************/
Index: src/mess/mess.lst
===================================================================
--- src/mess/mess.lst	(revision 32810)
+++ src/mess/mess.lst	(working copy)
@@ -1213,6 +1213,7 @@
 coco3    // Color Computer 3 (NTSC)
 coco3p  // Color Computer 3 (PAL)
 coco3h  // Hacked Color Computer 3 (6309)
+coco3dw1  // Coco 3 with HDB-DOS
 dragon32  // Dragon 32
 dragon64  // Dragon 64
 dragon200 // Dragon 200
