summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/drivers/tryout.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mame/drivers/tryout.cpp')
-rw-r--r--src/mame/drivers/tryout.cpp32
1 files changed, 16 insertions, 16 deletions
diff --git a/src/mame/drivers/tryout.cpp b/src/mame/drivers/tryout.cpp
index ac8f10ded2e..5a30afd1faf 100644
--- a/src/mame/drivers/tryout.cpp
+++ b/src/mame/drivers/tryout.cpp
@@ -191,23 +191,24 @@ static GFXDECODE_START( gfx_tryout )
GFXDECODE_ENTRY( nullptr, 0, vramlayout, 0, 4 )
GFXDECODE_END
-MACHINE_CONFIG_START(tryout_state::tryout)
+void tryout_state::tryout(machine_config &config)
+{
/* basic machine hardware */
- MCFG_DEVICE_ADD("maincpu", M6502, 2000000) /* ? */
- MCFG_DEVICE_PROGRAM_MAP(main_cpu)
+ M6502(config, m_maincpu, 2000000); /* ? */
+ m_maincpu->set_addrmap(AS_PROGRAM, &tryout_state::main_cpu);
- MCFG_DEVICE_ADD("audiocpu", M6502, 1500000) /* ? */
- MCFG_DEVICE_PROGRAM_MAP(sound_cpu)
- MCFG_DEVICE_PERIODIC_INT_DRIVER(tryout_state, nmi_line_pulse, 1000) /* controls BGM tempo, 1000 is an hand-tuned value to match a side-by-side video */
+ M6502(config, m_audiocpu, 1500000); /* ? */
+ m_audiocpu->set_addrmap(AS_PROGRAM, &tryout_state::sound_cpu);
+ m_audiocpu->set_periodic_int(FUNC(tryout_state::nmi_line_pulse), attotime::from_hz(1000)); /* controls BGM tempo, 1000 is an hand-tuned value to match a side-by-side video */
/* video hardware */
- MCFG_SCREEN_ADD("screen", RASTER)
- MCFG_SCREEN_REFRESH_RATE(60)
- MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */)
- MCFG_SCREEN_SIZE(256, 256)
- MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 1*8, 31*8-1)
- MCFG_SCREEN_UPDATE_DRIVER(tryout_state, screen_update)
- MCFG_SCREEN_PALETTE(m_palette)
+ screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
+ screen.set_refresh_hz(60);
+ screen.set_vblank_time(ATTOSECONDS_IN_USEC(2500) /* not accurate */);
+ screen.set_size(256, 256);
+ screen.set_visarea(0*8, 32*8-1, 1*8, 31*8-1);
+ screen.set_screen_update(FUNC(tryout_state::screen_update));
+ screen.set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_tryout);
PALETTE(config, m_palette, FUNC(tryout_state::tryout_palette), 0x20);
@@ -217,9 +218,8 @@ MACHINE_CONFIG_START(tryout_state::tryout)
GENERIC_LATCH_8(config, m_soundlatch);
- MCFG_DEVICE_ADD("ymsnd", YM2203, 1500000)
- MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
-MACHINE_CONFIG_END
+ YM2203(config, "ymsnd", 1500000).add_route(ALL_OUTPUTS, "mono", 0.50);
+}
ROM_START( tryout )
ROM_REGION( 0x14000, "maincpu", 0 )
href='#n173'>173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213
// license:BSD-3-Clause
// copyright-holders:R. Belmont
/***************************************************************************

  a1bus.c - Apple I slot bus and card emulation

***************************************************************************/

#include "emu.h"
#include "a1bus.h"


//**************************************************************************
//  GLOBAL VARIABLES
//**************************************************************************

DEFINE_DEVICE_TYPE(A1BUS_SLOT, a1bus_slot_device, "a1bus_slot", "Apple I Slot")

//**************************************************************************
//  LIVE DEVICE
//**************************************************************************

//-------------------------------------------------
//  a1bus_slot_device - constructor
//-------------------------------------------------
a1bus_slot_device::a1bus_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
	: a1bus_slot_device(mconfig, A1BUS_SLOT, tag, owner, clock)
{
}

a1bus_slot_device::a1bus_slot_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock)
	: device_t(mconfig, type, tag, owner, clock)
	, device_slot_interface(mconfig, *this)
	, m_a1bus(*this, finder_base::DUMMY_TAG)
{
}

//-------------------------------------------------
//  device_start - device-specific startup
//-------------------------------------------------

void a1bus_slot_device::device_validity_check(validity_checker &valid) const
{
	device_t *const card(get_card_device());
	if (card && !dynamic_cast<device_a1bus_card_interface *>(card))
		osd_printf_error("Card device %s (%s) does not implement device_a1bus_card_interface\n", card->tag(), card->name());
}

