summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/bus/ata/gdrom.h
blob: 7467d1dff2052018860c661569f140c4816c2b9e (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
// license:BSD-3-Clause
// copyright-holders:smf, Angelo Salese
/***************************************************************************

 gdrom.h

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

#ifndef MAME_BUS_ATA_GDROM_H
#define MAME_BUS_ATA_GDROM_H

#pragma once

#include "atapicdr.h"

class gdrom_device : public atapi_cdrom_device
{
public:
	gdrom_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);

	// Sega GD-ROM handler

	virtual void ExecCommand() override;
	virtual void WriteData( uint8_t *data, int dataLength ) override;
	virtual void ReadData( uint8_t *data, int dataLength ) override;
	DECLARE_WRITE_LINE_MEMBER(cdda_end_mark_cb);

protected:
	virtual void process_buffer() override;
	virtual void signature() override;

	// device-level overrides
	virtual void device_start() override;
	virtual void device_reset() override;
//	virtual bool set_features() override;
	// TODO: how GDROM determines ready flag?
	// cfr. dc.xml [GDROM READY] for a list of SW that wants this on.
	virtual bool is_ready() override { return true; }

private:
	uint8_t GDROM_Cmd11_Reply[32]{};
	uint32_t read_type = 0;   // for command 0x30 only
	uint32_t data_select = 0; // for command 0x30 only
	uint32_t transferOffset = 0;

	struct cd_status
	{
		u8 repeat_count = 0;
		u8 repeat_current = 0;
		u32 cdda_fad = 0;
		u32 cdda_blocks = 0;
	};

	cd_status m_cd_status;
};

DECLARE_DEVICE_TYPE(ATAPI_GDROM, gdrom_device)

#endif // MAME_BUS_ATA_GDROM_H