summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/bus/thomson/md90_120.cpp
blob: d59767a0322150079033d322221e3bba15ffb11a (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
83
84
85
86
87
88
89
90
91
92
93
94
// license:BSD-3-Clause
// copyright-holders:Antoine Mine

#include "emu.h"
#include "md90_120.h"

#include "machine/6821pia.h"
#include "machine/clock.h"

#define VERBOSE 0
#include "logmacro.h"

/* ------------  MD 90-120 MODEM extension (not functional) ------------ */

/* Features:
   - 6850 ACIA
   - 6821 PIA
   - asymetric 1200/ 75 bauds (reversable)

   TODO!
 */

// device type definition
DEFINE_DEVICE_TYPE(MD90_120, md90_120_device, "md90_120", "Thomson MD 90-120 Modem")

//-------------------------------------------------
//  md90_120_device - constructor
//-------------------------------------------------

md90_120_device::md90_120_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
	: device_t(mconfig, MD90_120, tag, owner, clock),
	thomson_extension_interface(mconfig, *this),
	m_acia(*this, "acia")
{
}

void md90_120_device::rom_map(address_map &map)
{
}

void md90_120_device::io_map(address_map &map)
{
	map(0x38, 0x3b).rw("pia", FUNC(pia6821_device::read_alt), FUNC(pia6821_device::write_alt));
	map(0x3e, 0x3f).rw(m_acia, FUNC(acia6850_device::read), FUNC(acia6850_device::write));
}

void md90_120_device::device_add_mconfig(machine_config &config)
{
	PIA6821(config, "pia");

	ACIA6850(config, m_acia);
	m_acia->txd_handler().set(FUNC(md90_120_device::modem_tx_w));
	m_acia->irq_handler().set(FUNC(md90_120_device::modem_cb));

	clock_device &acia_clock(CLOCK(config, "acia_clock", 1200)); /* 1200 bauds, might be divided by 16 */
	acia_clock.signal_handler().set(FUNC(md90_120_device::write_acia_clock));
}


void md90_120_device::modem_cb(int state)
{
	LOG( "modem_cb: called %i\n", state );
}



void md90_120_device::modem_tx_w(int state)
{
	m_modem_tx = state;
}


void md90_120_device::write_acia_clock(int state)
{
	m_acia->write_txc(state);
	m_acia->write_rxc(state);
}

void md90_120_device::device_reset()
{
	m_acia->write_rxd(0);
	m_modem_tx = 0;
	/* pia_reset() is called in machine_reset */
	/* acia_6850 has no reset (?) */
}



void md90_120_device::device_start()
{
	LOG ( " MODEM not implemented!\n" );
	save_item(NAME(m_modem_tx));
}