Merge pull request #3232 from tlindner/coco_expansion_serial

Attached ports to the two Color Computer serial cards.
This commit is contained in:
ajrhacker 2018-02-18 14:05:37 -05:00 committed by GitHub
commit 53d410c0da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 47 additions and 6 deletions

View File

@ -6,9 +6,6 @@
Code for emulating the CoCo Direct Connect Modem PAK
This is just a "skeleton device"; the UART is emulated but pretty much
nothing else
***************************************************************************/
#include "emu.h"
@ -16,6 +13,7 @@
#include "cococart.h"
#include "machine/mos6551.h"
#include "bus/rs232/rs232.h"
/***************************************************************************
@ -23,6 +21,7 @@
***************************************************************************/
#define UART_TAG "uart"
#define PORT_TAG "port"
//**************************************************************************
@ -87,6 +86,13 @@ MACHINE_CONFIG_START(coco_dc_modem_device::device_add_mconfig)
MCFG_DEVICE_ADD(UART_TAG, MOS6551, 0)
MCFG_MOS6551_XTAL(XTAL(1'843'200))
MCFG_MOS6551_IRQ_HANDLER(WRITELINE(coco_dc_modem_device, uart_irq_w))
MCFG_MOS6551_TXD_HANDLER(DEVWRITELINE(PORT_TAG, rs232_port_device, write_txd))
MCFG_RS232_PORT_ADD(PORT_TAG, default_rs232_devices, nullptr)
MCFG_RS232_RXD_HANDLER(DEVWRITELINE(UART_TAG, mos6551_device, write_rxd))
MCFG_RS232_DCD_HANDLER(DEVWRITELINE(UART_TAG, mos6551_device, write_dcd))
MCFG_RS232_DSR_HANDLER(DEVWRITELINE(UART_TAG, mos6551_device, write_dsr))
MCFG_RS232_CTS_HANDLER(DEVWRITELINE(UART_TAG, mos6551_device, write_cts))
MACHINE_CONFIG_END

View File

@ -4,7 +4,7 @@
coco_rs232.cpp
Code for emulating the CoCo RS-232 PAK
Code for emulating the CoCo Deluxe RS-232 PAK
***************************************************************************/
@ -13,6 +13,7 @@
#include "cococart.h"
#include "machine/mos6551.h"
#include "bus/rs232/rs232.h"
/***************************************************************************
@ -20,7 +21,7 @@
***************************************************************************/
#define UART_TAG "uart"
#define PORT_TAG "port"
//**************************************************************************
// TYPE DEFINITIONS
@ -46,6 +47,10 @@ namespace
// optional information overrides
virtual void device_add_mconfig(machine_config &config) override;
WRITE_LINE_MEMBER(uart_irq_w)
{
set_line_value(line::CART, state != 0);
}
protected:
// device-level overrides
@ -56,6 +61,14 @@ namespace
write8_delegate(FUNC(mos6551_device::write), (mos6551_device *)m_uart));
}
virtual const tiny_rom_entry *device_rom_region() const override;
// CoCo cartridge level overrides
virtual uint8_t *get_cart_base() override
{
return memregion("eprom")->base();
}
private:
// internal state
required_device<mos6551_device> m_uart;
@ -70,11 +83,33 @@ IMPLEMENTATION
MACHINE_CONFIG_START(coco_rs232_device::device_add_mconfig)
MCFG_DEVICE_ADD(UART_TAG, MOS6551, 0)
MCFG_MOS6551_XTAL(XTAL(1'843'200))
MCFG_MOS6551_IRQ_HANDLER(WRITELINE(coco_rs232_device, uart_irq_w))
MCFG_MOS6551_TXD_HANDLER(DEVWRITELINE(PORT_TAG, rs232_port_device, write_txd))
MCFG_RS232_PORT_ADD(PORT_TAG, default_rs232_devices, nullptr)
MCFG_RS232_RXD_HANDLER(DEVWRITELINE(UART_TAG, mos6551_device, write_rxd))
MCFG_RS232_DCD_HANDLER(DEVWRITELINE(UART_TAG, mos6551_device, write_dcd))
MCFG_RS232_DSR_HANDLER(DEVWRITELINE(UART_TAG, mos6551_device, write_dsr))
MCFG_RS232_CTS_HANDLER(DEVWRITELINE(UART_TAG, mos6551_device, write_cts))
MACHINE_CONFIG_END
ROM_START(coco_rs232_device)
ROM_REGION(0x1000, "eprom", ROMREGION_ERASE00)
ROM_LOAD("Deluxe_RS-232_Program_Pak_1983_26-2226_Tandy.rom", 0x0000, 0x1000, CRC(d990e1f9) SHA1(3fad25f3462a0b581b9c182ac11ad90c8fa08cb6))
ROM_END
//-------------------------------------------------
// device_rom_region
//-------------------------------------------------
const tiny_rom_entry *coco_rs232_device::device_rom_region() const
{
return ROM_NAME(coco_rs232_device);
}
//**************************************************************************
// DEVICE DECLARATION
//**************************************************************************
DEFINE_DEVICE_TYPE(COCO_RS232, coco_rs232_device, "coco_rs232", "CoCo RS-232 PAK")
DEFINE_DEVICE_TYPE(COCO_RS232, coco_rs232_device, "coco_rs232", "CoCo Deluxe RS-232 PAK")