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
120
121
122
123
124
125
126
|
// license:BSD-3-Clause
// copyright-holders:Olivier Galibert
#ifndef MAME_BUS_NSCSI_CD_H
#define MAME_BUS_NSCSI_CD_H
#pragma once
#include "machine/nscsi_bus.h"
#include "imagedev/chd_cd.h"
#include "cdrom.h"
class nscsi_cdrom_device : public nscsi_full_device
{
public:
nscsi_cdrom_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
void set_block_size(u32 block_size);
protected:
nscsi_cdrom_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock = 0);
nscsi_cdrom_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, const char *mfr, const char *product, const char *rev, uint8_t inq_data, uint8_t compliance)
: nscsi_cdrom_device(mconfig, type, tag, owner, 0)
{
strncpy(manufacturer, mfr, 8);
strncpy(this->product, product, 16);
strncpy(revision, rev, 4);
inquiry_data = inq_data;
this->compliance = compliance;
}
virtual void device_start() override;
virtual void device_reset() override;
virtual void device_add_mconfig(machine_config &config) override;
virtual void scsi_command() override;
virtual uint8_t scsi_get_data(int id, int pos) override;
virtual void scsi_put_data(int buf, int offset, uint8_t data) override;
cdrom_file *cdrom;
private:
static constexpr uint32_t bytes_per_sector = 2048;
uint8_t sector_buffer[bytes_per_sector];
uint32_t bytes_per_block;
int lba, cur_sector;
required_device<cdrom_image_device> image;
uint8_t mode_data[12];
char manufacturer[8];
char product[16];
char revision[4];
uint8_t inquiry_data;
uint8_t compliance;
void return_no_cd();
static int to_msf(int frame);
};
class nscsi_cdrom_sgi_device : public nscsi_cdrom_device
{
public:
nscsi_cdrom_sgi_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
protected:
virtual void scsi_command() override;
virtual bool scsi_command_done(uint8_t command, uint8_t length) override;
};
class nscsi_dec_rrd45_device : public nscsi_cdrom_device
{
public:
nscsi_dec_rrd45_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
};
class nscsi_toshiba_xm3301_device : public nscsi_cdrom_device
{
public:
nscsi_toshiba_xm3301_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
};
class nscsi_toshiba_xm5301_sun_device : public nscsi_cdrom_device
{
public:
nscsi_toshiba_xm5301_sun_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
};
class nscsi_toshiba_xm5401_sun_device : public nscsi_cdrom_device
{
public:
nscsi_toshiba_xm5401_sun_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
};
class nscsi_toshiba_xm5701_device : public nscsi_cdrom_device
{
public:
nscsi_toshiba_xm5701_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
};
class nscsi_toshiba_xm5701_sun_device : public nscsi_cdrom_device
{
public:
nscsi_toshiba_xm5701_sun_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
};
class nscsi_cdrom_apple_device : public nscsi_cdrom_device
{
public:
nscsi_cdrom_apple_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
protected:
virtual void scsi_command() override;
};
DECLARE_DEVICE_TYPE(NSCSI_CDROM, nscsi_cdrom_device)
DECLARE_DEVICE_TYPE(NSCSI_CDROM_SGI, nscsi_cdrom_sgi_device)
DECLARE_DEVICE_TYPE(NSCSI_RRD45, nscsi_dec_rrd45_device)
DECLARE_DEVICE_TYPE(NSCSI_XM3301, nscsi_toshiba_xm3301_device)
DECLARE_DEVICE_TYPE(NSCSI_XM5301SUN, nscsi_toshiba_xm5301_sun_device)
DECLARE_DEVICE_TYPE(NSCSI_XM5401SUN, nscsi_toshiba_xm5401_sun_device)
DECLARE_DEVICE_TYPE(NSCSI_XM5701, nscsi_toshiba_xm5701_device)
DECLARE_DEVICE_TYPE(NSCSI_XM5701SUN, nscsi_toshiba_xm5701_sun_device)
DECLARE_DEVICE_TYPE(NSCSI_CDROM_APPLE, nscsi_cdrom_apple_device)
#endif // MAME_BUS_NSCSI_CD_H
|