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
95
96
97
98
99
100
101
102
|
// license:BSD-3-Clause
// copyright-holders:Curt Coder
/**********************************************************************
Commodore PET/VIC-20/C64/Plus-4 Datassette Port emulation
Copyright MESS Team.
Visit http://mamedev.org for licensing and usage restrictions.
**********************************************************************/
#include "machine/petcass.h"
//**************************************************************************
// GLOBAL VARIABLES
//**************************************************************************
const device_type PET_DATASSETTE_PORT = &device_creator<pet_datassette_port_device>;
//**************************************************************************
// CARD INTERFACE
//**************************************************************************
//-------------------------------------------------
// device_pet_datassette_port_interface - constructor
//-------------------------------------------------
device_pet_datassette_port_interface::device_pet_datassette_port_interface(const machine_config &mconfig, device_t &device)
: device_slot_card_interface(mconfig,device)
{
m_slot = dynamic_cast<pet_datassette_port_device *>(device.owner());
}
//-------------------------------------------------
// ~device_pet_datassette_port_interface - destructor
//-------------------------------------------------
device_pet_datassette_port_interface::~device_pet_datassette_port_interface()
{
}
//**************************************************************************
// LIVE DEVICE
//**************************************************************************
//-------------------------------------------------
// pet_datassette_port_device - constructor
//-------------------------------------------------
pet_datassette_port_device::pet_datassette_port_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
device_t(mconfig, PET_DATASSETTE_PORT, "Datassette Port", tag, owner, clock, "pet_datassette_port", __FILE__),
device_slot_interface(mconfig, *this),
m_read_handler(*this)
{
}
//-------------------------------------------------
// pet_datassette_port_device - destructor
//-------------------------------------------------
pet_datassette_port_device::~pet_datassette_port_device()
{
}
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
void pet_datassette_port_device::device_start()
{
m_cart = dynamic_cast<device_pet_datassette_port_interface *>(get_card_device());
// resolve callbacks
m_read_handler.resolve_safe();
}
READ_LINE_MEMBER( pet_datassette_port_device::read ) { int state = 1; if (m_cart != NULL) state = m_cart->datassette_read(); return state; }
WRITE_LINE_MEMBER( pet_datassette_port_device::write ) { if (m_cart != NULL) m_cart->datassette_write(state); }
READ_LINE_MEMBER( pet_datassette_port_device::sense_r ) { int state = 1; if (m_cart != NULL) state = m_cart->datassette_sense(); return state; }
WRITE_LINE_MEMBER( pet_datassette_port_device::motor_w ) { if (m_cart != NULL) m_cart->datassette_motor(state); }
WRITE_LINE_MEMBER( pet_datassette_port_device::read_w ) { m_read_handler(state); }
//-------------------------------------------------
// SLOT_INTERFACE( cbm_datassette_devices )
//-------------------------------------------------
SLOT_INTERFACE_START( cbm_datassette_devices )
SLOT_INTERFACE("c2n", C2N)
SLOT_INTERFACE("c1530", C1530)
SLOT_INTERFACE_END
|