trs/coco*.cpp: Cleaned up some rot.

In particular, use object finders in machine configuration rather than
defining tag macros, and avoid unnecessary device_replace to just
slightly alter device configuration.
This commit is contained in:
Vas Crabb 2024-02-22 00:43:59 +11:00
parent f01e142ea3
commit dfc7cb2144
9 changed files with 177 additions and 193 deletions

View File

@ -69,22 +69,22 @@
// ctor
//-------------------------------------------------
coco_state::coco_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
coco_state::coco_state(const machine_config &mconfig, device_type type, const char *tag) :
driver_device(mconfig, type, tag),
m_maincpu(*this, MAINCPU_TAG),
m_pia_0(*this, PIA0_TAG),
m_pia_1(*this, PIA1_TAG),
m_pia_0(*this, "pia0"),
m_pia_1(*this, "pia1"),
m_dac(*this, "dac"),
m_sbs(*this, "sbs"),
m_screen(*this, SCREEN_TAG),
m_cococart(*this, CARTRIDGE_TAG),
m_screen(*this, "screen"),
m_cococart(*this, "ext"),
m_ram(*this, RAM_TAG),
m_cassette(*this, "cassette"),
m_floating(*this, FLOATING_TAG),
m_floating(*this, "floating"),
m_rs232(*this, RS232_TAG),
m_vhd_0(*this, VHD0_TAG),
m_vhd_1(*this, VHD1_TAG),
m_beckerport(*this, DWSOCK_TAG),
m_vhd_0(*this, "vhd0"),
m_vhd_1(*this, "vhd1"),
m_beckerport(*this, "dwsock"),
m_beckerportconfig(*this, BECKERPORT_TAG),
m_irqs(*this, "irqs"),
m_firqs(*this, "firqs"),
@ -531,7 +531,7 @@ void coco_state::pia1_cb2_w(int state)
// soundmux_status
//-------------------------------------------------
coco_state::soundmux_status_t coco_state::soundmux_status(void)
coco_state::soundmux_status_t coco_state::soundmux_status()
{
return (soundmux_status_t) (
(snden() ? SOUNDMUX_ENABLE : 0) |
@ -545,7 +545,7 @@ coco_state::soundmux_status_t coco_state::soundmux_status(void)
// update_sound
//-------------------------------------------------
void coco_state::update_sound(void)
void coco_state::update_sound()
{
/* determine the sound mux status */
soundmux_status_t status = soundmux_status();
@ -607,7 +607,7 @@ coco_state::joystick_type_t coco_state::joystick_type(int index)
// hires_interface_type
//-------------------------------------------------
coco_state::hires_type_t coco_state::hires_interface_type(void)
coco_state::hires_type_t coco_state::hires_interface_type()
{
return m_joystick_hires_control
? (hires_type_t) m_joystick_hires_control->read()
@ -650,7 +650,7 @@ bool coco_state::is_joystick_hires(int joystick_index)
// poll_joystick
//-------------------------------------------------
bool coco_state::poll_joystick(void)
bool coco_state::poll_joystick()
{
static const analog_input_t s_empty = {};
static const int joy_rat_table[] = {15, 24, 42, 33 };
@ -709,7 +709,7 @@ bool coco_state::poll_joystick(void)
// poll_joystick_buttons
//-------------------------------------------------
uint8_t coco_state::poll_joystick_buttons(void)
uint8_t coco_state::poll_joystick_buttons()
{
static const analog_input_t s_empty = {};
const analog_input_t *analog;
@ -765,7 +765,7 @@ uint8_t coco_state::poll_joystick_buttons(void)
// poll_keyboard
//-------------------------------------------------
void coco_state::poll_keyboard(void)
void coco_state::poll_keyboard()
{
uint8_t pia0_pb = pia_0().b_output();
@ -830,7 +830,7 @@ void coco_state::update_cassout(int cassout)
// lightgun undergoes a clock transition
//-------------------------------------------------
void coco_state::diecom_lightgun_clock(void)
void coco_state::diecom_lightgun_clock()
{
m_dclg_state++;
m_dclg_state &= 0x1f;
@ -959,7 +959,7 @@ INPUT_CHANGED_MEMBER(coco_state::joystick_mode_changed)
// poll_hires_joystick
//-------------------------------------------------
void coco_state::poll_hires_joystick(void)
void coco_state::poll_hires_joystick()
{
bool newvalue;
bool is_cocomax3;

View File

@ -13,17 +13,20 @@
#pragma once
#include "imagedev/cassette.h"
#include "bus/rs232/rs232.h"
#include "machine/6821pia.h"
#include "bus/coco/cococart.h"
#include "coco_vhd.h"
#include "bus/coco/coco_dwsock.h"
#include "machine/ram.h"
#include "bus/coco/cococart.h"
#include "bus/rs232/rs232.h"
#include "imagedev/cassette.h"
#include "machine/6821pia.h"
#include "machine/bankdev.h"
#include "sound/dac.h"
#include "screen.h"
#include "machine/input_merger.h"
#include "machine/ram.h"
#include "sound/dac.h"
#include "screen.h"
//**************************************************************************
// MACROS / CONSTANTS
@ -41,17 +44,7 @@ void coco_cart(device_slot_interface &device);
// devices
#define MAINCPU_TAG "maincpu"
#define PIA0_TAG "pia0"
#define PIA1_TAG "pia1"
#define SAM_TAG "sam"
#define VDG_TAG "vdg"
#define SCREEN_TAG "screen"
#define CARTRIDGE_TAG "ext"
#define RS232_TAG "rs232"
#define DWSOCK_TAG "dwsock"
#define VHD0_TAG "vhd0"
#define VHD1_TAG "vhd1"
#define FLOATING_TAG "floating"
// inputs
#define CTRL_SEL_TAG "ctrl_sel"
@ -180,31 +173,31 @@ protected:
ioport_port *m_buttons{};
uint32_t input(int joystick, int axis) const { return m_input[joystick][axis] ? m_input[joystick][axis]->read() : 0x00; }
uint8_t buttons(void) const { return m_buttons ? m_buttons->read() : 0x00; }
uint8_t buttons() const { return m_buttons ? m_buttons->read() : 0x00; }
};
void analog_port_start(analog_input_t *analog, const char *rx_tag, const char *ry_tag, const char *lx_tag, const char *ly_tag, const char *buttons_tag);
// wrappers for configuration
joystick_type_t joystick_type(int index);
hires_type_t hires_interface_type(void);
hires_type_t hires_interface_type();
bool is_joystick_hires(int joystick_index);
soundmux_status_t soundmux_status(void);
void update_sound(void);
bool poll_joystick(void);
uint8_t poll_joystick_buttons(void);
void poll_keyboard(void);
void poll_hires_joystick(void);
soundmux_status_t soundmux_status();
void update_sound();
bool poll_joystick();
uint8_t poll_joystick_buttons();
void poll_keyboard();
void poll_hires_joystick();
void update_cassout(int cassout);
void update_prinout(bool prinout);
void diecom_lightgun_clock(void);
void diecom_lightgun_clock();
// thin wrappers for PIA output
uint8_t dac_output(void) { return m_dac_output; } // PA drives the DAC
bool sel1(void) { return m_pia_0->ca2_output() ? true : false; }
bool sel2(void) { return m_pia_0->cb2_output() ? true : false; }
bool snden(void) { return m_pia_1->cb2_output() ? true : false; }
uint8_t dac_output() { return m_dac_output; } // PA drives the DAC
bool sel1() { return m_pia_0->ca2_output() ? true : false; }
bool sel2() { return m_pia_0->cb2_output() ? true : false; }
bool snden() { return m_pia_1->cb2_output() ? true : false; }
// VHD selection
coco_vhd_image_device *current_vhd();

View File

@ -75,13 +75,13 @@ void deluxecoco_state::deluxecoco_rom2(address_map &map)
void coco12_state::coco_io0(address_map &map)
{
// $FF00-$FF1F
map(0x00, 0x03).mirror(0x1c).rw(PIA0_TAG, FUNC(pia6821_device::read), FUNC(pia6821_device::write));
map(0x00, 0x03).mirror(0x1c).rw(m_pia_0, FUNC(pia6821_device::read), FUNC(pia6821_device::write));
}
void coco12_state::coco_io1(address_map &map)
{
// $FF20-$FF3F
map(0x00, 0x03).mirror(0x1c).r(PIA1_TAG, FUNC(pia6821_device::read)).w(FUNC(coco12_state::ff20_write));
map(0x00, 0x03).mirror(0x1c).r(m_pia_1, FUNC(pia6821_device::read)).w(FUNC(coco12_state::ff20_write));
}
void coco12_state::coco_io2(address_map &map)
@ -106,7 +106,7 @@ void coco12_state::ms1600_rom2(address_map &map)
void deluxecoco_state::deluxecoco_io1(address_map &map)
{
// $FF20-$FF3F
map(0x00, 0x03).r(PIA1_TAG, FUNC(pia6821_device::read)).w(FUNC(coco12_state::ff20_write));
map(0x00, 0x03).r(m_pia_1, FUNC(pia6821_device::read)).w(FUNC(coco12_state::ff20_write));
map(0x10, 0x10).w(FUNC(deluxecoco_state::ff30_write));
map(0x18, 0x19).w(m_psg, FUNC(ay8913_device::data_address_w));
map(0x1c, 0x1f).rw(m_acia, FUNC(mos6551_device::read), FUNC(mos6551_device::write));
@ -451,7 +451,7 @@ void coco_state::coco_floating_map(address_map &map)
void coco_state::coco_floating(machine_config &config)
{
ADDRESS_MAP_BANK(config, FLOATING_TAG).set_map(&coco_state::coco_floating_map).set_options(ENDIANNESS_BIG, 8, 16);
ADDRESS_MAP_BANK(config, m_floating).set_map(&coco_state::coco_floating_map).set_options(ENDIANNESS_BIG, 8, 16);
}
@ -497,24 +497,24 @@ void coco12_state::coco(machine_config &config)
INPUT_MERGER_ANY_HIGH(config, m_irqs).output_handler().set_inputline(m_maincpu, M6809_IRQ_LINE);
INPUT_MERGER_ANY_HIGH(config, m_firqs).output_handler().set_inputline(m_maincpu, M6809_FIRQ_LINE);
pia6821_device &pia0(PIA6821(config, PIA0_TAG));
pia0.writepa_handler().set(FUNC(coco_state::pia0_pa_w));
pia0.writepb_handler().set(FUNC(coco_state::pia0_pb_w));
pia0.tspb_handler().set_constant(0xff);
pia0.ca2_handler().set(FUNC(coco_state::pia0_ca2_w));
pia0.cb2_handler().set(FUNC(coco_state::pia0_cb2_w));
pia0.irqa_handler().set(m_irqs, FUNC(input_merger_device::in_w<0>));
pia0.irqb_handler().set(m_irqs, FUNC(input_merger_device::in_w<1>));
PIA6821(config, m_pia_0);
m_pia_0->writepa_handler().set(FUNC(coco_state::pia0_pa_w));
m_pia_0->writepb_handler().set(FUNC(coco_state::pia0_pb_w));
m_pia_0->tspb_handler().set_constant(0xff);
m_pia_0->ca2_handler().set(FUNC(coco_state::pia0_ca2_w));
m_pia_0->cb2_handler().set(FUNC(coco_state::pia0_cb2_w));
m_pia_0->irqa_handler().set(m_irqs, FUNC(input_merger_device::in_w<0>));
m_pia_0->irqb_handler().set(m_irqs, FUNC(input_merger_device::in_w<1>));
pia6821_device &pia1(PIA6821(config, PIA1_TAG));
pia1.readpa_handler().set(FUNC(coco_state::pia1_pa_r));
pia1.readpb_handler().set(FUNC(coco_state::pia1_pb_r));
pia1.writepa_handler().set(FUNC(coco_state::pia1_pa_w));
pia1.writepb_handler().set(FUNC(coco_state::pia1_pb_w));
pia1.ca2_handler().set(FUNC(coco_state::pia1_ca2_w));
pia1.cb2_handler().set(FUNC(coco_state::pia1_cb2_w));
pia1.irqa_handler().set(m_firqs, FUNC(input_merger_device::in_w<0>));
pia1.irqb_handler().set(m_firqs, FUNC(input_merger_device::in_w<1>));
PIA6821(config, m_pia_1);
m_pia_1->readpa_handler().set(FUNC(coco_state::pia1_pa_r));
m_pia_1->readpb_handler().set(FUNC(coco_state::pia1_pb_r));
m_pia_1->writepa_handler().set(FUNC(coco_state::pia1_pa_w));
m_pia_1->writepb_handler().set(FUNC(coco_state::pia1_pb_w));
m_pia_1->ca2_handler().set(FUNC(coco_state::pia1_ca2_w));
m_pia_1->cb2_handler().set(FUNC(coco_state::pia1_cb2_w));
m_pia_1->irqa_handler().set(m_firqs, FUNC(input_merger_device::in_w<0>));
m_pia_1->irqb_handler().set(m_firqs, FUNC(input_merger_device::in_w<1>));
SAM6883(config, m_sam, XTAL(14'318'181), m_maincpu);
m_sam->set_addrmap(0, &coco12_state::coco_ram);
@ -527,7 +527,7 @@ void coco12_state::coco(machine_config &config)
m_sam->set_addrmap(7, &coco12_state::coco_ff60);
// Becker Port device
COCO_DWSOCK(config, DWSOCK_TAG, 0);
COCO_DWSOCK(config, m_beckerport, 0);
// sound hardware
coco_sound(config);
@ -537,14 +537,14 @@ void coco12_state::coco(machine_config &config)
m_cassette->set_default_state(CASSETTE_PLAY | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED);
rs232_port_device &rs232(RS232_PORT(config, RS232_TAG, default_rs232_devices, "rs_printer"));
rs232.dcd_handler().set(PIA1_TAG, FUNC(pia6821_device::ca1_w));
rs232.dcd_handler().set(m_pia_1, FUNC(pia6821_device::ca1_w));
rs232.set_option_device_input_defaults("rs_printer", DEVICE_INPUT_DEFAULTS_NAME(rs_printer));
// video hardware
SCREEN(config, "screen", SCREEN_TYPE_RASTER);
SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
MC6847_NTSC(config, m_vdg, XTAL(14'318'181) / 4); // VClk output from MC6883
m_vdg->set_screen("screen");
m_vdg->set_screen(m_screen);
m_vdg->hsync_wr_callback().set(FUNC(coco12_state::horizontal_sync));
m_vdg->fsync_wr_callback().set(FUNC(coco12_state::field_sync));
m_vdg->input_callback().set(FUNC(coco12_state::sam_read));
@ -556,10 +556,10 @@ void coco12_state::coco(machine_config &config)
coco_floating(config);
// cartridge
cococart_slot_device &cartslot(COCOCART_SLOT(config, CARTRIDGE_TAG, DERIVED_CLOCK(1, 1), coco_cart, "fdc"));
cartslot.cart_callback().set([this] (int state) { cart_w(state != 0); }); // lambda because name is overloaded
cartslot.nmi_callback().set_inputline(m_maincpu, INPUT_LINE_NMI);
cartslot.halt_callback().set_inputline(m_maincpu, INPUT_LINE_HALT);
COCOCART_SLOT(config, m_cococart, DERIVED_CLOCK(1, 1), coco_cart, "fdc");
m_cococart->cart_callback().set([this] (int state) { cart_w(state != 0); }); // lambda because name is overloaded
m_cococart->nmi_callback().set_inputline(m_maincpu, INPUT_LINE_NMI);
m_cococart->halt_callback().set_inputline(m_maincpu, INPUT_LINE_HALT);
// software lists
SOFTWARE_LIST(config, "coco_cart_list").set_original("coco_cart").set_filter("COCO");
@ -574,13 +574,14 @@ void coco12_state::coco(machine_config &config)
void coco12_state::cocoh(machine_config &config)
{
coco(config);
HD6309E(config.replace(), m_maincpu, DERIVED_CLOCK(1, 1));
m_maincpu->set_addrmap(AS_PROGRAM, &coco12_state::coco_mem);
}
void deluxecoco_state::deluxecoco(machine_config &config)
{
coco12_state::coco2b(config);
coco2b(config);
// Asynchronous Communications Interface Adapter
MOS6551(config, m_acia, 0);
@ -609,14 +610,15 @@ void deluxecoco_state::deluxecoco(machine_config &config)
m_sam->set_addrmap(5, &deluxecoco_state::deluxecoco_io1);
// Configure Timer
TIMER(config, TIMER_TAG).configure_generic(FUNC(deluxecoco_state::perodic_timer));
TIMER(config, m_timer).configure_generic(FUNC(deluxecoco_state::perodic_timer));
}
void coco12_state::coco2b(machine_config &config)
{
coco(config);
MC6847T1_NTSC(config.replace(), m_vdg, XTAL(14'318'181) / 4);
m_vdg->set_screen(SCREEN_TAG);
m_vdg->set_screen(m_screen);
m_vdg->hsync_wr_callback().set(FUNC(coco12_state::horizontal_sync));
m_vdg->fsync_wr_callback().set(FUNC(coco12_state::field_sync));
m_vdg->input_callback().set(FUNC(coco12_state::sam_read));
@ -625,6 +627,7 @@ void coco12_state::coco2b(machine_config &config)
void coco12_state::coco2bh(machine_config &config)
{
coco2b(config);
HD6309E(config.replace(), m_maincpu, DERIVED_CLOCK(1, 1));
m_maincpu->set_addrmap(AS_PROGRAM, &coco12_state::coco_mem);
}
@ -632,34 +635,31 @@ void coco12_state::coco2bh(machine_config &config)
void coco12_state::cp400(machine_config &config)
{
coco(config);
cococart_slot_device &cartslot(COCOCART_SLOT(config.replace(), CARTRIDGE_TAG, DERIVED_CLOCK(1, 1), coco_cart, "cp450_fdc"));
cartslot.cart_callback().set([this] (int state) { cart_w(state != 0); }); // lambda because name is overloaded
cartslot.nmi_callback().set_inputline(m_maincpu, INPUT_LINE_NMI);
cartslot.halt_callback().set_inputline(m_maincpu, INPUT_LINE_HALT);
m_cococart->set_default_option("cp450_fdc");
}
void coco12_state::t4426(machine_config &config)
{
coco(config);
cococart_slot_device &cartslot(COCOCART_SLOT(config.replace(), CARTRIDGE_TAG, DERIVED_CLOCK(1, 1), t4426_cart, "t4426"));
cartslot.cart_callback().set([this] (int state) { cart_w(state != 0); }); // lambda because name is overloaded
cartslot.nmi_callback().set_inputline(m_maincpu, INPUT_LINE_NMI);
cartslot.halt_callback().set_inputline(m_maincpu, INPUT_LINE_HALT);
cartslot.set_fixed(true); // This cart is fixed so no way to change it
m_cococart->option_reset();
t4426_cart(*m_cococart);
m_cococart->set_default_option("t4426");
m_cococart->set_fixed(true); // This cart is fixed so no way to change it
}
void coco12_state::cd6809(machine_config &config)
{
coco(config);
cococart_slot_device &cartslot(COCOCART_SLOT(config.replace(), CARTRIDGE_TAG, DERIVED_CLOCK(1, 1), coco_cart, "cd6809_fdc"));
cartslot.cart_callback().set([this] (int state) { cart_w(state != 0); }); // lambda because name is overloaded
cartslot.nmi_callback().set_inputline(m_maincpu, INPUT_LINE_NMI);
cartslot.halt_callback().set_inputline(m_maincpu, INPUT_LINE_HALT);
m_cococart->set_default_option("cd6809_fdc");
}
void coco12_state::ms1600(machine_config &config)
{
coco(config);
m_sam->set_addrmap(3, &coco12_state::ms1600_rom2);
}

View File

@ -14,6 +14,7 @@
#pragma once
#include "coco.h"
#include "machine/6883sam.h"
#include "machine/mos6551.h"
#include "machine/timer.h"
@ -26,14 +27,7 @@
// MACROS / CONSTANTS
//**************************************************************************
#define SAM_TAG "sam"
#define VDG_TAG "vdg"
#define MOSACIA_TAG "mosacia"
#define ACIA_TAG "acia"
#define PSG_TAG "psg"
#define TIMER_TAG "timer"
#define RAM_VIEW "ram_view"
#define ROM_VIEW "rom_view"
//**************************************************************************
@ -45,8 +39,8 @@ class coco12_state : public coco_state
public:
coco12_state(const machine_config &mconfig, device_type type, const char *tag)
: coco_state(mconfig, type, tag)
, m_sam(*this, SAM_TAG)
, m_vdg(*this, VDG_TAG)
, m_sam(*this, "sam")
, m_vdg(*this, "vdg")
{
}
@ -66,7 +60,7 @@ public:
protected:
virtual void device_start() override;
void configure_sam(void);
void configure_sam();
// PIA1
virtual void pia1_pb_changed(uint8_t data) override;
@ -94,11 +88,11 @@ class deluxecoco_state : public coco12_state
public:
deluxecoco_state(const machine_config &mconfig, device_type type, const char *tag)
: coco12_state(mconfig, type, tag)
, m_acia(*this, MOSACIA_TAG)
, m_psg(*this, PSG_TAG)
, m_timer(*this, TIMER_TAG)
, m_ram_view(*this, RAM_VIEW)
, m_rom_view(*this, ROM_VIEW)
, m_acia(*this, "mosacia")
, m_psg(*this, "psg")
, m_timer(*this, "timer")
, m_ram_view(*this, "ram_view")
, m_rom_view(*this, "rom_view")
{
}
@ -107,7 +101,7 @@ public:
protected:
virtual void device_start() override;
void configure_sam(void);
void configure_sam();
void deluxecoco_rom2(address_map &map);
void deluxecoco_io1(address_map &map);

View File

@ -128,19 +128,16 @@ void deluxecoco_state::configure_sam()
void deluxecoco_state::ff30_write(offs_t offset, uint8_t data)
{
if(offset==0)
if (offset == 0)
{
if((data & 0x04) == 0x04)
if (BIT(data, 2))
m_ram_view.select(data & 0x03);
else
m_ram_view.disable();
if((data & 0x80) == 0x80)
m_rom_view.select(1);
else
m_rom_view.select(0);
m_rom_view.select(BIT(data, 7));
if((data & 0x40) == 0x40)
if (BIT(data, 6))
{
m_timer->adjust(attotime::from_hz(60));
}

View File

@ -13,12 +13,16 @@
***************************************************************************/
#include "emu.h"
#include "coco3.h"
#include "cpu/m6809/m6809.h"
#include "cpu/m6809/hd6309.h"
#include "formats/coco_cas.h"
#include "softlist_dev.h"
#include "formats/coco_cas.h"
//**************************************************************************
@ -40,8 +44,8 @@ void coco3_state::coco3_mem(address_map &map)
map(0xC000, 0xDFFF).bankr("rbank6").bankw("wbank6");
map(0xE000, 0xFDFF).bankr("rbank7").bankw("wbank7");
map(0xFE00, 0xFEFF).bankr("rbank8").bankw("wbank8");
map(0xFF00, 0xFF0F).rw(PIA0_TAG, FUNC(pia6821_device::read), FUNC(pia6821_device::write));
map(0xFF20, 0xFF2F).r(PIA1_TAG, FUNC(pia6821_device::read)).w(FUNC(coco3_state::ff20_write));
map(0xFF00, 0xFF0F).rw(m_pia_0, FUNC(pia6821_device::read), FUNC(pia6821_device::write));
map(0xFF20, 0xFF2F).r(m_pia_1, FUNC(pia6821_device::read)).w(FUNC(coco3_state::ff20_write));
map(0xFF40, 0xFF5F).rw(FUNC(coco3_state::ff40_read), FUNC(coco3_state::ff40_write));
map(0xFF60, 0xFF8F).rw(FUNC(coco3_state::ff60_read), FUNC(coco3_state::ff60_write));
map(0xFF90, 0xFFDF).rw(m_gime, FUNC(gime_device::read), FUNC(gime_device::write));
@ -260,27 +264,27 @@ void coco3_state::coco3(machine_config &config)
INPUT_MERGER_ANY_HIGH(config, m_irqs).output_handler().set_inputline(m_maincpu, M6809_IRQ_LINE);
INPUT_MERGER_ANY_HIGH(config, m_firqs).output_handler().set_inputline(m_maincpu, M6809_FIRQ_LINE);
pia6821_device &pia0(PIA6821(config, PIA0_TAG));
pia0.writepa_handler().set(FUNC(coco_state::pia0_pa_w));
pia0.writepb_handler().set(FUNC(coco_state::pia0_pb_w));
pia0.tspb_handler().set_constant(0xff);
pia0.ca2_handler().set(FUNC(coco_state::pia0_ca2_w));
pia0.cb2_handler().set(FUNC(coco_state::pia0_cb2_w));
pia0.irqa_handler().set(m_irqs, FUNC(input_merger_device::in_w<0>));
pia0.irqb_handler().set(m_irqs, FUNC(input_merger_device::in_w<1>));
PIA6821(config, m_pia_0);
m_pia_0->writepa_handler().set(FUNC(coco_state::pia0_pa_w));
m_pia_0->writepb_handler().set(FUNC(coco_state::pia0_pb_w));
m_pia_0->tspb_handler().set_constant(0xff);
m_pia_0->ca2_handler().set(FUNC(coco_state::pia0_ca2_w));
m_pia_0->cb2_handler().set(FUNC(coco_state::pia0_cb2_w));
m_pia_0->irqa_handler().set(m_irqs, FUNC(input_merger_device::in_w<0>));
m_pia_0->irqb_handler().set(m_irqs, FUNC(input_merger_device::in_w<1>));
pia6821_device &pia1(PIA6821(config, PIA1_TAG));
pia1.readpa_handler().set(FUNC(coco_state::pia1_pa_r));
pia1.readpb_handler().set(FUNC(coco_state::pia1_pb_r));
pia1.writepa_handler().set(FUNC(coco_state::pia1_pa_w));
pia1.writepb_handler().set(FUNC(coco_state::pia1_pb_w));
pia1.ca2_handler().set(FUNC(coco_state::pia1_ca2_w));
pia1.cb2_handler().set(FUNC(coco_state::pia1_cb2_w));
pia1.irqa_handler().set(m_firqs, FUNC(input_merger_device::in_w<0>));
pia1.irqb_handler().set(m_firqs, FUNC(input_merger_device::in_w<1>));
PIA6821(config, m_pia_1);
m_pia_1->readpa_handler().set(FUNC(coco_state::pia1_pa_r));
m_pia_1->readpb_handler().set(FUNC(coco_state::pia1_pb_r));
m_pia_1->writepa_handler().set(FUNC(coco_state::pia1_pa_w));
m_pia_1->writepb_handler().set(FUNC(coco_state::pia1_pb_w));
m_pia_1->ca2_handler().set(FUNC(coco_state::pia1_ca2_w));
m_pia_1->cb2_handler().set(FUNC(coco_state::pia1_cb2_w));
m_pia_1->irqa_handler().set(m_firqs, FUNC(input_merger_device::in_w<0>));
m_pia_1->irqb_handler().set(m_firqs, FUNC(input_merger_device::in_w<1>));
// Becker Port device
COCO_DWSOCK(config, DWSOCK_TAG, 0);
COCO_DWSOCK(config, m_beckerport, 0);
// sound hardware
coco_sound(config);
@ -290,17 +294,17 @@ void coco3_state::coco3(machine_config &config)
m_cassette->set_default_state(CASSETTE_PLAY | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED);
rs232_port_device &rs232(RS232_PORT(config, RS232_TAG, default_rs232_devices, "rs_printer"));
rs232.dcd_handler().set(PIA1_TAG, FUNC(pia6821_device::ca1_w));
rs232.dcd_handler().set(m_pia_1, FUNC(pia6821_device::ca1_w));
rs232.set_option_device_input_defaults("rs_printer", DEVICE_INPUT_DEFAULTS_NAME(rs_printer));
COCO_VHD(config, m_vhd_0, 0, m_maincpu);
COCO_VHD(config, m_vhd_1, 0, m_maincpu);
// video hardware
GIME_NTSC(config, m_gime, XTAL(28'636'363), MAINCPU_TAG, RAM_TAG, CARTRIDGE_TAG, MAINCPU_TAG);
GIME_NTSC(config, m_gime, XTAL(28'636'363), MAINCPU_TAG, RAM_TAG, m_cococart, MAINCPU_TAG);
m_gime->set_screen("screen");
m_gime->hsync_wr_callback().set(PIA0_TAG, FUNC(pia6821_device::ca1_w));
m_gime->fsync_wr_callback().set(PIA0_TAG, FUNC(pia6821_device::cb1_w));
m_gime->hsync_wr_callback().set(m_pia_0, FUNC(pia6821_device::ca1_w));
m_gime->fsync_wr_callback().set(m_pia_0, FUNC(pia6821_device::cb1_w));
m_gime->irq_wr_callback().set(m_irqs, FUNC(input_merger_device::in_w<2>));
m_gime->firq_wr_callback().set(m_firqs, FUNC(input_merger_device::in_w<2>));
m_gime->floating_bus_rd_callback().set(FUNC(coco3_state::floating_bus_r));
@ -317,10 +321,10 @@ void coco3_state::coco3(machine_config &config)
coco_floating(config);
// cartridge
cococart_slot_device &cartslot(COCOCART_SLOT(config, CARTRIDGE_TAG, DERIVED_CLOCK(1, 1), coco_cart, "fdc"));
cartslot.cart_callback().set([this] (int state) { cart_w(state != 0); }); // lambda because name is overloaded
cartslot.nmi_callback().set_inputline(m_maincpu, INPUT_LINE_NMI);
cartslot.halt_callback().set_inputline(m_maincpu, INPUT_LINE_HALT);
COCOCART_SLOT(config, m_cococart, DERIVED_CLOCK(1, 1), coco_cart, "fdc");
m_cococart->cart_callback().set([this] (int state) { cart_w(state != 0); }); // lambda because name is overloaded
m_cococart->nmi_callback().set_inputline(m_maincpu, INPUT_LINE_NMI);
m_cococart->halt_callback().set_inputline(m_maincpu, INPUT_LINE_HALT);
// software lists
SOFTWARE_LIST(config, "cart_list").set_original("coco_cart").set_filter("COCO3");
@ -334,10 +338,10 @@ void coco3_state::coco3p(machine_config &config)
this->set_clock(XTAL(28'475'000) / 32);
// An additional 4.433618 MHz XTAL is required for PAL color encoding
GIME_PAL(config.replace(), m_gime, XTAL(28'475'000), MAINCPU_TAG, RAM_TAG, CARTRIDGE_TAG, MAINCPU_TAG);
GIME_PAL(config.replace(), m_gime, XTAL(28'475'000), MAINCPU_TAG, RAM_TAG, m_cococart, MAINCPU_TAG);
m_gime->set_screen("screen");
m_gime->hsync_wr_callback().set(PIA0_TAG, FUNC(pia6821_device::ca1_w));
m_gime->fsync_wr_callback().set(PIA0_TAG, FUNC(pia6821_device::cb1_w));
m_gime->hsync_wr_callback().set(m_pia_0, FUNC(pia6821_device::ca1_w));
m_gime->fsync_wr_callback().set(m_pia_0, FUNC(pia6821_device::cb1_w));
m_gime->irq_wr_callback().set(m_irqs, FUNC(input_merger_device::in_w<2>));
m_gime->firq_wr_callback().set(m_firqs, FUNC(input_merger_device::in_w<2>));
m_gime->floating_bus_rd_callback().set(FUNC(coco3_state::floating_bus_r));

View File

@ -17,14 +17,6 @@
#include "gime.h"
//**************************************************************************
// MACROS / CONSTANTS
//**************************************************************************
#define GIME_TAG "gime"
#define VDG_TAG "vdg"
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
@ -34,8 +26,10 @@ class coco3_state : public coco_state
public:
coco3_state(const machine_config &mconfig, device_type type, const char *tag)
: coco_state(mconfig, type, tag)
, m_gime(*this, GIME_TAG)
, m_screen_config(*this, "screen_config") { }
, m_gime(*this, "gime")
, m_screen_config(*this, "screen_config")
{
}
virtual void ff20_write(offs_t offset, uint8_t data) override;
virtual uint8_t ff40_read(offs_t offset) override;

View File

@ -144,7 +144,7 @@ private:
void dragon_alpha_state::dgnalpha_io1(address_map &map)
{
// $FF20-$FF3F
map(0x00, 0x03).mirror(0x10).r(PIA1_TAG, FUNC(pia6821_device::read)).w(FUNC(coco12_state::ff20_write));
map(0x00, 0x03).mirror(0x10).r(m_pia_1, FUNC(pia6821_device::read)).w(FUNC(coco12_state::ff20_write));
map(0x04, 0x07).mirror(0x10).rw(m_pia_2, FUNC(pia6821_device::read), FUNC(pia6821_device::write));
map(0x08, 0x0b).mirror(0x10).rw(FUNC(dragon_alpha_state::modem_r), FUNC(dragon_alpha_state::modem_w));
map(0x0c, 0x0c).mirror(0x10).rw(m_fdc, FUNC(wd2797_device::data_r), FUNC(wd2797_device::data_w));
@ -335,10 +335,10 @@ void dragon_alpha_state::dgnalpha(machine_config &config)
INPUT_MERGER_ANY_HIGH(config, m_nmis).output_handler().set_inputline(m_maincpu, INPUT_LINE_NMI);
// cartridge
cococart_slot_device &cartslot(COCOCART_SLOT(config, CARTRIDGE_TAG, DERIVED_CLOCK(1, 1), &dragon_alpha_state::dragon_cart, nullptr));
cartslot.cart_callback().set([this] (int state) { cart_w(state != 0); }); // lambda because name is overloaded
cartslot.nmi_callback().set(m_nmis, FUNC(input_merger_device::in_w<0>));
cartslot.halt_callback().set_inputline(m_maincpu, INPUT_LINE_HALT);
COCOCART_SLOT(config, m_cococart, DERIVED_CLOCK(1, 1), &dragon_alpha_state::dragon_cart, nullptr);
m_cococart->cart_callback().set([this] (int state) { cart_w(state != 0); }); // lambda because name is overloaded
m_cococart->nmi_callback().set(m_nmis, FUNC(input_merger_device::in_w<0>));
m_cococart->halt_callback().set_inputline(m_maincpu, INPUT_LINE_HALT);
// acia
mos6551_device &acia(MOS6551(config, "acia", 0));

View File

@ -309,7 +309,7 @@ void dragon64_state::d64_rom1(address_map &map)
void dragon64_state::d64_io0(address_map &map)
{
// $FF00-$FF1F
map(0x00, 0x03).mirror(0x18).rw(PIA0_TAG, FUNC(pia6821_device::read), FUNC(pia6821_device::write));
map(0x00, 0x03).mirror(0x18).rw(m_pia_0, FUNC(pia6821_device::read), FUNC(pia6821_device::write));
map(0x04, 0x07).mirror(0x18).rw(m_acia, FUNC(mos6551_device::read), FUNC(mos6551_device::write));
}
@ -477,24 +477,24 @@ void dragon_state::dragon_base(machine_config &config)
INPUT_MERGER_ANY_HIGH(config, m_irqs).output_handler().set_inputline(m_maincpu, M6809_IRQ_LINE);
INPUT_MERGER_ANY_HIGH(config, m_firqs).output_handler().set_inputline(m_maincpu, M6809_FIRQ_LINE);
pia6821_device &pia0(PIA6821(config, PIA0_TAG));
pia0.writepa_handler().set(FUNC(coco_state::pia0_pa_w));
pia0.writepb_handler().set(FUNC(coco_state::pia0_pb_w));
pia0.tspb_handler().set_constant(0xff);
pia0.ca2_handler().set(FUNC(coco_state::pia0_ca2_w));
pia0.cb2_handler().set(FUNC(coco_state::pia0_cb2_w));
pia0.irqa_handler().set(m_irqs, FUNC(input_merger_device::in_w<0>));
pia0.irqb_handler().set(m_irqs, FUNC(input_merger_device::in_w<1>));
PIA6821(config, m_pia_0);
m_pia_0->writepa_handler().set(FUNC(coco_state::pia0_pa_w));
m_pia_0->writepb_handler().set(FUNC(coco_state::pia0_pb_w));
m_pia_0->tspb_handler().set_constant(0xff);
m_pia_0->ca2_handler().set(FUNC(coco_state::pia0_ca2_w));
m_pia_0->cb2_handler().set(FUNC(coco_state::pia0_cb2_w));
m_pia_0->irqa_handler().set(m_irqs, FUNC(input_merger_device::in_w<0>));
m_pia_0->irqb_handler().set(m_irqs, FUNC(input_merger_device::in_w<1>));
pia6821_device &pia1(PIA6821(config, PIA1_TAG));
pia1.readpa_handler().set(FUNC(coco_state::pia1_pa_r));
pia1.readpb_handler().set(FUNC(coco_state::pia1_pb_r));
pia1.writepa_handler().set(FUNC(coco_state::pia1_pa_w));
pia1.writepb_handler().set(FUNC(coco_state::pia1_pb_w));
pia1.ca2_handler().set(FUNC(coco_state::pia1_ca2_w));
pia1.cb2_handler().set(FUNC(coco_state::pia1_cb2_w));
pia1.irqa_handler().set(m_firqs, FUNC(input_merger_device::in_w<0>));
pia1.irqb_handler().set(m_firqs, FUNC(input_merger_device::in_w<1>));
PIA6821(config, m_pia_1);
m_pia_1->readpa_handler().set(FUNC(coco_state::pia1_pa_r));
m_pia_1->readpb_handler().set(FUNC(coco_state::pia1_pb_r));
m_pia_1->writepa_handler().set(FUNC(coco_state::pia1_pa_w));
m_pia_1->writepb_handler().set(FUNC(coco_state::pia1_pb_w));
m_pia_1->ca2_handler().set(FUNC(coco_state::pia1_ca2_w));
m_pia_1->cb2_handler().set(FUNC(coco_state::pia1_cb2_w));
m_pia_1->irqa_handler().set(m_firqs, FUNC(input_merger_device::in_w<0>));
m_pia_1->irqb_handler().set(m_firqs, FUNC(input_merger_device::in_w<1>));
SAM6883(config, m_sam, 14.218_MHz_XTAL, m_maincpu);
m_sam->set_addrmap(0, &dragon_state::coco_ram);
@ -514,10 +514,10 @@ void dragon_state::dragon_base(machine_config &config)
PRINTER(config, m_printer, 0);
// video hardware
SCREEN(config, SCREEN_TAG, SCREEN_TYPE_RASTER);
SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
MC6847_PAL(config, m_vdg, 14.218_MHz_XTAL / 4);
m_vdg->set_screen(SCREEN_TAG);
m_vdg->set_screen(m_screen);
m_vdg->hsync_wr_callback().set(FUNC(dragon_state::horizontal_sync));
m_vdg->fsync_wr_callback().set(FUNC(dragon_state::field_sync));
m_vdg->input_callback().set(FUNC(dragon_state::sam_read));
@ -538,19 +538,21 @@ void dragon_state::dragon_base(machine_config &config)
void dragon_state::dragon32(machine_config &config)
{
dragon_base(config);
// internal ram
RAM(config, m_ram).set_default_size("32K").set_extra_options("64K");
// cartridge
cococart_slot_device &cartslot(COCOCART_SLOT(config, CARTRIDGE_TAG, DERIVED_CLOCK(1, 1), &dragon_state::dragon_cart, "dragon_fdc"));
cartslot.cart_callback().set([this] (int state) { cart_w(state != 0); }); // lambda because name is overloaded
cartslot.nmi_callback().set_inputline(m_maincpu, INPUT_LINE_NMI);
cartslot.halt_callback().set_inputline(m_maincpu, INPUT_LINE_HALT);
COCOCART_SLOT(config, m_cococart, DERIVED_CLOCK(1, 1), &dragon_state::dragon_cart, "dragon_fdc");
m_cococart->cart_callback().set([this] (int state) { cart_w(state != 0); }); // lambda because name is overloaded
m_cococart->nmi_callback().set_inputline(m_maincpu, INPUT_LINE_NMI);
m_cococart->halt_callback().set_inputline(m_maincpu, INPUT_LINE_HALT);
}
void dragon64_state::dragon64(machine_config &config)
{
dragon_base(config);
// internal ram
RAM(config, m_ram).set_default_size("64K");
@ -559,10 +561,10 @@ void dragon64_state::dragon64(machine_config &config)
sam().set_addrmap(4, &dragon64_state::d64_io0);
// cartridge
cococart_slot_device &cartslot(COCOCART_SLOT(config, CARTRIDGE_TAG, DERIVED_CLOCK(1, 1), &dragon64_state::dragon_cart, "dragon_fdc"));
cartslot.cart_callback().set([this] (int state) { cart_w(state != 0); }); // lambda because name is overloaded
cartslot.nmi_callback().set_inputline(m_maincpu, INPUT_LINE_NMI);
cartslot.halt_callback().set_inputline(m_maincpu, INPUT_LINE_HALT);
COCOCART_SLOT(config, m_cococart, DERIVED_CLOCK(1, 1), &dragon64_state::dragon_cart, "dragon_fdc");
m_cococart->cart_callback().set([this] (int state) { cart_w(state != 0); }); // lambda because name is overloaded
m_cococart->nmi_callback().set_inputline(m_maincpu, INPUT_LINE_NMI);
m_cococart->halt_callback().set_inputline(m_maincpu, INPUT_LINE_HALT);
// acia
MOS6551(config, m_acia, 0);
@ -627,13 +629,13 @@ void dragon64_state::tanodr64(machine_config &config)
// video hardware
MC6847_NTSC(config.replace(), m_vdg, 14.318181_MHz_XTAL / 4);
m_vdg->set_screen(SCREEN_TAG);
m_vdg->set_screen(m_screen);
m_vdg->hsync_wr_callback().set(FUNC(dragon_state::horizontal_sync));
m_vdg->fsync_wr_callback().set(FUNC(dragon_state::field_sync));
m_vdg->input_callback().set(FUNC(dragon_state::sam_read));
// cartridge
subdevice<cococart_slot_device>(CARTRIDGE_TAG)->set_default_option("sdtandy_fdc");
m_cococart->set_default_option("sdtandy_fdc");
}
void dragon64_state::tanodr64h(machine_config &config)