summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/bus/aquarius/c1541.cpp
blob: 90be53ad4e04fa4e097172eae669a16129599e42 (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
// license:BSD-3-Clause
// copyright-holders:Nigel Barnes
/**********************************************************************

    Aquarius C1541 DOS Interface by Ron Koenig

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


#include "emu.h"
#include "c1541.h"


//**************************************************************************
//  DEVICE DEFINITIONS
//**************************************************************************

DEFINE_DEVICE_TYPE(AQUARIUS_C1541, aquarius_c1541_device, "aquarius_c1541", "Aquarius C1541 DOS Interface")


//-------------------------------------------------
//  device_add_mconfig - add device configuration
//-------------------------------------------------

void aquarius_c1541_device::device_add_mconfig(machine_config &config)
{
	cbm_iec_slot_device::add(config, m_iec, "c1541");
}


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

//-------------------------------------------------
//  aquarius_c1541_device - constructor
//-------------------------------------------------

aquarius_c1541_device::aquarius_c1541_device(const machine_config &mconfig, const char *tag, device_t *owner, const XTAL &clock)
	: device_t(mconfig, AQUARIUS_C1541, tag, owner, clock)
	, device_aquarius_cartridge_interface(mconfig, *this)
	, m_iec(*this, "iec_bus")
{
}


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

void aquarius_c1541_device::device_start()
{
}


//**************************************************************************
//  IMPLEMENTATION
//**************************************************************************

uint8_t aquarius_c1541_device::mreq_ce_r(offs_t offset)
{
	return get_rom_base()[offset & 0x3fff];
}


uint8_t aquarius_c1541_device::iorq_r(offs_t offset)
{
	uint8_t data = 0xff;

	if (offset == 0x60)
	{
		// TODO: unknown connections
		data = 0x00;
		data |= m_iec->clk_r() << 7;
		data |= m_iec->data_r() << 3;
		logerror("iorq_r: %02x = %02x\n", offset, data);
	}

	return data;
}

void aquarius_c1541_device::iorq_w(offs_t offset, uint8_t data)
{
	if (offset == 0x60)
	{
		logerror("iorq_w: %02x = %02x\n", offset, data);
		// TODO: unknown connections
		m_iec->host_atn_w(BIT(data, 6));
		m_iec->host_clk_w(BIT(data, 5));
		m_iec->host_data_w(BIT(data, 4));
	}
}