diff options
Diffstat (limited to 'src/devices/machine/wd2010.cpp')
-rw-r--r-- | src/devices/machine/wd2010.cpp | 105 |
1 files changed, 52 insertions, 53 deletions
diff --git a/src/devices/machine/wd2010.cpp b/src/devices/machine/wd2010.cpp index 8ed394f5b60..52bdd98905a 100644 --- a/src/devices/machine/wd2010.cpp +++ b/src/devices/machine/wd2010.cpp @@ -33,6 +33,17 @@ Implements WD2010 / WD1010 controller basics. MCFG_WD2010_IN_SC_CB(VCC) // SEEK COMPLETE = VCC **********************************************************************/ +#include "emu.h" +#include "machine/wd2010.h" + +#define VERBOSE 1 +#include "logmacro.h" + + +//************************************************************************** +// MACROS / CONSTANTS +//************************************************************************** + // WD 2010 CONFIGURATION (2048 cylinder limit) #define STEP_LIMIT 2048 #define CYLINDER_HIGH_MASK 0x07 @@ -48,15 +59,6 @@ Implements WD2010 / WD1010 controller basics. // -------------------------------------------------------- -#include "emu.h" -#include "machine/wd2010.h" - -//************************************************************************** -// MACROS / CONSTANTS -//************************************************************************** - -#define LOG 1 - // task file enum { @@ -89,7 +91,7 @@ enum #define DRIVE \ ((m_task_file[TASK_FILE_SDH_REGISTER] >> 3) & 0x03) -static const int SECTOR_SIZES[4] = { 256, 512, 1024, 128 }; +static constexpr int SECTOR_SIZES[4] = { 256, 512, 1024, 128 }; #define SECTOR_SIZE \ SECTOR_SIZES[(m_task_file[TASK_FILE_SDH_REGISTER] >> 5) & 0x03] @@ -132,7 +134,7 @@ static const int SECTOR_SIZES[4] = { 256, 512, 1024, 128 }; // DEVICE DEFINITIONS //************************************************************************** -const device_type WD2010 = device_creator<wd2010_device>; +DEFINE_DEVICE_TYPE(WD2010, wd2010_device, "wd2010", "Western Digital WD2010 Winchester Disk Controller") //************************************************************************** @@ -144,24 +146,24 @@ const device_type WD2010 = device_creator<wd2010_device>; //------------------------------------------------- wd2010_device::wd2010_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) -: device_t(mconfig, WD2010, "Western Digital WD2010", tag, owner, clock, "wd2010", __FILE__), -m_out_intrq_cb(*this), -m_out_bdrq_cb(*this), -m_out_bcr_cb(*this), -m_in_bcs_cb(*this), -m_in_brdy_cb(*this), -m_out_bcs_cb(*this), -m_out_dirin_cb(*this), -m_out_step_cb(*this), -m_out_rwc_cb(*this), -m_out_wg_cb(*this), -m_in_drdy_cb(*this), -m_in_index_cb(*this), -m_in_wf_cb(*this), -m_in_tk000_cb(*this), -m_in_sc_cb(*this), -m_status(0), -m_error(0) + : device_t(mconfig, WD2010, tag, owner, clock) + , m_out_intrq_cb(*this) + , m_out_bdrq_cb(*this) + , m_out_bcr_cb(*this) + , m_in_bcs_cb(*this) + , m_in_brdy_cb(*this) + , m_out_bcs_cb(*this) + , m_out_dirin_cb(*this) + , m_out_step_cb(*this) + , m_out_rwc_cb(*this) + , m_out_wg_cb(*this) + , m_in_drdy_cb(*this) + , m_in_index_cb(*this) + , m_in_wf_cb(*this) + , m_in_tk000_cb(*this) + , m_in_sc_cb(*this) + , m_status(0) + , m_error(0) { } @@ -246,10 +248,10 @@ READ8_MEMBER(wd2010_device::read) if (offset == TASK_FILE_SDH_REGISTER) { - logerror("(READ) %s WD2010 '%s' SDH: %u\n", machine().describe_context(), tag(), data); - logerror("(READ) %s WD2010 '%s' Head: %u\n", machine().describe_context(), tag(), HEAD); - logerror("(READ) %s WD2010 '%s' Drive: %u\n", machine().describe_context(), tag(), DRIVE); - logerror("(READ) %s WD2010 '%s' Sector Size: %u\n", machine().describe_context(), tag(), SECTOR_SIZE); + logerror("(READ) %s WD2010 SDH: %u\n", machine().describe_context(), data); + logerror("(READ) %s WD2010 Head: %u\n", machine().describe_context(), HEAD); + logerror("(READ) %s WD2010 Drive: %u\n", machine().describe_context(), DRIVE); + logerror("(READ) %s WD2010 Sector Size: %u\n", machine().describe_context(), SECTOR_SIZE); } break; @@ -270,33 +272,30 @@ WRITE8_MEMBER(wd2010_device::write) switch (offset) { case TASK_FILE_WRITE_PRECOMP_CYLINDER: - if (LOG) logerror("%s WD2010 '%s' Write Precomp Cylinder: %u\n", machine().describe_context(), tag(), WRITE_PRECOMP_CYLINDER); + LOG("%s WD2010 Write Precomp Cylinder: %u\n", machine().describe_context(), WRITE_PRECOMP_CYLINDER); break; case TASK_FILE_SECTOR_COUNT: - if (LOG) logerror("%s WD2010 '%s' Sector Count: %u\n", machine().describe_context(), tag(), SECTOR_COUNT); + LOG("%s WD2010 Sector Count: %u\n", machine().describe_context(), SECTOR_COUNT); break; case TASK_FILE_SECTOR_NUMBER: - if (LOG) logerror("%s WD2010 '%s' Sector Number: %u\n", machine().describe_context(), tag(), SECTOR_NUMBER); + LOG("%s WD2010 Sector Number: %u\n", machine().describe_context(), SECTOR_NUMBER); break; case TASK_FILE_CYLINDER_LOW: - if (LOG) logerror("%s WD2010 '%s' Cylinder (lower bits set): %u\n", machine().describe_context(), tag(), CYLINDER); + LOG("%s WD2010 Cylinder (lower bits set): %u\n", machine().describe_context(), CYLINDER); break; case TASK_FILE_CYLINDER_HIGH: - if (LOG) logerror("%s WD2010 '%s' Cylinder (MSB bits set): %u\n", machine().describe_context(), tag(), CYLINDER); + LOG("%s WD2010 Cylinder (MSB bits set): %u\n", machine().describe_context(), CYLINDER); break; case TASK_FILE_SDH_REGISTER: - if (LOG) - { - logerror("(WRITE) %s WD2010 '%s' SDH: %u\n", machine().describe_context(), tag(), data); - logerror("(WRITE) %s WD2010 '%s' Head: %u\n", machine().describe_context(), tag(), HEAD); - logerror("(WRITE) %s WD2010 '%s' Drive: %u\n", machine().describe_context(), tag(), DRIVE); - logerror("(WRITE) %s WD2010 '%s' Sector Size: %u\n", machine().describe_context(), tag(), SECTOR_SIZE); - } + LOG("(WRITE) %s WD2010 SDH: %u\n", machine().describe_context(), data); + LOG("(WRITE) %s WD2010 Head: %u\n", machine().describe_context(), HEAD); + LOG("(WRITE) %s WD2010 Drive: %u\n", machine().describe_context(), DRIVE); + LOG("(WRITE) %s WD2010 Sector Size: %u\n", machine().describe_context(), SECTOR_SIZE); break; case TASK_FILE_COMMAND: @@ -306,12 +305,12 @@ WRITE8_MEMBER(wd2010_device::write) if (data == COMMAND_COMPUTE_CORRECTION) { - if (LOG) logerror("%s WD2010 '%s' COMPUTE CORRECTION\n", machine().describe_context(), tag()); + LOG("%s WD2010 COMPUTE CORRECTION\n", machine().describe_context()); compute_correction(data); } else if ((data & COMMAND_SET_PARAMETER_MASK) == COMMAND_SET_PARAMETER) { - if (LOG) logerror("%s WD2010 '%s' SET PARAMETER\n", machine().describe_context(), tag()); + LOG("%s WD2010 SET PARAMETER\n", machine().describe_context()); set_parameter(data); } else @@ -319,32 +318,32 @@ WRITE8_MEMBER(wd2010_device::write) switch (data & COMMAND_MASK) { case COMMAND_RESTORE: - if (LOG) logerror("%s WD2010 '%s' RESTORE\n", machine().describe_context(), tag()); + LOG("%s WD2010 RESTORE\n", machine().describe_context()); restore(data); break; case COMMAND_SEEK: - if (LOG) logerror("%s WD2010 '%s' SEEK\n", machine().describe_context(), tag()); + LOG("%s WD2010 SEEK\n", machine().describe_context()); seek(data); break; case COMMAND_READ_SECTOR: - if (LOG) logerror("%s WD2010 '%s' READ SECTOR (I = %u) (M = %u)\n", machine().describe_context(), tag(), ((data & 8)>0), ((data & 4)>0)); + LOG("%s WD2010 READ SECTOR (I = %u) (M = %u)\n", machine().describe_context(), ((data & 8)>0), ((data & 4)>0)); read_sector(data); break; case COMMAND_WRITE_SECTOR: - if (LOG) logerror("%s WD2010 '%s' WRITE SECTOR (M = %u)\n", machine().describe_context(), tag(), ((data & 4) > 0)); + LOG("%s WD2010 WRITE SECTOR (M = %u)\n", machine().describe_context(), ((data & 4) > 0)); write_sector(data); break; case COMMAND_SCAN_ID: - if (LOG) logerror("%s WD2010 '%s' SCAN ID\n", machine().describe_context(), tag()); + LOG("%s WD2010 SCAN ID\n", machine().describe_context()); scan_id(data); break; case COMMAND_WRITE_FORMAT: - if (LOG) logerror("%s WD2010 '%s' WRITE FORMAT\n", machine().describe_context(), tag()); + LOG("%s WD2010 WRITE FORMAT\n", machine().describe_context()); format(data); break; } |