summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/bus/scsi/scsicd512.cpp
blob: 9b521dc62b5c910cb496a093ad8adc0780249c5d (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
// license:BSD-3-Clause
// copyright-holders:Ryan Holtz
/***************************************************************************

    DEC RRD45 CD-ROM

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

#include "emu.h"
#include "scsicd512.h"

DEFINE_DEVICE_TYPE(RRD45, dec_rrd45_device, "rrd45", "DEC RRD45")
DEFINE_DEVICE_TYPE(XM3301, toshiba_xm3301_device, "xm3301", "Toshiba XM-3301TA CD-ROM")
DEFINE_DEVICE_TYPE(XM5301SUN, toshiba_xm5301_sun_device, "xm5301sun", "Toshiba XM-5301B Sun 4x CD-ROM")
DEFINE_DEVICE_TYPE(XM5401SUN, toshiba_xm5401_sun_device, "xm5401sun", "Toshiba XM-5401B Sun 4x CD-ROM")
DEFINE_DEVICE_TYPE(XM5701, toshiba_xm5701_device, "xm5701", "Toshiba XM-5701B 12x CD-ROM")
DEFINE_DEVICE_TYPE(XM5701SUN, toshiba_xm5701_sun_device, "xm5701sun", "Toshiba XM-5701B Sun 12x CD-ROM")

void scsicd512_device::device_reset()
{
	scsihle_device::device_reset();

	m_sector_bytes = 512;
	m_num_subblocks = 4;
}

void scsicd512_device::ExecCommand()
{
	switch (command[0])
	{
		case 0x12: // INQUIRY
			m_phase = SCSI_PHASE_DATAIN;
			m_status_code = SCSI_STATUS_CODE_GOOD;
			m_transfer_length = SCSILengthFromUINT8(&command[4]);
			break;
		default:
			scsicd_device::ExecCommand();
			break;
	}
}

void scsicd512_device::ReadData(uint8_t *data, int dataLength)
{
	switch (command[0])
	{
		case 0x12: // INQUIRY
		{
			uint8_t buffer[36];
			memset(buffer, 0, dataLength);
			buffer[0] = 0x05; // device is present, device is CD/DVD (MMC-3)
			buffer[1] = 0x80; // media is removable
			buffer[2] = 0x02; // copied from response from actual drive
			buffer[3] = 0x02; // response data format = SPC-3 standard
			buffer[4] = 0x1f; // copied ...
			buffer[7] = 0x98; // copied ...
			memcpy(&buffer[8], m_manufacturer, 8);
			memcpy(&buffer[16], m_product, 16);
			memcpy(&buffer[32], m_revision, 4);
			memcpy(data, buffer, dataLength);
			break;
		}

		default:
			scsicd_device::ReadData(data, dataLength);
			break;
	}
}

scsicd512_device::scsicd512_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, const XTAL &clock) :
	scsicd_device(mconfig, type, tag, owner, clock)
{
}

dec_rrd45_device::dec_rrd45_device(const machine_config &mconfig, const char *tag, device_t *owner, const XTAL &clock) :
	scsicd512_device(mconfig, RRD45, tag, owner, "DEC     ", "RRD45   (C) DEC ", "0436", 0x98)
{
}

toshiba_xm3301_device::toshiba_xm3301_device(const machine_config &mconfig, const char *tag, device_t *owner, const XTAL &clock) :
	scsicd512_device(mconfig, XM3301, tag, owner, "TOSHIBA ", "CD-ROM XM-3301TA", "0272", 0x88)
{
}

toshiba_xm5301_sun_device::toshiba_xm5301_sun_device(const machine_config &mconfig, const char *tag, device_t *owner, const XTAL &clock) :
	scsicd512_device(mconfig, XM5301SUN, tag, owner, "TOSHIBA ", "XM-5301TASUN4XCD", "2915", 0x98)
{
}

toshiba_xm5401_sun_device::toshiba_xm5401_sun_device(const machine_config &mconfig, const char *tag, device_t *owner, const XTAL &clock) :
	scsicd512_device(mconfig, XM5401SUN, tag, owner, "TOSHIBA ", "XM-5401TASUN4XCD", "1036", 0x98)
{
}

toshiba_xm5701_device::toshiba_xm5701_device(const machine_config &mconfig, const char *tag, device_t *owner, const XTAL &clock) :
	scsicd512_device(mconfig, XM5701, tag, owner, "TOSHIBA ", "CD-ROM XM-5701TA", "3136", 0x98)
{
}

toshiba_xm5701_sun_device::toshiba_xm5701_sun_device(const machine_config &mconfig, const char *tag, device_t *owner, const XTAL &clock) :
	scsicd512_device(mconfig, XM5701SUN, tag, owner, "TOSHIBA ", "XM5701TASUN12XCD", "0997", 0x98)
{
}