summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/machine/nscsi_hd.cpp
diff options
context:
space:
mode:
author Sven Schnelle <svens@stackframe.org>2018-07-11 10:28:43 +0200
committer Sven Schnelle <svens@stackframe.org>2018-08-31 23:08:11 +0200
commit1ee34bbedcec4c22ae17b92c64b155734ab94209 (patch)
treeaf16183df6f3a87505525e2aeff175fab78eb8f5 /src/devices/machine/nscsi_hd.cpp
parentcf1fa442ddc4f0622248c92a7cfcc839ce5eecbd (diff)
nscsi_hd: add FORMAT_UNIT command (nw)
Diffstat (limited to 'src/devices/machine/nscsi_hd.cpp')
-rw-r--r--src/devices/machine/nscsi_hd.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/devices/machine/nscsi_hd.cpp b/src/devices/machine/nscsi_hd.cpp
index da417cae25e..cc6c9e2167c 100644
--- a/src/devices/machine/nscsi_hd.cpp
+++ b/src/devices/machine/nscsi_hd.cpp
@@ -372,6 +372,27 @@ void nscsi_harddisk_device::scsi_command()
scsi_status_complete(SS_GOOD);
break;
+ case SC_FORMAT_UNIT:
+ LOG("command FORMAT UNIT:%s%s%s%s%s\n",
+ (scsi_cmdbuf[1] & 0x80) ? " FMT-PINFO" : "",
+ (scsi_cmdbuf[1] & 0x40) ? " RTO_REQ" : "",
+ (scsi_cmdbuf[1] & 0x20) ? " LONG-LIST" : "",
+ (scsi_cmdbuf[1] & 0x10) ? " FMTDATA" : "",
+ (scsi_cmdbuf[1] & 0x08) ? " CMPLIST" : "");
+ {
+ hard_disk_info *info = hard_disk_get_info(harddisk);
+ auto block = std::make_unique<uint8_t[]>(info->sectorbytes);
+ for(int cyl = 0; cyl < info->cylinders; cyl++) {
+ for(int head = 0; head < info->heads; head++) {
+ for(int sector = 0; sector < info->sectors; sector++) {
+ hard_disk_write(harddisk, cyl * head * sector, block.get());
+ }
+ }
+ }
+ }
+ scsi_status_complete(SS_GOOD);
+ break;
+
default:
LOG("command %02x ***UNKNOWN***\n", scsi_cmdbuf[0]);
nscsi_full_device::scsi_command();