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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
|
// license:BSD-3-Clause
// copyright-holders:Carl
#ifndef MAME_BUS_ISA_MCD_H
#define MAME_BUS_ISA_MCD_H
#pragma once
#include "isa.h"
#include "imagedev/chd_cd.h"
#include "sound/cdda.h"
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
// ======================> mcd_isa_device
class mcd_isa_device : public cdrom_image_device,
public device_isa16_card_interface
{
public:
// construction/destruction
mcd_isa_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
protected:
virtual uint16_t dack16_r(int line) override;
virtual void device_start() override;
virtual void device_reset() override;
virtual void device_add_mconfig(machine_config &config) override;
private:
required_device<cdda_device> m_cdda;
uint8_t data_r();
uint8_t flag_r();
void cmd_w(uint8_t data);
void reset_w(uint8_t data);
void map(address_map &map);
bool read_sector(bool first = false);
bool m_change = false;
bool m_newstat = false;
bool m_data = false;
uint8_t m_stat = 0;
uint8_t m_buf[2352]{};
int m_buf_count = 0;
int m_buf_idx = 0;
uint8_t m_cmdbuf[16]{};
int m_cmdbuf_count = 0;
int m_cmdrd_count = 0;
int m_cmdbuf_idx = 0;
uint8_t m_mode = 0;
uint8_t m_cmd = 0;
uint8_t m_conf = 0;
uint8_t m_irq = 0;
uint8_t m_dma = 0;
uint16_t m_dmalen = 0;
uint32_t m_readmsf = 0;
uint32_t m_readcount = 0;
bool m_locked = false;
int m_drvmode = 0;
int m_curtoctrk = 0;
enum {
STAT_CMD_CHECK = 0x01,
STAT_PLAY_CDDA = 0x02,
STAT_ERROR = 0x04,
STAT_DISK_CDDA = 0x08,
STAT_SPIN = 0x10,
STAT_CHANGE = 0x20,
STAT_READY = 0x40,
STAT_OPEN = 0x80
};
enum {
CMD_GET_INFO = 0x10,
CMD_GET_Q = 0x20,
CMD_GET_STAT = 0x40,
CMD_SET_MODE = 0x50,
CMD_SOFT_RESET = 0x60,
CMD_STOPCDDA = 0x70,
CMD_CONFIG = 0x90,
CMD_SET_VOL = 0xae,
CMD_READ1X = 0xc0,
CMD_READ2X = 0xc1,
CMD_GET_VER = 0xdc,
CMD_STOP = 0xf0,
CMD_EJECT = 0xf6,
CMD_LOCK = 0xfe
};
enum {
MODE_MUTE = 0x01,
MODE_GET_TOC = 0x04,
MODE_STOP = 0x08,
MODE_ECC = 0x20,
MODE_DATA = 0x40
};
enum {
DRV_MODE_STOP,
DRV_MODE_READ,
DRV_MODE_CDDA
};
enum {
FLAG_NODATA = 2,
FLAG_NOSTAT = 4,
FLAG_UNK = 8, //??
FLAG_OPEN = 16
};
enum {
IRQ_DATAREADY = 1,
IRQ_DATACOMP = 2,
IRQ_ERROR = 4
};
};
// device type definition
DECLARE_DEVICE_TYPE(ISA16_MCD, mcd_isa_device)
#endif // MAME_BUS_ISA_MCD_H
|