tim011: Add expansion bus support and AY card [Marko Solajic, Miodrag Milanovic]

This commit is contained in:
Miodrag Milanovic 2024-02-01 12:02:53 +01:00
parent a1b7e3cd2d
commit d3ccee321c
6 changed files with 275 additions and 0 deletions

View File

@ -2473,6 +2473,21 @@ if (BUSES["TIKI100"]~=null) then
end
---------------------------------------------------
--
--@src/devices/bus/tim011/exp.h,BUSES["TIM011"] = true
---------------------------------------------------
if (BUSES["TIM011"]~=null) then
files {
MAME_DIR .. "src/devices/bus/tim011/exp.cpp",
MAME_DIR .. "src/devices/bus/tim011/exp.h",
MAME_DIR .. "src/devices/bus/tim011/aycard.cpp",
MAME_DIR .. "src/devices/bus/tim011/aycard.h",
}
end
---------------------------------------------------
--
--@src/devices/bus/tvc/tvc.h,BUSES["TVC"] = true

View File

@ -0,0 +1,84 @@
// license:BSD-3-Clause
// copyright-holders:Marko Solajic, Miodrag Milanovic
/**********************************************************************
TIM-011 AY Card
Card created by Zoran Urosevic.
**********************************************************************/
#include "emu.h"
#include "aycard.h"
#include "speaker.h"
#include "sound/ay8910.h"
namespace {
static INPUT_PORTS_START(joystick)
PORT_START("JOY")
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_8WAY
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) PORT_8WAY
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) PORT_8WAY
PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_8WAY
PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_BUTTON1)
PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_BUTTON3)
PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED)
PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_BUTTON2)
INPUT_PORTS_END
class tim011_aycard_devices :
public device_t,
public bus::tim011::device_exp_interface
{
public:
// construction/destruction
tim011_aycard_devices(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
protected:
// device_t implementation
virtual void device_start() override;
virtual void device_reset() override;
// device-level overrides
virtual void device_add_mconfig(machine_config &config) override;
virtual ioport_constructor device_input_ports() const override { return INPUT_PORTS_NAME(joystick); }
private:
required_device<ay8910_device> m_psg;
};
tim011_aycard_devices::tim011_aycard_devices(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, TIM011_AYCARD, tag, owner, clock)
, bus::tim011::device_exp_interface(mconfig, *this)
, m_psg(*this, "ay8912")
{
}
/*----------------------------------
device_t implementation
----------------------------------*/
void tim011_aycard_devices::device_start()
{
}
void tim011_aycard_devices::device_reset()
{
m_slot->m_io->install_write_handler(0x00f4, 0x00f4, emu::rw_delegate(m_psg, FUNC(ay8910_device::data_w)));
m_slot->m_io->install_read_handler (0x00fc, 0x00fc, emu::rw_delegate(m_psg, FUNC(ay8910_device::data_r)));
m_slot->m_io->install_write_handler(0x00fc, 0x00fc, emu::rw_delegate(m_psg, FUNC(ay8910_device::address_w)));
}
void tim011_aycard_devices::device_add_mconfig(machine_config &config)
{
/* sound hardware */
SPEAKER(config, "mono").front_center();
AY8912(config, m_psg, 1.8432_MHz_XTAL);
m_psg->add_route(ALL_OUTPUTS, "mono", 0.25);
}
} // anonymous namespace
DEFINE_DEVICE_TYPE_PRIVATE(TIM011_AYCARD, bus::tim011::device_exp_interface, tim011_aycard_devices, "ay", "AY card")

View File

@ -0,0 +1,12 @@
// license:BSD-3-Clause
// copyright-holders:Marko Solajic, Miodrag Milanovic
#ifndef MAME_BUS_TIM011_AYCARD_H
#define MAME_BUS_TIM011_AYCARD_H
#pragma once
#include "exp.h"
DECLARE_DEVICE_TYPE_NS(TIM011_AYCARD, bus::tim011, device_exp_interface)
#endif // MAME_BUS_TIM011_AYCARD_H

View File

@ -0,0 +1,54 @@
// license:BSD-3-Clause
// copyright-holders:Marko Solajic, Miodrag Milanovic
/**********************************************************************
TIM-011 Expansion Port emulation
**********************************************************************/
#include "emu.h"
#include "exp.h"
DEFINE_DEVICE_TYPE(TIM011_EXPANSION_SLOT, bus::tim011::exp_slot_device, "tim011_exp_slot", "TIM-011 Expansion port")
namespace bus::tim011 {
/***********************************************************************
CARD INTERFACE
***********************************************************************/
device_exp_interface::device_exp_interface(const machine_config &mconfig, device_t &device) :
device_interface(device, "tim011exp")
{
m_slot = dynamic_cast<exp_slot_device *>(device.owner());
}
/***********************************************************************
SLOT DEVICE
***********************************************************************/
exp_slot_device::exp_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
device_t(mconfig, TIM011_EXPANSION_SLOT, tag, owner, clock),
device_single_card_slot_interface<device_exp_interface>(mconfig, *this),
m_io(*this, finder_base::DUMMY_TAG, -1),
m_int_handler(*this),
m_nmi_handler(*this)
{
}
/*----------------------------------
device_t implementation
----------------------------------*/
void exp_slot_device::device_start()
{
}
} // namespace bus::tim011
#include "aycard.h"
void tim011_exp_devices(device_slot_interface &device)
{
device.option_add("ay", TIM011_AYCARD);
}

