diff options
author | mooglyguy <therealmogminer@gmail.com> | 2018-09-16 00:24:44 +0200 |
---|---|---|
committer | mooglyguy <therealmogminer@gmail.com> | 2018-09-16 00:24:56 +0200 |
commit | ea58b128bf5fa80f445894e71af8b168daeb5713 (patch) | |
tree | c500580375f0ec04fea72381bc48708c9f69e5c8 | |
parent | e317fb887faab5e4e68004fe913afedc6df6abdd (diff) |
-nscsi_cd: Return mid-sector data when initiating a read mid-sector in 512-byte block mode. [Ryan Holtz]
-rw-r--r-- | src/devices/machine/nscsi_cd.cpp | 3 | ||||
-rw-r--r-- | src/mame/drivers/sun4.cpp | 6 |
2 files changed, 8 insertions, 1 deletions
diff --git a/src/devices/machine/nscsi_cd.cpp b/src/devices/machine/nscsi_cd.cpp index 8827af488ea..828b1ed17ae 100644 --- a/src/devices/machine/nscsi_cd.cpp +++ b/src/devices/machine/nscsi_cd.cpp @@ -49,6 +49,7 @@ uint8_t nscsi_cdrom_device::scsi_get_data(int id, int pos) if(id != 2) return nscsi_full_device::scsi_get_data(id, pos); const int sector = (lba * bytes_per_block + pos) / bytes_per_sector; + const int extra_pos = (lba * bytes_per_block) % bytes_per_sector; if(sector != cur_sector) { cur_sector = sector; if(!cdrom_read_data(cdrom, sector, sector_buffer, CD_TRACK_MODE1)) { @@ -56,7 +57,7 @@ uint8_t nscsi_cdrom_device::scsi_get_data(int id, int pos) std::fill_n(sector_buffer, sizeof(sector_buffer), 0); } } - return sector_buffer[pos & (bytes_per_sector - 1)]; + return sector_buffer[(pos + extra_pos) & (bytes_per_sector - 1)]; } void nscsi_cdrom_device::return_no_cd() diff --git a/src/mame/drivers/sun4.cpp b/src/mame/drivers/sun4.cpp index d605f5963af..6f15eaade6c 100644 --- a/src/mame/drivers/sun4.cpp +++ b/src/mame/drivers/sun4.cpp @@ -1999,11 +1999,17 @@ static void sun_floppies(device_slot_interface &device) device.option_add("35hd", FLOPPY_35_HD); } +static void sun4_cdrom(device_t *device) +{ + downcast<nscsi_cdrom_device &>(*device).set_block_size(512); +} + static void sun_scsi_devices(device_slot_interface &device) { device.option_add("cdrom", NSCSI_CDROM); device.option_add("harddisk", NSCSI_HARDDISK); device.option_add_internal("ncr53c90a", NCR53C90A); + device.set_option_machine_config("cdrom", sun4_cdrom); } void sun4_state::ncr53c90a(device_t *device) |