summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/bus/isa/omti8621.cpp
diff options
context:
space:
mode:
author ImJezze <jezze@gmx.net>2016-02-21 11:48:45 +0100
committer ImJezze <jezze@gmx.net>2016-02-21 11:48:45 +0100
commitcc24a339d8c0517259084b5c178d784626ba965c (patch)
tree9868e9687b5802ae0a3733712a3bbeb3bc75c953 /src/devices/bus/isa/omti8621.cpp
parentb5daabda5495dea5c50e17961ecfed2ea8619d76 (diff)
Merge remote-tracking branch 'refs/remotes/mamedev/master'
Second attempt
Diffstat (limited to 'src/devices/bus/isa/omti8621.cpp')
-rw-r--r--src/devices/bus/isa/omti8621.cpp108
1 files changed, 62 insertions, 46 deletions
diff --git a/src/devices/bus/isa/omti8621.cpp b/src/devices/bus/isa/omti8621.cpp
index 5f42c31200b..a1379bc229d 100644
--- a/src/devices/bus/isa/omti8621.cpp
+++ b/src/devices/bus/isa/omti8621.cpp
@@ -73,6 +73,10 @@ protected:
virtual void device_reset() override;
void omti_disk_config(UINT16 disk_type);
+
+private:
+ void logerror(const char *format, ...) const;
+
public:
UINT16 m_type;
UINT16 m_cylinders;
@@ -685,6 +689,18 @@ void omti8621_device::set_esdi_defect_list(UINT8 lun, UINT8 head)
memset(disk->m_esdi_defect_list+6, 0xff, 5); // end of defect list
}
+/*-------------------------------------------------
+ logerror - log an error message (w/o device tags)
+ -------------------------------------------------*/
+
+void omti8621_device::logerror(const char *format, ...) const
+{
+ va_list arg;
+ va_start(arg, format);
+ machine().vlogerror(format, arg);
+ va_end(arg);
+}
+
/***************************************************************************
log_command - log command from a command descriptor block
***************************************************************************/
@@ -693,83 +709,80 @@ void omti8621_device::log_command(const UINT8 cdb[], const UINT16 cdb_length)
{
if (verbose > 0) {
int i;
- char sb[100];
- std::string text(cpu_context(this));
- text += ": OMTI command ";
+ logerror("%s: OMTI command ", cpu_context(this));
switch (cdb[0]) {
case OMTI_CMD_TEST_DRIVE_READY: // 0x00
- text += "Test Drive Ready";
+ logerror("Test Drive Ready");
break;
case OMTI_CMD_RECALIBRATE: // 0x01
- text += "Recalibrate";
+ logerror("Recalibrate");
break;
case OMTI_CMD_REQUEST_SENSE: // 0x03
- text += "Request Sense";
+ logerror("Request Sense");
break;
case OMTI_CMD_READ_VERIFY: // 0x05
- text += "Read Verify";
+ logerror("Read Verify");
break;
case OMTI_CMD_FORMAT_TRACK: // 0x06
- text += "Format Track";
+ logerror("Format Track");
break;
case OMTI_CMD_FORMAT_BAD_TRACK: // 0x07
- text += "Format Bad Track";
+ logerror("Format Bad Track");
break;
case OMTI_CMD_READ: // 0x08
- text += "Read";
+ logerror("Read");
break;
case OMTI_CMD_WRITE: // 0x0A
- text += "Write";
+ logerror("Write");
break;
case OMTI_CMD_SEEK: // 0x0B
- text += "Seek";
+ logerror("Seek");
break;
case OMTI_CMD_READ_SECTOR_BUFFER: // 0x0E
- text += "Read Sector Buffer";
+ logerror("Read Sector Buffer");
break;
case OMTI_CMD_WRITE_SECTOR_BUFFER: // 0x0F
- text += "Write Sector Buffer";
+ logerror("Write Sector Buffer");
break;
case OMTI_CMD_ASSIGN_ALTERNATE_TRACK: // 0x11
- text += "Assign Alternate Track";
+ logerror("Assign Alternate Track");
break;
case OMTI_CMD_READ_DATA_TO_BUFFER: // 0x1E
- text += "Read Data to Buffer";
+ logerror("Read Data to Buffer");
break;
case OMTI_CMD_WRITE_DATA_FROM_BUFFER: // 0x1F
- text += "Write Data from Buffer";
+ logerror("Write Data from Buffer");
break;
case OMTI_CMD_COPY: // 0x20
- text += "Copy";
+ logerror("Copy");
break;
case OMTI_CMD_READ_ESDI_DEFECT_LIST: // 0x37
- text += "Read ESDI Defect List";
+ logerror("Read ESDI Defect List");
break;
case OMTI_CMD_RAM_DIAGNOSTICS: // 0xE0
- text += "RAM. Diagnostic";
+ logerror("RAM. Diagnostic");
break;
case OMTI_CMD_CONTROLLER_INT_DIAGNOSTIC: // 0xE4
- text += "Controller Int. Diagnostic";
+ logerror("Controller Int. Diagnostic");
break;
case OMTI_CMD_READ_LONG: // 0xE5
- text += "Read Long";
+ logerror("Read Long");
break;
case OMTI_CMD_WRITE_LONG: // 0xE6
- text += "Write Long";
+ logerror("Write Long");
break;
case OMTI_CMD_READ_CONFIGURATION: // 0xEC
- text += "Read Configuration";
+ logerror("Read Configuration");
break;
case OMTI_CMD_INVALID_COMMAND: // 0xFF
- text += "Invalid Command";
+ logerror("Invalid Command");
break;
default:
- text += "!!! Unexpected Command !!!";
+ logerror("!!! Unexpected Command !!!");
}
// logerror(" (%02x, length=%02x)", cdb[0], cdb_length);
for (i = 0; i < cdb_length; i++) {
- sprintf(sb, " %02x", cdb[i]);
- text += sb;
+ logerror(" %02x", cdb[i]);
}
switch (cdb[0]) {
@@ -780,12 +793,10 @@ void omti8621_device::log_command(const UINT8 cdb[], const UINT16 cdb_length)
case OMTI_CMD_READ_DATA_TO_BUFFER: // 0x1E
case OMTI_CMD_WRITE_DATA_FROM_BUFFER: // 0x1F
case OMTI_CMD_COPY: // 0x20
- sprintf(sb, " (diskaddr=%x count=%x)", get_disk_address(cdb), cdb[4]);
- text += sb;
+ logerror(" (diskaddr=%x count=%x)", get_disk_address(cdb), cdb[4]);
break;
}
- text += "\n";
- logerror(text.c_str());
+ logerror("\n");
}
}
@@ -795,25 +806,18 @@ void omti8621_device::log_command(const UINT8 cdb[], const UINT16 cdb_length)
void omti8621_device::log_data()
{
- if (verbose > 0)
- {
+ if (verbose > 0) {
int i;
- char sb[100];
- sprintf(sb, "%s: OMTI data (length=%02x)", cpu_context(this),
+ logerror("%s: OMTI data (length=%02x)", cpu_context(this),
data_length);
- std::string text(sb);
- for (i = 0; i < data_length && i < OMTI_DISK_SECTOR_SIZE; i++)
- {
- sprintf(sb, " %02x", data_buffer[i]);
- text += sb;
+ for (i = 0; i < data_length && i < OMTI_DISK_SECTOR_SIZE; i++) {
+ logerror(" %02x", data_buffer[i]);
}
- if (i < data_length)
- {
- text += " ...";
+ if (i < data_length) {
+ logerror(" ...");
}
- text += "\n";
- logerror(text.c_str());
+ logerror("\n");
}
}
@@ -1351,6 +1355,18 @@ void omti_disk_image_device::omti_disk_config(UINT16 disk_type)
}
/*-------------------------------------------------
+ logerror - log an error message (w/o device tags)
+ -------------------------------------------------*/
+
+void omti_disk_image_device::logerror(const char *format, ...) const
+{
+ va_list arg;
+ va_start(arg, format);
+ machine().vlogerror(format, arg);
+ va_end(arg);
+}
+
+/*-------------------------------------------------
device start callback
-------------------------------------------------*/