summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/imagedev/mfmhd.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/imagedev/mfmhd.cpp')
-rw-r--r--src/devices/imagedev/mfmhd.cpp58
1 files changed, 29 insertions, 29 deletions
diff --git a/src/devices/imagedev/mfmhd.cpp b/src/devices/imagedev/mfmhd.cpp
index 312c597a31c..47a3dbc6125 100644
--- a/src/devices/imagedev/mfmhd.cpp
+++ b/src/devices/imagedev/mfmhd.cpp
@@ -444,12 +444,12 @@ image_init_result mfm_harddisk_device::call_load()
return image_init_result::FAIL;
}
- if (TRACE_CONFIG) logerror("CHD metadata: %s\n", metadata.c_str());
+ if (IS_ENABLED(TRACE_CONFIG)) logerror("CHD metadata: %s\n", metadata.c_str());
// Parse the metadata
mfmhd_layout_params param;
param.encoding = m_encoding;
- if (TRACE_CONFIG) logerror("Set encoding to %d\n", m_encoding);
+ if (IS_ENABLED(TRACE_CONFIG)) logerror("Set encoding to %d\n", m_encoding);
if (sscanf(metadata.c_str(), HARD_DISK_METADATA_FORMAT, &param.cylinders, &param.heads, &param.sectors_per_track, &param.sector_size) != 4)
{
@@ -457,7 +457,7 @@ image_init_result mfm_harddisk_device::call_load()
return image_init_result::FAIL;
}
- if (TRACE_CONFIG) logerror("CHD image has geometry cyl=%d, head=%d, sect=%d, size=%d\n", param.cylinders, param.heads, param.sectors_per_track, param.sector_size);
+ if (IS_ENABLED(TRACE_CONFIG)) logerror("CHD image has geometry cyl=%d, head=%d, sect=%d, size=%d\n", param.cylinders, param.heads, param.sectors_per_track, param.sector_size);
if (m_max_cylinders != 0 && (param.cylinders != m_max_cylinders || param.heads != m_max_heads))
{
@@ -483,11 +483,11 @@ image_init_result mfm_harddisk_device::call_load()
if (!param.sane_rec())
{
- if (TRACE_CONFIG) logerror("Sector arrangement/recording specs have invalid values, applying defaults\n");
+ if (IS_ENABLED(TRACE_CONFIG)) logerror("Sector arrangement/recording specs have invalid values, applying defaults\n");
param.reset_rec();
}
else
- if (TRACE_CONFIG) logerror("MFM HD rec specs: interleave=%d, cylskew=%d, headskew=%d, wpcom=%d, rwc=%d\n",
+ if (IS_ENABLED(TRACE_CONFIG)) logerror("MFM HD rec specs: interleave=%d, cylskew=%d, headskew=%d, wpcom=%d, rwc=%d\n",
param.interleave, param.cylskew, param.headskew, param.write_precomp_cylinder, param.reduced_wcurr_cylinder);
state = chdfile->read_metadata(MFM_HARD_DISK_METADATA_TAG, 1, metadata);
@@ -502,11 +502,11 @@ image_init_result mfm_harddisk_device::call_load()
if (!param.sane_gap())
{
- if (TRACE_CONFIG) logerror("MFM HD gap specs have invalid values, applying defaults\n");
+ if (IS_ENABLED(TRACE_CONFIG)) logerror("MFM HD gap specs have invalid values, applying defaults\n");
param.reset_gap();
}
else
- if (TRACE_CONFIG) logerror("MFM HD gap specs: gap1=%d, gap2=%d, gap3=%d, sync=%d, headerlen=%d, ecctype=%d\n",
+ if (IS_ENABLED(TRACE_CONFIG)) logerror("MFM HD gap specs: gap1=%d, gap2=%d, gap3=%d, sync=%d, headerlen=%d, ecctype=%d\n",
param.gap1, param.gap2, param.gap3, param.sync, param.headerlen, param.ecctype);
m_format->set_layout_params(param);
@@ -527,7 +527,7 @@ image_init_result mfm_harddisk_device::call_load()
float realmax = (m_maxseek_time==0)? (m_actual_cylinders * 0.2) : (m_maxseek_time * 0.8);
float settle_us = ((m_actual_cylinders-1.0) * realnext - realmax) / (m_actual_cylinders-2.0) * 1000;
float step_us = realnext * 1000 - settle_us;
- if (TRACE_CONFIG) logerror("Calculated settle time: %0.2f ms, step: %d us\n", settle_us/1000, (int)step_us);
+ if (IS_ENABLED(TRACE_CONFIG)) logerror("Calculated settle time: %0.2f ms, step: %d us\n", settle_us/1000, (int)step_us);
m_settle_time = attotime::from_usec((int)settle_us);
m_step_time = attotime::from_usec((int)step_us);
@@ -612,7 +612,7 @@ attotime mfm_harddisk_device::track_end_time()
if (!m_revolution_start_time.is_never())
{
endtime = m_revolution_start_time + nexttime;
- if (TRACE_TIMING) logerror("Track start time = %s, end time = %s\n", tts(m_revolution_start_time).c_str(), tts(endtime).c_str());
+ if (IS_ENABLED(TRACE_TIMING)) logerror("Track start time = %s, end time = %s\n", tts(m_revolution_start_time).c_str(), tts(endtime).c_str());
}
return endtime;
}
@@ -654,7 +654,7 @@ void mfm_harddisk_device::device_timer(emu_timer &timer, device_timer_id id, int
// Start the settle timer
m_step_phase = STEP_SETTLE;
m_seek_timer->adjust(m_settle_time);
- if (TRACE_STEPS && TRACE_DETAIL) logerror("Arrived at target cylinder %d, settling ...\n", m_current_cylinder);
+ if (IS_ENABLED(TRACE_STEPS && TRACE_DETAIL)) logerror("Arrived at target cylinder %d, settling ...\n", m_current_cylinder);
}
else
{
@@ -672,12 +672,12 @@ void mfm_harddisk_device::device_timer(emu_timer &timer, device_timer_id id, int
{
m_ready = true;
m_recalibrated = true;
- if (TRACE_STATE) logerror("Spinup complete, drive recalibrated and positioned at cylinder %d; drive is READY\n", m_current_cylinder);
+ if (IS_ENABLED(TRACE_STATE)) logerror("Spinup complete, drive recalibrated and positioned at cylinder %d; drive is READY\n", m_current_cylinder);
if (!m_ready_cb.isnull()) m_ready_cb(this, ASSERT_LINE);
}
else
{
- if (TRACE_SIGNALS) logerror("Settling done at cylinder %d, seek complete\n", m_current_cylinder);
+ if (IS_ENABLED(TRACE_SIGNALS)) logerror("Settling done at cylinder %d, seek complete\n", m_current_cylinder);
}
m_seek_complete = true;
if (!m_seek_complete_cb.isnull()) m_seek_complete_cb(this, ASSERT_LINE);
@@ -690,7 +690,7 @@ void mfm_harddisk_device::device_timer(emu_timer &timer, device_timer_id id, int
void mfm_harddisk_device::recalibrate()
{
- if (TRACE_STEPS) logerror("Recalibrate to track 0\n");
+ if (IS_ENABLED(TRACE_STEPS)) logerror("Recalibrate to track 0\n");
direction_in_w(CLEAR_LINE);
while (-m_track_delta < m_phys_cylinders)
{
@@ -703,13 +703,13 @@ void mfm_harddisk_device::head_move()
{
int steps = m_track_delta;
if (steps < 0) steps = -steps;
- if (TRACE_STEPS) logerror("Moving head by %d step(s) %s\n", steps, (m_track_delta<0)? "outward" : "inward");
+ if (IS_ENABLED(TRACE_STEPS)) logerror("Moving head by %d step(s) %s\n", steps, (m_track_delta<0)? "outward" : "inward");
// We simulate the head movement by pausing for n*step_time with n being the cylinder delta
m_step_phase = STEP_MOVING;
m_seek_timer->adjust(m_step_time * steps);
- if (TRACE_TIMING) logerror("Head movement takes %s time\n", tts(m_step_time * steps).c_str());
+ if (IS_ENABLED(TRACE_TIMING)) logerror("Head movement takes %s time\n", tts(m_step_time * steps).c_str());
// We pretend that we already arrived
// TODO: Check auto truncation?
m_current_cylinder += m_track_delta;
@@ -721,7 +721,7 @@ void mfm_harddisk_device::head_move()
void mfm_harddisk_device::direction_in_w(line_state line)
{
m_seek_inward = (line == ASSERT_LINE);
- if (TRACE_STEPS && TRACE_DETAIL) logerror("Setting seek direction %s\n", m_seek_inward? "inward" : "outward");
+ if (IS_ENABLED(TRACE_STEPS && TRACE_DETAIL)) logerror("Setting seek direction %s\n", m_seek_inward? "inward" : "outward");
}
/*
@@ -772,10 +772,10 @@ void mfm_harddisk_device::step_w(line_state line)
// Counter will be adjusted according to the direction (+-1)
m_track_delta += (m_seek_inward)? +1 : -1;
- if (TRACE_STEPS && TRACE_DETAIL) logerror("Got seek pulse; track delta %d\n", m_track_delta);
+ if (IS_ENABLED(TRACE_STEPS && TRACE_DETAIL)) logerror("Got seek pulse; track delta %d\n", m_track_delta);
if (m_track_delta < -m_phys_cylinders || m_track_delta > m_phys_cylinders)
{
- if (TRACE_STEPS) logerror("Excessive step pulses - doing auto-truncation\n");
+ if (IS_ENABLED(TRACE_STEPS)) logerror("Excessive step pulses - doing auto-truncation\n");
m_autotruncation = true;
}
m_seek_timer->adjust(attotime::from_usec(250)); // Start step collect timer
@@ -808,7 +808,7 @@ bool mfm_harddisk_device::find_position(attotime &from_when, const attotime &lim
// Reached the end
if (bytepos >= m_trackimage_size)
{
- if (TRACE_TIMING) logerror("Reached end: rev_start = %s, live = %s\n", tts(m_revolution_start_time).c_str(), tts(from_when).c_str());
+ if (IS_ENABLED(TRACE_TIMING)) logerror("Reached end: rev_start = %s, live = %s\n", tts(m_revolution_start_time).c_str(), tts(from_when).c_str());
m_revolution_start_time += m_rev_time;
cell = (from_when - m_revolution_start_time).as_ticks(freq);
bytepos = cell / 16;
@@ -816,7 +816,7 @@ bool mfm_harddisk_device::find_position(attotime &from_when, const attotime &lim
if (bytepos < 0)
{
- if (TRACE_TIMING) logerror("Negative cell number: rev_start = %s, live = %s\n", tts(m_revolution_start_time).c_str(), tts(from_when).c_str());
+ if (IS_ENABLED(TRACE_TIMING)) logerror("Negative cell number: rev_start = %s, live = %s\n", tts(m_revolution_start_time).c_str(), tts(from_when).c_str());
bytepos = 0;
}
bit = cell % 16;
@@ -853,12 +853,12 @@ bool mfm_harddisk_device::read(attotime &from_when, const attotime &limit, uint1
{
// We will deliver a single bit
cdata = ((track[bytepos] << bitpos) & 0x8000) >> 15;
- if (TRACE_BITS) logerror("Reading (c=%d,h=%d,bit=%d) at cell %d [%s] = %d\n", m_current_cylinder, m_current_head, bitpos, ((bytepos<<4) + bitpos), tts(fw).c_str(), cdata);
+ if (IS_ENABLED(TRACE_BITS)) logerror("Reading (c=%d,h=%d,bit=%d) at cell %d [%s] = %d\n", m_current_cylinder, m_current_head, bitpos, ((bytepos<<4) + bitpos), tts(fw).c_str(), cdata);
}
else
{
// We will deliver a whole byte
- if (TRACE_READ) logerror("Reading (c=%d,h=%d) at position %d\n", m_current_cylinder, m_current_head, bytepos);
+ if (IS_ENABLED(TRACE_READ)) logerror("Reading (c=%d,h=%d) at position %d\n", m_current_cylinder, m_current_head, bytepos);
cdata = track[bytepos];
}
return false;
@@ -911,7 +911,7 @@ bool mfm_harddisk_device::write(attotime &from_when, const attotime &limit, uint
if (wpcom && (params->write_precomp_cylinder == -1 || m_current_cylinder < params->write_precomp_cylinder))
params->write_precomp_cylinder = m_current_cylinder;
- if (TRACE_WRITE) if ((bitpos&0x0f)==0) logerror("Wrote data=%04x (c=%d,h=%d) at position %04x, wpcom=%d, rwc=%d\n", track[bytepos], m_current_cylinder, m_current_head, bytepos, wpcom, reduced_wc);
+ if (IS_ENABLED(TRACE_WRITE)) if ((bitpos&0x0f)==0) logerror("Wrote data=%04x (c=%d,h=%d) at position %04x, wpcom=%d, rwc=%d\n", track[bytepos], m_current_cylinder, m_current_head, bytepos, wpcom, reduced_wc);
return false;
}
@@ -999,7 +999,7 @@ mfmhd_trackimage_cache::mfmhd_trackimage_cache(running_machine &machine):
mfmhd_trackimage_cache::~mfmhd_trackimage_cache()
{
mfmhd_trackimage* current = m_tracks;
- if (TRACE_CACHE) m_machine.logerror("[%s:cache] MFM HD cache destroy\n", m_mfmhd->tag());
+ if (IS_ENABLED(TRACE_CACHE)) m_machine.logerror("[%s:cache] MFM HD cache destroy\n", m_mfmhd->tag());
while (current != nullptr)
{
@@ -1030,12 +1030,12 @@ void mfmhd_trackimage_cache::write_back_one()
void mfmhd_trackimage_cache::cleanup()
{
mfmhd_trackimage* current = m_tracks;
- if (TRACE_CACHE) m_machine.logerror("[%s:cache] MFM HD cache cleanup\n", m_mfmhd->tag());
+ if (IS_ENABLED(TRACE_CACHE)) m_machine.logerror("[%s:cache] MFM HD cache cleanup\n", m_mfmhd->tag());
// Still dirty?
while (current != nullptr)
{
- if (TRACE_CACHE) m_machine.logerror("[%s:cache] MFM HD cache: evict line cylinder=%d head=%d\n", m_mfmhd->tag(), current->cylinder, current->head);
+ if (IS_ENABLED(TRACE_CACHE)) m_machine.logerror("[%s:cache] MFM HD cache: evict line cylinder=%d head=%d\n", m_mfmhd->tag(), current->cylinder, current->head);
if (current->dirty)
{
m_mfmhd->write_track(current->encdata, current->cylinder, current->head);
@@ -1062,7 +1062,7 @@ const char *encnames[] = { "MFM_BITS","MFM_BYTE","SEPARATE","SSIMPLE " };
*/
void mfmhd_trackimage_cache::init(mfm_harddisk_device* mfmhd, int tracksize, int trackslots)
{
- if (TRACE_CACHE) m_machine.logerror("[%s:cache] MFM HD cache init; cache size is %d tracks\n", mfmhd->tag(), trackslots);
+ if (IS_ENABLED(TRACE_CACHE)) m_machine.logerror("[%s:cache] MFM HD cache init; cache size is %d tracks\n", mfmhd->tag(), trackslots);
chd_error state;
@@ -1078,7 +1078,7 @@ void mfmhd_trackimage_cache::init(mfm_harddisk_device* mfmhd, int tracksize, int
while (track < trackslots)
{
- if (TRACE_CACHE && TRACE_DETAIL) m_machine.logerror("[%s:cache] MFM HD allocate cache slot\n", mfmhd->tag());
+ if (IS_ENABLED(TRACE_CACHE && TRACE_DETAIL)) m_machine.logerror("[%s:cache] MFM HD allocate cache slot\n", mfmhd->tag());
previous = current;
current = global_alloc(mfmhd_trackimage);
current->encdata = global_alloc_array(uint16_t, tracksize);
@@ -1157,7 +1157,7 @@ uint16_t* mfmhd_trackimage_cache::get_trackimage(int cylinder, int head)
// previous points to the second to last element
current = previous->next;
- if (TRACE_CACHE) m_machine.logerror("[%s:cache] evict line (c=%d,h=%d)\n", m_mfmhd->tag(), current->cylinder, current->head);
+ if (IS_ENABLED(TRACE_CACHE)) m_machine.logerror("[%s:cache] evict line (c=%d,h=%d)\n", m_mfmhd->tag(), current->cylinder, current->head);
if (current->dirty)
{