View File

@ -0,0 +1,102 @@
// license:BSD-3-Clause
// copyright-holders:Marko Solajic, Miodrag Milanovic
/*********************************************************************
TIM-011 Expansion Port emulation
**********************************************************************
Pinout:
TIM011 Expansion Connector
40 pin male, on main board
*******
VCC 1 * . . * 2 VCC
GND 3 * . . * 4 GND
/RD 5 * . . * 6 PHI
/WR 7 * . . * 8 /RESET
E 9 * . . * 10 /LIR
/NMI 11 * . . * 12 /EXPSEL (E0-FF)
/WAIT 13 * . . * 14 NC
/INT0 15 * . . * 16 /HALT
ST 17 . . * 18 NC
A0 19 . . * 20 A1
/TEND0 21 . . * 22 A2
A3 23 * . . * 24 A4
/DREQ0 25 * . . * 26 /IOE
8MHZ 27 * . . * 28 RESET
D7 29 * . . * 30 D6
D5 31 * . . * 32 D3
D4 33 * . . * 34 D2
D1 35 * . . * 36 D0
GND 37 * . . * 38 GND
NC 39 * . . * 40 NC
*******
**********************************************************************/
#ifndef MAME_BUS_TIM011_EXP_H
#define MAME_BUS_TIM011_EXP_H
#pragma once
namespace bus::tim011 {
class device_exp_interface;
class exp_slot_device : public device_t, public device_single_card_slot_interface<device_exp_interface>
{
public:
// construction/destruction
template <typename T>
exp_slot_device(machine_config const &mconfig, char const *tag, device_t *owner, T &&slot_options, const char *default_option)
: exp_slot_device(mconfig, tag, owner)
{
option_reset();
slot_options(*this);
set_default_option(default_option);
set_fixed(false);
}
exp_slot_device(machine_config const &mconfig, char const *tag, device_t *owner, uint32_t clock = 0);
template <typename T> void set_io_space(T &&tag, int spacenum) { m_io.set_tag(std::forward<T>(tag), spacenum); }
// callbacks
auto int_handler() { return m_int_handler.bind(); }
auto nmi_handler() { return m_nmi_handler.bind(); }
// called from expansion device
void int_w(int state) { m_int_handler(state); }
void nmi_w(int state) { m_nmi_handler(state); }
required_address_space m_io;
protected:
// device_t implementation
virtual void device_start() override;
private:
devcb_write_line m_int_handler;
devcb_write_line m_nmi_handler;
};
// ======================> device_exp_interface
class device_exp_interface : public device_interface
{
protected:
// construction/destruction
device_exp_interface(const machine_config &mconfig, device_t &device);
exp_slot_device *m_slot;
};
} // namespace bus::tim011
DECLARE_DEVICE_TYPE_NS(TIM011_EXPANSION_SLOT, bus::tim011, exp_slot_device)
void tim011_exp_devices(device_slot_interface &device);
#endif // MAME_BUS_TIM011_EXP_H

View File

@ -14,6 +14,8 @@
#include "formats/tim011_dsk.h"
#include "machine/upd765.h"
#include "bus/rs232/rs232.h"
#include "bus/tim011/exp.h"
#include "emupal.h"
#include "screen.h"
@ -31,6 +33,7 @@ public:
, m_floppy(*this, FDC9266_TAG ":%u", 0)
, m_vram(*this, "videoram")
, m_palette(*this, "palette")
, m_exp(*this, "exp")
{ }
void tim011(machine_config &config);
@ -49,6 +52,8 @@ private:
required_device_array<floppy_connector, 4> m_floppy;
required_shared_ptr<u8> m_vram;
required_device<palette_device> m_palette;
required_device<bus::tim011::exp_slot_device> m_exp;
void tim011_io(address_map &map);
void tim011_mem(address_map &map);
void tim011_palette(palette_device &palette) const;
@ -193,6 +198,9 @@ void tim011_state::tim011(machine_config &config)
rs232_port_device &rs232(RS232_PORT(config, "rs232", default_rs232_devices, "keyboard"));
rs232.set_option_device_input_defaults("keyboard", DEVICE_INPUT_DEFAULTS_NAME(keyboard));
rs232.rxd_handler().set(m_maincpu, FUNC(z180_device::rxa1_w));
TIM011_EXPANSION_SLOT(config, m_exp, tim011_exp_devices, "ay");
m_exp->set_io_space(m_maincpu, AS_IO);
}
/* ROM definition */