summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/bus/pc98_cbus/mif201.cpp
blob: d141a46a472d4353dd6a2f57cb3d556c51db44de (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
// license:BSD-3-Clause
// copyright-holders: Angelo Salese
/**************************************************************************************************

MIF-201 MIDI interface

Bundled with Micro Musician VA

References:
- https://mamedev.emulab.it/kale/fast/files/micromusician_va.jpg

TODO:
- evasive, needs manual, dip-switch sheet and PCB pictures;

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

#include "emu.h"
#include "mif201.h"

DEFINE_DEVICE_TYPE(MIF201, mif201_device, "mif201", "Micro Musician VA MIF-201 MIDI Interface")

mif201_device::mif201_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
	: device_t(mconfig, MIF201, tag, owner, clock)
	, device_pc98_cbus_slot_interface(mconfig, *this)
	, m_uart(*this, "uart%u", 1U)
	, m_pit(*this, "pit")
{
}

//void mif201_device::irq_out(int state)
//{
//  m_bus->int_w(2, state);
//}


void mif201_device::device_add_mconfig(machine_config &config)
{
	// TODO: unknown clocks
	I8251(config, m_uart[0], 1021800);

	I8251(config, m_uart[1], 1021800);

	PIT8253(config, m_pit, 1021800);
}

void mif201_device::device_start()
{
}

void mif201_device::device_reset()
{
}

void mif201_device::remap(int space_id, offs_t start, offs_t end)
{
	if (space_id == AS_IO)
	{
		m_bus->install_device(0x0000, 0xffff, *this, &mif201_device::io_map);
	}
}

void mif201_device::io_map(address_map &map)
{
	// sheet claims i8251-1 having swapped ports compared to i8251-2 but micromus just uses
	// $e2d2 for control, assume typo.
	map(0xe2d0, 0xe2d3).lrw8(
		NAME([this](offs_t offset) { return m_uart[0]->read(offset); }),
		NAME([this](offs_t offset, u8 data) { m_uart[0]->write(offset, data); })
	).umask16(0x00ff);
	map(0xe4d0, 0xe4d3).lrw8(
		NAME([this](offs_t offset) { return m_uart[1]->read(offset); }),
		NAME([this](offs_t offset, u8 data) { m_uart[1]->write(offset, data); })
	).umask16(0x00ff);
	map(0xe6d0, 0xe6d3).lrw8(
		NAME([this](offs_t offset) { return m_pit->read(offset); }),
		NAME([this](offs_t offset, u8 data) { m_pit->write(offset, data); })
	).umask16(0x00ff);
	map(0xe7d0, 0xe7d3).lrw8(
		NAME([this](offs_t offset) { return m_pit->read(offset | 2); }),
		NAME([this](offs_t offset, u8 data) { m_pit->write(offset | 2, data); })
	).umask16(0x00ff);
}