void a1bus_slot_device::device_resolve_objects()
{
	device_a1bus_card_interface *const a1bus_card(dynamic_cast<device_a1bus_card_interface *>(get_card_device()));
	if (a1bus_card)
		a1bus_card->set_a1bus(m_a1bus, tag());
}

void a1bus_slot_device::device_start()
{
	device_t *const card(get_card_device());
	if (card && !dynamic_cast<device_a1bus_card_interface *>(card))
		throw emu_fatalerror("a1bus_slot_device: card device %s (%s) does not implement device_a1bus_card_interface\n", card->tag(), card->name());
}


//**************************************************************************
//  GLOBAL VARIABLES
//**************************************************************************

DEFINE_DEVICE_TYPE(A1BUS, a1bus_device, "a1bus", "Apple I Bus")

//**************************************************************************
//  LIVE DEVICE
//**************************************************************************

//-------------------------------------------------
//  a1bus_device - constructor
//-------------------------------------------------

a1bus_device::a1bus_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
	: a1bus_device(mconfig, A1BUS, tag, owner, clock)
{
}

a1bus_device::a1bus_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock)
	: device_t(mconfig, type, tag, owner, clock)
	, m_space(*this, finder_base::DUMMY_TAG, -1)
	, m_out_irq_cb(*this)
	, m_out_nmi_cb(*this)
	, m_device(nullptr)
{
}

//-------------------------------------------------
//  device_start - device-specific startup
//-------------------------------------------------

void a1bus_device::device_resolve_objects()
{
	// resolve callbacks
	m_out_irq_cb.resolve_safe();
	m_out_nmi_cb.resolve_safe();
}

void a1bus_device::device_start()
{
	// clear slot
	m_device = nullptr;
}

//-------------------------------------------------
//  device_reset - device-specific reset
//-------------------------------------------------

void a1bus_device::device_reset()
{
}

device_a1bus_card_interface *a1bus_device::get_a1bus_card()
{
	return m_device;
}

void a1bus_device::add_a1bus_card(device_a1bus_card_interface *card)
{
	m_device = card;
}

void a1bus_device::set_irq_line(int state)
{
	m_out_irq_cb(state);
}

void a1bus_device::set_nmi_line(int state)
{
	m_out_nmi_cb(state);
}

void a1bus_device::install_device(offs_t start, offs_t end, read8_delegate rhandler, write8_delegate whandler)
{
	m_space->install_readwrite_handler(start, end, rhandler, whandler);
}

void a1bus_device::install_bank(offs_t start, offs_t end, const char *tag, uint8_t *data)
{
//  printf("install_bank: %s @ %x->%x\n", tag, start, end);
	m_space->install_readwrite_bank(start, end, tag);
	machine().root_device().membank(siblingtag(tag).c_str())->set_base(data);
}

// interrupt request from a1bus card
WRITE_LINE_MEMBER( a1bus_device::irq_w ) { m_out_irq_cb(state); }
WRITE_LINE_MEMBER( a1bus_device::nmi_w ) { m_out_nmi_cb(state); }

//**************************************************************************
//  DEVICE CONFIG A1BUS CARD INTERFACE
//**************************************************************************


//**************************************************************************
//  DEVICE A1BUS CARD INTERFACE
//**************************************************************************

//-------------------------------------------------
//  device_a1bus_card_interface - constructor
//-------------------------------------------------

device_a1bus_card_interface::device_a1bus_card_interface(const machine_config &mconfig, device_t &device)
	: device_slot_card_interface(mconfig, device)
	, m_a1bus_finder(device, finder_base::DUMMY_TAG), m_a1bus(nullptr)
	, m_a1bus_slottag(nullptr), m_next(nullptr)
{
}


//-------------------------------------------------
//  ~device_a1bus_card_interface - destructor
//-------------------------------------------------

device_a1bus_card_interface::~device_a1bus_card_interface()
{
}

void device_a1bus_card_interface::interface_validity_check(validity_checker &valid) const
{
	if (m_a1bus_finder && m_a1bus && (m_a1bus != m_a1bus_finder))
		osd_printf_error("Contradictory buses configured (%s and %s)\n", m_a1bus_finder->tag(), m_a1bus->tag());
}

void device_a1bus_card_interface::interface_pre_start()
{
	device_slot_card_interface::interface_pre_start();

	if (!m_a1bus)
	{
		m_a1bus = m_a1bus_finder;
		if (!m_a1bus)
			fatalerror("Can't find Apple I Bus device %s\n", m_a1bus_finder.finder_tag());
	}

	if (!m_a1bus->started())
		throw device_missing_dependencies();

	m_a1bus->add_a1bus_card(this);
}

void device_a1bus_card_interface::install_device(offs_t start, offs_t end, read8_delegate rhandler, write8_delegate whandler)
{
	m_a1bus->install_device(start, end, rhandler, whandler);
}

void device_a1bus_card_interface::install_bank(offs_t start, offs_t end, const char *tag, uint8_t *data)
{
	m_a1bus->install_bank(start, end, tag, data);
}