summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/bus/isa/mcd.h
blob: a7d0fb3e3133244dc9f2e6e112d616d45df3bac4 (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
95
96
97
98
99
100
101
102
103
// license:BSD-3-Clause
// copyright-holders:Carl
#pragma once

#ifndef __MCD_H__
#define __MCD_H__

#include "emu.h"
#include "isa.h"
#include "imagedev/chd_cd.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 clock);

	// optional information overrides
	virtual ioport_constructor device_input_ports() const override;

	DECLARE_ADDRESS_MAP(map, 16);

	DECLARE_READ8_MEMBER(data_r);
	DECLARE_READ8_MEMBER(flag_r);
	DECLARE_WRITE8_MEMBER(cmd_w);
	DECLARE_WRITE8_MEMBER(reset_w);
protected:
	// device-level overrides
	virtual void device_start() override;
	virtual void device_reset() override;
private:
	bool m_data;
	UINT8 m_stat;
	UINT8 m_flag;
	UINT8 m_buf[2048];
	int m_buf_count;
	int m_buf_idx;
	int m_rd_count;
	UINT8 m_mode;
	UINT8 m_cmd;
	UINT8 m_conf;
	UINT8 m_irq;
	UINT8 m_dma;
	bool m_locked;
	int m_drvmode;
	int m_curtoctrk;
	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_READ = 0xc0,
		CMD_READCDDA = 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_DATA = 2,
		FLAG_STAT = 4,
		FLAG_OPEN = 16
	};
};


// device type definition
extern const device_type ISA16_MCD;

#endif