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
|
// license:BSD-3-Clause
// copyright-holders:Nathan Woods
/*********************************************************************
coco_fdc.h
CoCo/Dragon Floppy Disk Controller
*********************************************************************/
#ifndef MAME_DEVICES_BUS_COCO_FDC_H
#define MAME_DEVICES_BUS_COCO_FDC_H
#include "cococart.h"
#include "imagedev/floppy.h"
/***************************************************************************
TYPE DEFINITIONS
***************************************************************************/
// ======================> coco_family_fdc_device_base
class coco_family_fdc_device_base :
public device_t,
public device_cococart_interface
{
public:
// construction/destruction
coco_family_fdc_device_base(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname, const char *source)
: device_t(mconfig, type, name, tag, owner, clock, shortname, source)
, device_cococart_interface(mconfig, *this)
{
m_owner = dynamic_cast<cococart_slot_device *>(owner);
};
DECLARE_WRITE_LINE_MEMBER(fdc_intrq_w) { m_intrq = state; update_lines(); }
DECLARE_WRITE_LINE_MEMBER(fdc_drq_w) { m_drq = state; update_lines(); }
DECLARE_FLOPPY_FORMATS(floppy_formats);
protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
// FDC overrides
virtual void update_lines() = 0;
virtual uint8_t* get_cart_base() override;
// wrapper for setting the cart line
void cart_set_line(cococart_slot_device::line which, cococart_slot_device::line_value value)
{
m_owner->cart_set_line(which, value);
}
void cart_set_line(cococart_slot_device::line which, bool value)
{
cart_set_line(which, value ? cococart_slot_device::line_value::ASSERT : cococart_slot_device::line_value::CLEAR);
}
// accessors
uint8_t dskreg() const { return m_dskreg; }
bool intrq() const { return m_intrq; }
bool drq() const { return m_drq; }
void set_dskreg(uint8_t data) { m_dskreg = data; }
private:
// internal state
cococart_slot_device *m_owner;
// registers
uint8_t m_dskreg;
bool m_intrq;
bool m_drq;
};
// device type definitions - CoCo FDC
extern const device_type COCO_FDC;
extern const device_type COCO_FDC_V11;
extern const device_type COCO3_HDB1;
extern const device_type CP400_FDC;
// device type definitions - Dragon FDC
extern const device_type DRAGON_FDC;
extern const device_type SDTANDY_FDC;
#endif // MAME_DEVICES_BUS_COCO_FDC_H
|