mirror of
https://github.com/holub/mame
synced 2025-04-22 16:31:49 +03:00
miniguay.cpp: Hook up some devices
This commit is contained in:
parent
78c211b3bb
commit
65b762d240
@ -22,6 +22,8 @@
|
||||
#include "emu.h"
|
||||
#include "cpu/i8085/i8085.h"
|
||||
#include "machine/i8155.h"
|
||||
//#include "machine/i8256.h"
|
||||
#include "machine/watchdog.h"
|
||||
#include "sound/ay8910.h"
|
||||
#include "screen.h"
|
||||
#include "speaker.h"
|
||||
@ -33,21 +35,71 @@ class miniguay_state : public driver_device
|
||||
{
|
||||
public:
|
||||
miniguay_state(const machine_config &mconfig, device_type type, const char *tag)
|
||||
: driver_device(mconfig, type, tag),
|
||||
m_maincpu(*this, "maincpu")
|
||||
: driver_device(mconfig, type, tag)
|
||||
, m_maincpu(*this, "maincpu")
|
||||
, m_psg(*this, "psg")
|
||||
, m_psg_control(0)
|
||||
, m_psg_data(0)
|
||||
{ }
|
||||
|
||||
void miniguay(machine_config &config);
|
||||
|
||||
protected:
|
||||
virtual void machine_start() override;
|
||||
|
||||
private:
|
||||
void psg_control_w(u8 data);
|
||||
u8 psg_db_r();
|
||||
void psg_db_w(u8 data);
|
||||
|
||||
required_device<cpu_device> m_maincpu;
|
||||
required_device<ay8910_device> m_psg;
|
||||
|
||||
void main_map(address_map &map);
|
||||
|
||||
u8 m_psg_control;
|
||||
u8 m_psg_data;
|
||||
};
|
||||
|
||||
void miniguay_state::machine_start()
|
||||
{
|
||||
save_item(NAME(m_psg_control));
|
||||
save_item(NAME(m_psg_data));
|
||||
}
|
||||
|
||||
void miniguay_state::psg_control_w(u8 data)
|
||||
{
|
||||
if (BIT(m_psg_control, 6) && !BIT(data, 6))
|
||||
m_psg->data_address_w(BIT(m_psg_control, 7), m_psg_data);
|
||||
m_psg_control = data;
|
||||
}
|
||||
|
||||
u8 miniguay_state::psg_db_r()
|
||||
{
|
||||
if ((m_psg_control & 0xc0) == 0x80)
|
||||
return m_psg->data_r();
|
||||
else
|
||||
return m_psg_data;
|
||||
}
|
||||
|
||||
void miniguay_state::psg_db_w(u8 data)
|
||||
{
|
||||
m_psg_data = data;
|
||||
}
|
||||
|
||||
void miniguay_state::main_map(address_map &map)
|
||||
{
|
||||
map(0x0000, 0x7fff).rom().region("maincpu", 0);
|
||||
map(0x8000, 0x87ff).ram();
|
||||
//map(0x9400, 0x940f).rw("muart1", FUNC(i8256_device::read), FUNC(i8256_device::write));
|
||||
map(0x9900, 0x9907).rw("i8155_1", FUNC(i8155_device::io_r), FUNC(i8155_device::io_w));
|
||||
map(0x9d00, 0x9d07).rw("i8155_2", FUNC(i8155_device::io_r), FUNC(i8155_device::io_w));
|
||||
//map(0xb400, 0xb40f).rw("muart2", FUNC(i8256_device::read), FUNC(i8256_device::write));
|
||||
map(0xb409, 0xb409).rw(FUNC(miniguay_state::psg_db_r), FUNC(miniguay_state::psg_db_w));
|
||||
map(0xb900, 0xb907).rw("i8155_3", FUNC(i8155_device::io_r), FUNC(i8155_device::io_w));
|
||||
map(0xbd00, 0xbd07).rw("i8155_4", FUNC(i8155_device::io_r), FUNC(i8155_device::io_w));
|
||||
map(0xc000, 0xc000).w("watchdog", FUNC(watchdog_timer_device::reset_w));
|
||||
map(0xd000, 0xd000).nopw(); // resets something?
|
||||
}
|
||||
|
||||
static INPUT_PORTS_START( miniguay )
|
||||
@ -85,16 +137,26 @@ void miniguay_state::miniguay(machine_config &config)
|
||||
I8085A(config, m_maincpu, 6.144_MHz_XTAL); // divider not verified
|
||||
m_maincpu->set_addrmap(AS_PROGRAM, &miniguay_state::main_map);
|
||||
|
||||
WATCHDOG_TIMER(config, "watchdog");
|
||||
|
||||
//I8256(config, "muart1", 6.144_MHz_XTAL / 2);
|
||||
//I8256(config, "muart2", 6.144_MHz_XTAL / 2);
|
||||
|
||||
I8155(config, "i8155_1", 6.144_MHz_XTAL / 2); // divider not verified
|
||||
|
||||
I8155(config, "i8155_2", 6.144_MHz_XTAL / 2); // divider not verified
|
||||
|
||||
I8155(config, "i8155_3", 6.144_MHz_XTAL / 2); // divider not verified
|
||||
|
||||
i8155_device &i8155_4(I8155(config, "i8155_4", 6.144_MHz_XTAL / 2)); // divider not verified
|
||||
i8155_4.out_pb_callback().set(FUNC(miniguay_state::psg_control_w));
|
||||
|
||||
// sound hardware
|
||||
SPEAKER(config, "mono").front_center();
|
||||
ay8910_device &ay(AY8910(config, "ay", 6.144_MHz_XTAL / 4)); // divider not verified
|
||||
//ay.port_a_read_callback().set_ioport("DSW1");
|
||||
//ay.port_b_read_callback().set_ioport("DSW2");
|
||||
ay.add_route(ALL_OUTPUTS, "mono", 0.30);
|
||||
AY8910(config, m_psg, 6.144_MHz_XTAL / 4); // divider not verified
|
||||
//m_psg->port_a_read_callback().set_ioport("DSW1");
|
||||
//m_psg->port_b_read_callback().set_ioport("DSW2");
|
||||
m_psg->add_route(ALL_OUTPUTS, "mono", 0.30);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user