diff options
Diffstat (limited to 'src/devices/machine/hdc92x4.cpp')
-rw-r--r-- | src/devices/machine/hdc92x4.cpp | 422 |
1 files changed, 211 insertions, 211 deletions
diff --git a/src/devices/machine/hdc92x4.cpp b/src/devices/machine/hdc92x4.cpp index c2659edcfd0..54a8f802b99 100644 --- a/src/devices/machine/hdc92x4.cpp +++ b/src/devices/machine/hdc92x4.cpp @@ -431,7 +431,7 @@ const hdc92x4_device::cmddef hdc92x4_device::s_command[] = /* Standard constructor for the base class and the two variants */ -hdc92x4_device::hdc92x4_device(const machine_config &mconfig, device_type type, const char *name, std::string tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) +hdc92x4_device::hdc92x4_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) : device_t(mconfig, type, name, tag, owner, clock, shortname, source), m_out_intrq(*this), m_out_dmarq(*this), @@ -443,13 +443,13 @@ hdc92x4_device::hdc92x4_device(const machine_config &mconfig, device_type type, { } -hdc9224_device::hdc9224_device(const machine_config &mconfig, std::string tag, device_t *owner, UINT32 clock) +hdc9224_device::hdc9224_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : hdc92x4_device(mconfig, HDC9224, "SMC HDC9224 Universal Disk Controller", tag, owner, clock, "hdc9224", __FILE__) { m_is_hdc9234 = false; } -hdc9234_device::hdc9234_device(const machine_config &mconfig, std::string tag, device_t *owner, UINT32 clock) +hdc9234_device::hdc9234_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : hdc92x4_device(mconfig, HDC9234, "SMC HDC9234 Universal Disk Controller", tag, owner, clock, "hdc9234", __FILE__) { m_is_hdc9234 = true; @@ -622,7 +622,7 @@ void hdc92x4_device::wait_time(emu_timer *tm, int microsec, int next_substate) void hdc92x4_device::wait_time(emu_timer *tm, const attotime &delay, int param) { - if (TRACE_DELAY) logerror("%s: [%s] Delaying by %4.2f microsecs\n", tag().c_str(), ttsn().c_str(), delay.as_double()*1000000); + if (TRACE_DELAY) logerror("%s: [%s] Delaying by %4.2f microsecs\n", tag(), ttsn().c_str(), delay.as_double()*1000000); tm->adjust(delay); m_substate = param; m_state_after_line = UNDEF; @@ -639,19 +639,19 @@ void hdc92x4_device::wait_line(int line, line_state level, int substate, bool st if (line == SEEKCOMP_LINE && (seek_complete() == (level==ASSERT_LINE))) { - if (TRACE_LINES) logerror("%s: SEEK_COMPLETE line is already %d\n", tag().c_str(), level); + if (TRACE_LINES) logerror("%s: SEEK_COMPLETE line is already %d\n", tag(), level); } else { if (line == INDEX_LINE && (index_hole() == (level==ASSERT_LINE))) { - if (TRACE_LINES) logerror("%s: INDEX line is already %d\n", tag().c_str(), level); + if (TRACE_LINES) logerror("%s: INDEX line is already %d\n", tag(), level); } else { if (line == READY_LINE && (drive_ready() == (level==ASSERT_LINE))) { - if (TRACE_LINES) logerror("%s: READY line is already %d\n", tag().c_str(), level); + if (TRACE_LINES) logerror("%s: READY line is already %d\n", tag(), level); } else { @@ -698,7 +698,7 @@ void hdc92x4_device::read_id(int& cont, bool implied_seek, bool wait_seek_comple { case READ_ID: // Implied seek: Enter the READ_ID subprogram. - if (TRACE_READID && TRACE_SUBSTATES) logerror("%s: substate READ_ID\n", tag().c_str()); + if (TRACE_READID && TRACE_SUBSTATES) logerror("%s: substate READ_ID\n", tag()); // First step: Search the next IDAM, and if found, read the // ID values into the registers @@ -716,22 +716,22 @@ void hdc92x4_device::read_id(int& cont, bool implied_seek, bool wait_seek_comple // If an error occurred (no IDAM found), terminate the command if ((m_register_r[CHIP_STATUS] & CS_SYNCERR) != 0) { - if (TRACE_FAIL) logerror("%s: READ_ID failed to find any IDAM\n", tag().c_str()); + if (TRACE_FAIL) logerror("%s: READ_ID failed to find any IDAM\n", tag()); cont = ERROR; break; } if (TRACE_READID) { - if (TRACE_SUBSTATES) logerror("%s: substate READ_ID1\n", tag().c_str()); - logerror("%s: DESIRED_CYL = %d; CURRENT_CYL = %d\n", tag().c_str(), desired_cylinder(), current_cylinder()); + if (TRACE_SUBSTATES) logerror("%s: substate READ_ID1\n", tag()); + logerror("%s: DESIRED_CYL = %d; CURRENT_CYL = %d\n", tag(), desired_cylinder(), current_cylinder()); } // The CRC has been updated automatically with each read_one_bit during the live_run. // We just need to check whether it ended in 0000 if (m_live_state.crc != 0) { - if (TRACE_FAIL) logerror("%s: CRC error in sector header\n", tag().c_str()); + if (TRACE_FAIL) logerror("%s: CRC error in sector header\n", tag()); set_bits(m_register_r[CHIP_STATUS], CS_CRCERR, true); cont = ERROR; break; @@ -752,7 +752,7 @@ void hdc92x4_device::read_id(int& cont, bool implied_seek, bool wait_seek_comple if (wait_seek_complete) { // We have to wait for SEEK COMPLETE - if (TRACE_READID && TRACE_SUBSTATES) logerror("%s: Waiting for SEEK COMPLETE\n", tag().c_str()); + if (TRACE_READID && TRACE_SUBSTATES) logerror("%s: Waiting for SEEK COMPLETE\n", tag()); wait_line(SEEKCOMP_LINE, ASSERT_LINE, READ_ID_SEEK_COMPLETE, false); cont = WAIT; } @@ -765,7 +765,7 @@ void hdc92x4_device::read_id(int& cont, bool implied_seek, bool wait_seek_comple break; } - if (TRACE_READID && TRACE_SUBSTATES) logerror("%s: substate STEP_ON\n", tag().c_str()); + if (TRACE_READID && TRACE_SUBSTATES) logerror("%s: substate STEP_ON\n", tag()); // STEPDIR = 0 -> towards TRK00 set_bits(m_output2, OUT2_STEPDIR, (m_track_delta>0)); set_bits(m_output2, OUT2_STEPPULSE, true); @@ -774,7 +774,7 @@ void hdc92x4_device::read_id(int& cont, bool implied_seek, bool wait_seek_comple break; case READ_ID_STEPOFF: - if (TRACE_READID && TRACE_SUBSTATES) logerror("%s: substate STEP_OFF\n", tag().c_str()); + if (TRACE_READID && TRACE_SUBSTATES) logerror("%s: substate STEP_OFF\n", tag()); set_bits(m_output2, OUT2_STEPPULSE, false); m_track_delta += (m_track_delta<0)? 1 : -1; // Return to STEP_ON, check whether there are more steps @@ -788,7 +788,7 @@ void hdc92x4_device::read_id(int& cont, bool implied_seek, bool wait_seek_comple break; default: - logerror("%s: BUG: Unknown substate %02x in read_id, aborting command\n", tag().c_str(), m_substate); + logerror("%s: BUG: Unknown substate %02x in read_id, aborting command\n", tag(), m_substate); cont = ERROR; } } @@ -820,8 +820,8 @@ void hdc92x4_device::verify(int& cont) // After seeking (or immediately when implied seek has been disabled), // find the desired sector. - if (TRACE_VERIFY && TRACE_SUBSTATES) logerror("%s: substate VERIFY\n", tag().c_str()); - if (TRACE_VERIFY) logerror("%s: VERIFY: Find sector CHS=(%d,%d,%d)\n", tag().c_str(), + if (TRACE_VERIFY && TRACE_SUBSTATES) logerror("%s: substate VERIFY\n", tag()); + if (TRACE_VERIFY) logerror("%s: VERIFY: Find sector CHS=(%d,%d,%d)\n", tag(), desired_cylinder(), desired_head(), desired_sector()); @@ -830,7 +830,7 @@ void hdc92x4_device::verify(int& cont) // (This test is only relevant when we did not have a seek phase before) if ((m_register_r[CHIP_STATUS] & CS_SYNCERR) != 0) { - if (TRACE_FAIL) logerror("%s: VERIFY failed to find any IDAM\n", tag().c_str()); + if (TRACE_FAIL) logerror("%s: VERIFY failed to find any IDAM\n", tag()); cont = ERROR; break; } @@ -846,7 +846,7 @@ void hdc92x4_device::verify(int& cont) && desired_head() == current_head() && desired_sector() == current_sector()) { - if (TRACE_VERIFY) logerror("%s: Found the desired sector CHS=(%d,%d,%d)\n", tag().c_str(), + if (TRACE_VERIFY) logerror("%s: Found the desired sector CHS=(%d,%d,%d)\n", tag(), desired_cylinder(), desired_head(), desired_sector()); @@ -856,7 +856,7 @@ void hdc92x4_device::verify(int& cont) } else { - if (TRACE_VERIFY && TRACE_DETAIL) logerror("%s: Current CHS=(%d,%d,%d), desired CHS=(%d,%d,%d).\n", tag().c_str(), + if (TRACE_VERIFY && TRACE_DETAIL) logerror("%s: Current CHS=(%d,%d,%d), desired CHS=(%d,%d,%d).\n", tag(), current_cylinder(), current_head(), current_sector(), @@ -875,10 +875,10 @@ void hdc92x4_device::verify(int& cont) break; case VERIFY3: - if (TRACE_VERIFY) logerror("%s: Next IDAM found; total bytes read: %d\n", tag().c_str(), m_live_state.bit_count_total / 16); + if (TRACE_VERIFY) logerror("%s: Next IDAM found; total bytes read: %d\n", tag(), m_live_state.bit_count_total / 16); if ((m_register_r[CHIP_STATUS] & CS_COMPERR) != 0) { - if (TRACE_FAIL) logerror("%s: VERIFY failed to find sector CHS=(%d,%d,%d)\n", tag().c_str(), desired_cylinder(), desired_head(), desired_sector()); + if (TRACE_FAIL) logerror("%s: VERIFY failed to find sector CHS=(%d,%d,%d)\n", tag(), desired_cylinder(), desired_head(), desired_sector()); cont = ERROR; break; } @@ -900,7 +900,7 @@ void hdc92x4_device::verify(int& cont) break; default: - logerror("%s: BUG: Unknown substate %02x in verify, aborting command\n", tag().c_str(), m_substate); + logerror("%s: BUG: Unknown substate %02x in verify, aborting command\n", tag(), m_substate); cont = ERROR; } } @@ -931,7 +931,7 @@ void hdc92x4_device::data_transfer(int& cont) switch (m_substate) { case DATA_TRANSFER: - if (TRACE_TRANSFER && TRACE_SUBSTATES) logerror("%s: substate DATA_TRANSFER (%s)\n", tag().c_str(), m_write? "write" : "read"); + if (TRACE_TRANSFER && TRACE_SUBSTATES) logerror("%s: substate DATA_TRANSFER (%s)\n", tag(), m_write? "write" : "read"); // Count from 0 again m_live_state.bit_count_total = 0; @@ -941,12 +941,12 @@ void hdc92x4_device::data_transfer(int& cont) if (TRACE_TRANSFER && TRACE_DETAIL) { if (m_logical) - logerror("%s: %s sector CHS=(%d,%d,%d)\n", tag().c_str(), m_write? "Write" : "Read", + logerror("%s: %s sector CHS=(%d,%d,%d)\n", tag(), m_write? "Write" : "Read", desired_cylinder(), desired_head(), desired_sector()); else - logerror("%s: %s next sector on track\n", tag().c_str(), m_write? "Write" : "Read"); + logerror("%s: %s next sector on track\n", tag(), m_write? "Write" : "Read"); } if (m_write) @@ -974,12 +974,12 @@ void hdc92x4_device::data_transfer(int& cont) // Decrement the retry register (one's complemented value; 0000 = 15) int retry = 15-((m_register_w[RETRY_COUNT] >> 4)&0x0f); - if (TRACE_FAIL) logerror("%s: DATA TRANSFER got CRC error in sector data, retries = %d\n", tag().c_str(), retry); + if (TRACE_FAIL) logerror("%s: DATA TRANSFER got CRC error in sector data, retries = %d\n", tag(), retry); m_register_w[RETRY_COUNT] = (m_register_w[RETRY_COUNT] & 0x0f) | ((15-(retry-1))<<4); if (retry == 0) { - if (TRACE_FAIL) logerror("%s: CRC error; no retries left\n", tag().c_str()); + if (TRACE_FAIL) logerror("%s: CRC error; no retries left\n", tag()); set_bits(m_register_r[CHIP_STATUS], CS_CRCERR, true); cont = ERROR; } @@ -997,7 +997,7 @@ void hdc92x4_device::data_transfer(int& cont) } else { - if (TRACE_TRANSFER) logerror("%s: Sector successfully read (count=%d)\n", tag().c_str(), m_register_w[SECTOR_COUNT]-1); + if (TRACE_TRANSFER) logerror("%s: Sector successfully read (count=%d)\n", tag(), m_register_w[SECTOR_COUNT]-1); // Update the DMA registers for multi-sector operations if (m_multi_sector) @@ -1011,7 +1011,7 @@ void hdc92x4_device::data_transfer(int& cont) m_register_w[DMA23_16] = m_register_r[DMA23_16] = (dma_address & 0xff0000) >> 16; m_register_w[DMA15_8] = m_register_r[DMA15_8] = (dma_address & 0x00ff00) >> 8; m_register_w[DMA7_0] = m_register_r[DMA7_0] = (dma_address & 0x0000ff); - if (TRACE_TRANSFER) logerror("%s: New DMA address = %06x\n", tag().c_str(), dma_address); + if (TRACE_TRANSFER) logerror("%s: New DMA address = %06x\n", tag(), dma_address); } // Decrement the count @@ -1040,7 +1040,7 @@ void hdc92x4_device::data_transfer(int& cont) break; case DATA_TRANSFER_WRITE: - if (TRACE_TRANSFER) logerror("%s: Sector successfully written (count=%d)\n", tag().c_str(), m_register_w[SECTOR_COUNT]-1); + if (TRACE_TRANSFER) logerror("%s: Sector successfully written (count=%d)\n", tag(), m_register_w[SECTOR_COUNT]-1); // Update the DMA registers for multi-sector operations if (m_multi_sector) @@ -1054,7 +1054,7 @@ void hdc92x4_device::data_transfer(int& cont) m_register_w[DMA23_16] = m_register_r[DMA23_16] = (dma_address & 0xff0000) >> 16; m_register_w[DMA15_8] = m_register_r[DMA15_8] = (dma_address & 0x00ff00) >> 8; m_register_w[DMA7_0] = m_register_r[DMA7_0] = (dma_address & 0x0000ff); - if (TRACE_TRANSFER) logerror("%s: New DMA address = %06x\n", tag().c_str(), dma_address); + if (TRACE_TRANSFER) logerror("%s: New DMA address = %06x\n", tag(), dma_address); } // Decrement the count @@ -1072,7 +1072,7 @@ void hdc92x4_device::data_transfer(int& cont) break; default: - logerror("%s: BUG: Unknown substate %02x in data_transfer, aborting command\n", tag().c_str(), m_substate); + logerror("%s: BUG: Unknown substate %02x in data_transfer, aborting command\n", tag(), m_substate); cont = ERROR; } } @@ -1105,7 +1105,7 @@ void hdc92x4_device::data_transfer(int& cont) */ void hdc92x4_device::reset_controller() { - logerror("%s: RESET command\n", tag().c_str()); + logerror("%s: RESET command\n", tag()); device_reset(); } @@ -1122,7 +1122,7 @@ void hdc92x4_device::reset_controller() */ void hdc92x4_device::drive_deselect() { - if (TRACE_SELECT) logerror("%s: DESELECT command\n", tag().c_str()); + if (TRACE_SELECT) logerror("%s: DESELECT command\n", tag()); m_selected_drive_number = NODRIVE; m_output1 = 0x00; set_command_done(TC_SUCCESS); @@ -1151,7 +1151,7 @@ void hdc92x4_device::restore_drive() if (m_substate == UNDEF) { - if (TRACE_RESTORE) logerror("%s: RESTORE command %02x\n", tag().c_str(), current_command()); + if (TRACE_RESTORE) logerror("%s: RESTORE command %02x\n", tag(), current_command()); m_seek_count = 0; m_substate = RESTORE_CHECK; } @@ -1164,7 +1164,7 @@ void hdc92x4_device::restore_drive() // Track 0 has not been reached yet if (!drive_ready()) { - if (TRACE_RESTORE) logerror("%s: restore command: Drive not ready\n", tag().c_str()); + if (TRACE_RESTORE) logerror("%s: restore command: Drive not ready\n", tag()); // Does not look like a success, but this takes into account // that if a drive is not connected we do not want an error message cont = SUCCESS; @@ -1179,7 +1179,7 @@ void hdc92x4_device::restore_drive() // When we have buffered steps, the seek limit will be reached // before TRK00 is asserted. In that case we have to wait for // SEEK_COMPLETE. We also wait as soon as TRK00 is asserted. - if (TRACE_RESTORE) logerror("%s: restore using buffered steps\n", tag().c_str()); + if (TRACE_RESTORE) logerror("%s: restore using buffered steps\n", tag()); wait_line(SEEKCOMP_LINE, ASSERT_LINE, SEEK_COMPLETE, false); cont = WAIT; } @@ -1194,7 +1194,7 @@ void hdc92x4_device::restore_drive() break; case STEP_ON: - if (TRACE_RESTORE && TRACE_SUBSTATES) logerror("%s: [%s] substate STEP_ON\n", tag().c_str(), ttsn().c_str()); + if (TRACE_RESTORE && TRACE_SUBSTATES) logerror("%s: [%s] substate STEP_ON\n", tag(), ttsn().c_str()); // Increase step count m_seek_count++; @@ -1209,7 +1209,7 @@ void hdc92x4_device::restore_drive() break; case STEP_OFF: - if (TRACE_RESTORE && TRACE_SUBSTATES) logerror("%s: [%s] substate STEP_OFF\n", tag().c_str(), ttsn().c_str()); + if (TRACE_RESTORE && TRACE_SUBSTATES) logerror("%s: [%s] substate STEP_OFF\n", tag(), ttsn().c_str()); set_bits(m_output2, OUT2_STEPPULSE, false); wait_time(m_timer, step_time(), RESTORE_CHECK); cont = WAIT; @@ -1219,7 +1219,7 @@ void hdc92x4_device::restore_drive() // If TRK00 is not set, the drive failed to reach it. if (!on_track00()) { - if (TRACE_FAIL) logerror("%s: restore command: failed to reach track 00\n", tag().c_str()); + if (TRACE_FAIL) logerror("%s: restore command: failed to reach track 00\n", tag()); set_command_done(TC_VRFYERR); cont = ERROR; } @@ -1250,7 +1250,7 @@ void hdc92x4_device::step_drive() if (m_substate == UNDEF) { - if (TRACE_STEP) logerror("%s: STEP IN/OUT command %02x\n", tag().c_str(), current_command()); + if (TRACE_STEP) logerror("%s: STEP IN/OUT command %02x\n", tag(), current_command()); m_substate = STEP_ON; } @@ -1259,7 +1259,7 @@ void hdc92x4_device::step_drive() switch (m_substate) { case STEP_ON: - if (TRACE_STEP && TRACE_SUBSTATES) logerror("%s: substate STEP_ON\n", tag().c_str()); + if (TRACE_STEP && TRACE_SUBSTATES) logerror("%s: substate STEP_ON\n", tag()); // STEPDIR = 0 -> towards TRK00 set_bits(m_output2, OUT2_STEPDIR, (current_command() & 0x02)==0); @@ -1271,7 +1271,7 @@ void hdc92x4_device::step_drive() break; case STEP_OFF: - if (TRACE_STEP && TRACE_SUBSTATES) logerror("%s: substate STEP_OFF\n", tag().c_str()); + if (TRACE_STEP && TRACE_SUBSTATES) logerror("%s: substate STEP_OFF\n", tag()); set_bits(m_output2, OUT2_STEPPULSE, false); wait_time(m_timer, step_time(), ((current_command() & 0x01)!=0)? WAIT_SEEK_COMPLETE : DONE); cont = WAIT; @@ -1296,7 +1296,7 @@ void hdc92x4_device::step_drive() */ void hdc92x4_device::tape_backup() { - logerror("%s: TAPE BACKUP command %02x not implemented\n", tag().c_str(), current_command()); + logerror("%s: TAPE BACKUP command %02x not implemented\n", tag(), current_command()); set_command_done(TC_SUCCESS); } @@ -1322,7 +1322,7 @@ void hdc92x4_device::poll_drives() UINT8 drivebit; if (m_substate == UNDEF) { - logerror("%s: POLL DRIVES command %02x\n", tag().c_str(), current_command()); + logerror("%s: POLL DRIVES command %02x\n", tag(), current_command()); m_substate = POLL1; m_selected_drive_number = 0; // If there is no selection, do not enter the loop @@ -1344,7 +1344,7 @@ void hdc92x4_device::poll_drives() m_register_r[CHIP_STATUS] = (m_register_r[CHIP_STATUS] & 0xfc) | m_selected_drive_number; m_output1 = (drivebit << 4) | (m_register_w[RETRY_COUNT]&0x0f); - if (TRACE_AUXBUS) logerror("%s: Setting OUTPUT1 to %02x\n", tag().c_str(), m_output1); + if (TRACE_AUXBUS) logerror("%s: Setting OUTPUT1 to %02x\n", tag(), m_output1); wait_time(m_timer, 1, POLL2); // Wait for 1 usec cont = WAIT; } @@ -1419,7 +1419,7 @@ void hdc92x4_device::drive_select() head_load_delay = head_load_delay_enable? m_register_w[DATA] * head_load_timer_increment[m_selected_drive_type] : 0; if (fm_mode()) head_load_delay <<= 1; - if (TRACE_SELECT) logerror("%s: DRIVE SELECT command (%02x): head load delay=%d, type=%d, drive=%d, pout=%02x, step_rate=%d\n", tag().c_str(), current_command(), head_load_delay, m_selected_drive_type, driveparm&3, m_register_w[RETRY_COUNT]&0x0f, pulse_width() + step_time()); + if (TRACE_SELECT) logerror("%s: DRIVE SELECT command (%02x): head load delay=%d, type=%d, drive=%d, pout=%02x, step_rate=%d\n", tag(), current_command(), head_load_delay, m_selected_drive_type, driveparm&3, m_register_w[RETRY_COUNT]&0x0f, pulse_width() + step_time()); // Copy the DMA registers to registers CURRENT_HEAD, CURRENT_CYLINDER, // and CURRENT_IDENT. This is required during formatting ([1], p. 14) @@ -1433,7 +1433,7 @@ void hdc92x4_device::drive_select() m_output1 = (m_selected_drive_number != NODRIVE)? (0x10 << m_selected_drive_number) : 0; m_output1 |= (m_register_w[RETRY_COUNT]&0x0f); - if (TRACE_AUXBUS) logerror("%s: Setting OUTPUT1 to %02x\n", tag().c_str(), m_output1); + if (TRACE_AUXBUS) logerror("%s: Setting OUTPUT1 to %02x\n", tag(), m_output1); m_substate = (head_load_delay>0)? HEAD_DELAY : DONE; } @@ -1464,12 +1464,12 @@ void hdc92x4_device::drive_select() void hdc92x4_device::set_register_pointer() { m_register_pointer = current_command() & 0xf; - if (TRACE_SETPTR) logerror("%s: SET REGISTER POINTER command; start reg=%d\n", tag().c_str(), m_register_pointer); + if (TRACE_SETPTR) logerror("%s: SET REGISTER POINTER command; start reg=%d\n", tag(), m_register_pointer); // The specification does not say anything about the effect of setting an // invalid value (only "care should be taken") if (m_register_pointer > 10) { - logerror("%s: set register pointer: Invalid register number: %d. Setting to 10.\n", tag().c_str(), m_register_pointer); + logerror("%s: set register pointer: Invalid register number: %d. Setting to 10.\n", tag(), m_register_pointer); m_register_pointer = 10; } set_command_done(TC_SUCCESS); @@ -1495,7 +1495,7 @@ void hdc92x4_device::seek_read_id() if (m_substate == UNDEF) { // Command init - if (TRACE_READ) logerror("%s: SEEK / READ ID command %02x, CHS=(%d,%d,%d)\n", tag().c_str(), current_command(), desired_cylinder(), desired_head(), desired_sector()); + if (TRACE_READ) logerror("%s: SEEK / READ ID command %02x, CHS=(%d,%d,%d)\n", tag(), current_command(), desired_cylinder(), desired_head(), desired_sector()); m_substate = READ_ID; } @@ -1523,7 +1523,7 @@ void hdc92x4_device::seek_read_id() cont = SUCCESS; break; default: - logerror("%s: BUG: Unknown substate %02x in seek_read_id, aborting command\n", tag().c_str(), m_substate); + logerror("%s: BUG: Unknown substate %02x in seek_read_id, aborting command\n", tag(), m_substate); set_command_done(TC_DATAERR); cont = ERROR; } @@ -1560,7 +1560,7 @@ void hdc92x4_device::read_sectors() if (m_substate == UNDEF) { // Command init - if (TRACE_READ) logerror("%s: READ SECTORS %s command %02x, CHS=(%d,%d,%d)\n", tag().c_str(), m_logical? "LOGICAL": "PHYSICAL", current_command(), desired_cylinder(), desired_head(), desired_sector()); + if (TRACE_READ) logerror("%s: READ SECTORS %s command %02x, CHS=(%d,%d,%d)\n", tag(), m_logical? "LOGICAL": "PHYSICAL", current_command(), desired_cylinder(), desired_head(), desired_sector()); m_retry_save = m_register_w[RETRY_COUNT]; m_multi_sector = (m_register_w[SECTOR_COUNT] != 1); m_write = false; @@ -1586,7 +1586,7 @@ void hdc92x4_device::read_sectors() data_transfer(cont); break; default: - logerror("%s: BUG: Unknown substate %02x in read_sectors, aborting command\n", tag().c_str(), m_substate); + logerror("%s: BUG: Unknown substate %02x in read_sectors, aborting command\n", tag(), m_substate); set_command_done(TC_DATAERR); cont = ERROR; } @@ -1612,7 +1612,7 @@ void hdc92x4_device::read_track() { if (m_substate == UNDEF) { - if (TRACE_READTRACK) logerror("%s: READ TRACK command %02x, head = %d\n", tag().c_str(), current_command(), desired_head()); + if (TRACE_READTRACK) logerror("%s: READ TRACK command %02x, head = %d\n", tag(), current_command(), desired_head()); dma_address_out(m_register_w[DMA23_16], m_register_w[DMA15_8], m_register_w[DMA7_0]); m_transfer_enabled = (current_command() & 1)!=0; } @@ -1623,7 +1623,7 @@ void hdc92x4_device::read_track() switch (m_substate) { case WAITINDEX0: - if (TRACE_READTRACK && TRACE_DETAIL) logerror("%s: Read track - waiting for index hole\n", tag().c_str()); + if (TRACE_READTRACK && TRACE_DETAIL) logerror("%s: Read track - waiting for index hole\n", tag()); if (!index_hole()) { m_substate = WAITINDEX1; @@ -1632,7 +1632,7 @@ void hdc92x4_device::read_track() else { // We're above the index hole; wait for the index line going down - if (TRACE_READTRACK && TRACE_DETAIL) logerror("%s: Index hole just passing by ... waiting for next\n", tag().c_str()); + if (TRACE_READTRACK && TRACE_DETAIL) logerror("%s: Index hole just passing by ... waiting for next\n", tag()); wait_line(INDEX_LINE, ASSERT_LINE, WAITINDEX1, false); cont = WAIT; } @@ -1643,12 +1643,12 @@ void hdc92x4_device::read_track() cont = WAIT; break; case TRACKSTART: - if (TRACE_READTRACK && TRACE_DETAIL) logerror("%s: Read track - index hole arrived\n", tag().c_str()); + if (TRACE_READTRACK && TRACE_DETAIL) logerror("%s: Read track - index hole arrived\n", tag()); live_start(READ_TRACK); cont = WAIT; break; case TRACKDONE: - if (TRACE_READTRACK && TRACE_SUBSTATES) logerror("%s: Track reading done\n", tag().c_str()); + if (TRACE_READTRACK && TRACE_SUBSTATES) logerror("%s: Track reading done\n", tag()); cont = SUCCESS; m_out_dmarq(CLEAR_LINE); m_out_dip(CLEAR_LINE); @@ -1720,7 +1720,7 @@ void hdc92x4_device::format_track() { if (m_substate == UNDEF) { - if (TRACE_FORMAT) logerror("%s: FORMAT TRACK command %02x, head = %d\n", tag().c_str(), current_command(), desired_head()); + if (TRACE_FORMAT) logerror("%s: FORMAT TRACK command %02x, head = %d\n", tag(), current_command(), desired_head()); m_substate = WAITINDEX0; m_deleted = (current_command() & 0x10)!=0; m_reduced_write_current = (current_command() & 0x08)!=0; @@ -1737,13 +1737,13 @@ void hdc92x4_device::format_track() if (TRACE_FORMAT && TRACE_DETAIL) { - logerror("%s: GAP0 length = %d\n", tag().c_str(), m_gap0_size); - logerror("%s: GAP1 length = %d\n", tag().c_str(), m_gap1_size); - logerror("%s: GAP2 length = %d\n", tag().c_str(), m_gap2_size); - logerror("%s: GAP3 length = %d\n", tag().c_str(), m_gap3_size); - logerror("%s: Sync size = %d\n", tag().c_str(), m_sync_size); - logerror("%s: Sector count = %d\n", tag().c_str(), m_sector_count); - logerror("%s: Sector size = %d\n", tag().c_str(), m_sector_size); + logerror("%s: GAP0 length = %d\n", tag(), m_gap0_size); + logerror("%s: GAP1 length = %d\n", tag(), m_gap1_size); + logerror("%s: GAP2 length = %d\n", tag(), m_gap2_size); + logerror("%s: GAP3 length = %d\n", tag(), m_gap3_size); + logerror("%s: Sync size = %d\n", tag(), m_sync_size); + logerror("%s: Sector count = %d\n", tag(), m_sector_count); + logerror("%s: Sector size = %d\n", tag(), m_sector_size); } dma_address_out(m_register_r[CURRENT_IDENT], m_register_r[CURRENT_CYLINDER], m_register_r[CURRENT_HEAD]); @@ -1755,7 +1755,7 @@ void hdc92x4_device::format_track() switch (m_substate) { case WAITINDEX0: - if (TRACE_FORMAT && TRACE_DETAIL) logerror("%s: Format track; looking for track start\n", tag().c_str()); + if (TRACE_FORMAT && TRACE_DETAIL) logerror("%s: Format track; looking for track start\n", tag()); if (!index_hole()) { m_substate = WAITINDEX1; @@ -1764,24 +1764,24 @@ void hdc92x4_device::format_track() else { // We're above the index hole right now, so wait for the line going down - if (TRACE_FORMAT && TRACE_DETAIL) logerror("%s: Index hole just passing by ... \n", tag().c_str()); + if (TRACE_FORMAT && TRACE_DETAIL) logerror("%s: Index hole just passing by ... \n", tag()); wait_line(INDEX_LINE, CLEAR_LINE, WAITINDEX1, false); cont = WAIT; } break; case WAITINDEX1: // Waiting for the next rising edge - if (TRACE_FORMAT && TRACE_DETAIL) logerror("%s: Waiting for next index hole\n", tag().c_str()); + if (TRACE_FORMAT && TRACE_DETAIL) logerror("%s: Waiting for next index hole\n", tag()); wait_line(INDEX_LINE, ASSERT_LINE, TRACKSTART, false); cont = WAIT; break; case TRACKSTART: - if (TRACE_FORMAT && TRACE_DETAIL) logerror("%s: Format track - index hole arrived\n", tag().c_str()); + if (TRACE_FORMAT && TRACE_DETAIL) logerror("%s: Format track - index hole arrived\n", tag()); live_start(FORMAT_TRACK); cont = WAIT; break; case TRACKDONE: - if (FORMAT_TRACK && TRACE_SUBSTATES) logerror("%s: Track writing done\n", tag().c_str()); + if (FORMAT_TRACK && TRACE_SUBSTATES) logerror("%s: Track writing done\n", tag()); cont = SUCCESS; break; } @@ -1817,7 +1817,7 @@ void hdc92x4_device::write_sectors() if (m_substate == UNDEF) { - if (TRACE_WRITE) logerror("%s: WRITE SECTORS %s command %02x, CHS=(%d,%d,%d)\n", tag().c_str(), m_logical? "LOGICAL" : "PHYSICAL", current_command(), desired_cylinder(), desired_head(), desired_sector()); + if (TRACE_WRITE) logerror("%s: WRITE SECTORS %s command %02x, CHS=(%d,%d,%d)\n", tag(), m_logical? "LOGICAL" : "PHYSICAL", current_command(), desired_cylinder(), desired_head(), desired_sector()); m_multi_sector = (m_register_w[SECTOR_COUNT] != 1); m_substate = READ_ID; @@ -1869,7 +1869,7 @@ void hdc92x4_device::write_sectors() data_transfer(cont); break; default: - logerror("%s: BUG: Unknown substate %02x in write_sectors, aborting command\n", tag().c_str(), m_substate); + logerror("%s: BUG: Unknown substate %02x in write_sectors, aborting command\n", tag(), m_substate); set_command_done(TC_DATAERR); cont = ERROR; } @@ -1948,7 +1948,7 @@ bool hdc92x4_device::found_mark(int state) */ void hdc92x4_device::live_start(int state) { - if (TRACE_LIVE) logerror("%s: [%s] Live start substate=%02x\n", tag().c_str(), ttsn().c_str(), state); + if (TRACE_LIVE) logerror("%s: [%s] Live start substate=%02x\n", tag(), ttsn().c_str(), state); m_live_state.time = machine().time(); m_live_state.state = state; m_live_state.next_state = -1; @@ -1969,7 +1969,7 @@ void hdc92x4_device::live_start(int state) live_run(); m_last_live_state = UNDEF; - if (TRACE_LIVE) logerror("%s: [%s] Live start end\n", tag().c_str(), ttsn().c_str()); // delete + if (TRACE_LIVE) logerror("%s: [%s] Live start end\n", tag(), ttsn().c_str()); // delete } void hdc92x4_device::live_run() @@ -1996,9 +1996,9 @@ void hdc92x4_device::live_run_until(attotime limit) if (TRACE_LIVE) { if (limit == attotime::never) - logerror("%s: [%s live] live_run, live_state=%02x, mode=%s\n", tag().c_str(), tts(m_live_state.time).c_str(), m_live_state.state, fm_mode()? "FM":"MFM"); + logerror("%s: [%s live] live_run, live_state=%02x, mode=%s\n", tag(), tts(m_live_state.time).c_str(), m_live_state.state, fm_mode()? "FM":"MFM"); else - logerror("%s: [%s live] live_run until %s, live_state=%02x, mode=%s\n", tag().c_str(), tts(m_live_state.time).c_str(), tts(limit).c_str(), m_live_state.state, fm_mode()? "FM":"MFM"); + logerror("%s: [%s live] live_run until %s, live_state=%02x, mode=%s\n", tag(), tts(m_live_state.time).c_str(), tts(limit).c_str(), m_live_state.state, fm_mode()? "FM":"MFM"); } if (limit == attotime::never) @@ -2030,7 +2030,7 @@ void hdc92x4_device::live_run_until(attotime limit) if (TRACE_LIVE && m_last_live_state != SEARCH_IDAM) { - logerror("%s: [%s live] SEARCH_IDAM [limit %s]\n", tag().c_str(),tts(m_live_state.time).c_str(), tts(limit).c_str()); + logerror("%s: [%s live] SEARCH_IDAM [limit %s]\n", tag(),tts(m_live_state.time).c_str(), tts(limit).c_str()); m_last_live_state = m_live_state.state; } @@ -2039,11 +2039,11 @@ void hdc92x4_device::live_run_until(attotime limit) if (read_one_bit(limit)) { - if (TRACE_LIVE) logerror("%s: [%s live] SEARCH_IDAM limit reached\n", tag().c_str(), tts(m_live_state.time).c_str()); + if (TRACE_LIVE) logerror("%s: [%s live] SEARCH_IDAM limit reached\n", tag(), tts(m_live_state.time).c_str()); return; } // logerror("%s: SEARCH_IDAM\n", tts(m_live_state.time).c_str()); - if (TRACE_SHIFT) logerror("%s: [%s live] shift = %04x data=%02x c=%d\n", tag().c_str(), tts(m_live_state.time).c_str(), m_live_state.shift_reg, + if (TRACE_SHIFT) logerror("%s: [%s live] shift = %04x data=%02x c=%d\n", tag(), tts(m_live_state.time).c_str(), m_live_state.shift_reg, get_data_from_encoding(m_live_state.shift_reg), m_live_state.bit_counter); // [1] p. 9: The ID field sync mark must be found within 33,792 byte times @@ -2062,7 +2062,7 @@ void hdc92x4_device::live_run_until(attotime limit) // MFM case if (m_live_state.shift_reg == 0x4489) { - if (TRACE_LIVE) logerror("%s: [%s live] Found an A1 mark\n", tag().c_str(),tts(m_live_state.time).c_str()); + if (TRACE_LIVE) logerror("%s: [%s live] Found an A1 mark\n", tag(),tts(m_live_state.time).c_str()); m_live_state.crc = 0x443b; m_live_state.data_separator_phase = false; m_live_state.bit_counter = 0; @@ -2075,7 +2075,7 @@ void hdc92x4_device::live_run_until(attotime limit) // FM case if (m_live_state.shift_reg == 0xf57e) { - if (TRACE_LIVE) logerror("%s: SEARCH_IDAM: IDAM found\n", tag().c_str()); + if (TRACE_LIVE) logerror("%s: SEARCH_IDAM: IDAM found\n", tag()); m_live_state.crc = 0xef21; m_live_state.data_separator_phase = false; m_live_state.bit_counter = 0; @@ -2098,14 +2098,14 @@ void hdc92x4_device::live_run_until(attotime limit) if (TRACE_LIVE && m_last_live_state != READ_TWO_MORE_A1_IDAM) { - logerror("%s: [%s live] READ_TWO_MORE_A1\n", tag().c_str(),tts(m_live_state.time).c_str()); + logerror("%s: [%s live] READ_TWO_MORE_A1\n", tag(),tts(m_live_state.time).c_str()); m_last_live_state = m_live_state.state; } // Beyond time limit? if (read_one_bit(limit)) return; - if (TRACE_SHIFT) logerror("%s: [%s live] shift = %04x data=%02x c=%d\n", tag().c_str(), tts(m_live_state.time).c_str(), m_live_state.shift_reg, + if (TRACE_SHIFT) logerror("%s: [%s live] shift = %04x data=%02x c=%d\n", tag(), tts(m_live_state.time).c_str(), m_live_state.shift_reg, get_data_from_encoding(m_live_state.shift_reg), m_live_state.bit_counter); if (m_live_state.bit_count_total > 33792*16) @@ -2127,12 +2127,12 @@ void hdc92x4_device::live_run_until(attotime limit) m_live_state.state = SEARCH_IDAM; } else - if (TRACE_LIVE) logerror("%s: [%s live] Found an A1 mark\n", tag().c_str(),tts(m_live_state.time).c_str()); + if (TRACE_LIVE) logerror("%s: [%s live] Found an A1 mark\n", tag(),tts(m_live_state.time).c_str()); // Continue break; } - if (TRACE_LIVE) logerror("%s: [%s live] Found data value %02X\n", tag().c_str(),tts(m_live_state.time).c_str(), m_live_state.data_reg); + if (TRACE_LIVE) logerror("%s: [%s live] Found data value %02X\n", tag(),tts(m_live_state.time).c_str(), m_live_state.data_reg); // Check for ident field (fe, ff, fd, fc) if ((m_live_state.data_reg & 0xfc) != 0xfc) @@ -2141,9 +2141,9 @@ void hdc92x4_device::live_run_until(attotime limit) if (TRACE_LIVE) { if (m_live_state.data_reg == 0xf8 || m_live_state.data_reg == 0xfb) - logerror("%s: [%s live] Looks like a DAM; continue to next mark\n", tag().c_str(), tts(m_live_state.time).c_str()); + logerror("%s: [%s live] Looks like a DAM; continue to next mark\n", tag(), tts(m_live_state.time).c_str()); else - logerror("%s: [%s live] Missing ident data after A1A1A1, and it was not DAM; format corrupt?\n", tag().c_str(), tts(m_live_state.time).c_str()); + logerror("%s: [%s live] Missing ident data after A1A1A1, and it was not DAM; format corrupt?\n", tag(), tts(m_live_state.time).c_str()); } m_live_state.state = SEARCH_IDAM; break; @@ -2159,7 +2159,7 @@ void hdc92x4_device::live_run_until(attotime limit) case READ_ID_FIELDS_INTO_REGS: if (TRACE_LIVE && m_last_live_state != READ_ID_FIELDS_INTO_REGS) { - logerror("%s: [%s live] READ_ID_FIELDS_INTO_REGS\n", tag().c_str(),tts(m_live_state.time).c_str()); + logerror("%s: [%s live] READ_ID_FIELDS_INTO_REGS\n", tag(),tts(m_live_state.time).c_str()); m_last_live_state = m_live_state.state; } @@ -2172,7 +2172,7 @@ void hdc92x4_device::live_run_until(attotime limit) slot = (m_live_state.bit_counter >> 4)-1; - if (TRACE_LIVE) logerror("%s: slot %d = %02x, crc=%04x\n", tag().c_str(), slot, m_live_state.data_reg, m_live_state.crc); + if (TRACE_LIVE) logerror("%s: slot %d = %02x, crc=%04x\n", tag(), slot, m_live_state.data_reg, m_live_state.crc); // The id_field is an array of indexes into the chip registers. // Thus we get the values properly assigned to the registers. @@ -2198,7 +2198,7 @@ void hdc92x4_device::live_run_until(attotime limit) case SEARCH_DAM: if (TRACE_LIVE && m_last_live_state != SEARCH_DAM) { - logerror("%s: [%s live] SEARCH_DAM\n", tag().c_str(),tts(m_live_state.time).c_str()); + logerror("%s: [%s live] SEARCH_DAM\n", tag(),tts(m_live_state.time).c_str()); m_last_live_state = m_live_state.state; } @@ -2207,21 +2207,21 @@ void hdc92x4_device::live_run_until(attotime limit) if(read_one_bit(limit)) return; - if (TRACE_SHIFT) logerror("%s: [%s live] shift = %04x data=%02x c=%d\n", tag().c_str(), tts(m_live_state.time).c_str(), m_live_state.shift_reg, + if (TRACE_SHIFT) logerror("%s: [%s live] shift = %04x data=%02x c=%d\n", tag(), tts(m_live_state.time).c_str(), m_live_state.shift_reg, get_data_from_encoding(m_live_state.shift_reg), m_live_state.bit_counter); if (!fm_mode()) { // MFM if(m_live_state.bit_counter > 43*16) { - if (TRACE_FAIL) logerror("%s: SEARCH_DAM failed\n", tag().c_str()); + if (TRACE_FAIL) logerror("%s: SEARCH_DAM failed\n", tag()); wait_for_realtime(SEARCH_DAM_FAILED); return; } if (m_live_state.bit_counter >= 28*16 && m_live_state.shift_reg == 0x4489) { - if (TRACE_LIVE) logerror("%s: [%s live] Found an A1 mark\n", tag().c_str(),tts(m_live_state.time).c_str()); + if (TRACE_LIVE) logerror("%s: [%s live] Found an A1 mark\n", tag(),tts(m_live_state.time).c_str()); m_live_state.crc = 0x443b; m_live_state.data_separator_phase = false; m_live_state.bit_counter = 0; @@ -2232,14 +2232,14 @@ void hdc92x4_device::live_run_until(attotime limit) { // FM if (m_live_state.bit_counter > 23*16) { - if (TRACE_FAIL) logerror("%s: SEARCH_DAM failed\n", tag().c_str()); + if (TRACE_FAIL) logerror("%s: SEARCH_DAM failed\n", tag()); wait_for_realtime(SEARCH_DAM_FAILED); return; } if (m_live_state.bit_counter >= 11*16 && (m_live_state.shift_reg == 0xf56a || m_live_state.shift_reg == 0xf56b || m_live_state.shift_reg == 0xf56e || m_live_state.shift_reg == 0xf56f)) { - if (TRACE_LIVE) logerror("%s: SEARCH_DAM: found DAM = %04x\n", tag().c_str(), m_live_state.shift_reg); + if (TRACE_LIVE) logerror("%s: SEARCH_DAM: found DAM = %04x\n", tag(), m_live_state.shift_reg); m_live_state.crc = m_live_state.shift_reg == 0xf56a ? 0x8fe7 : m_live_state.shift_reg == 0xf56b ? 0x9fc6 : @@ -2255,14 +2255,14 @@ void hdc92x4_device::live_run_until(attotime limit) case READ_TWO_MORE_A1_DAM: { if (TRACE_LIVE && m_last_live_state != READ_TWO_MORE_A1_DAM) { - logerror("%s: [%s live] READ_TWO_MORE_A1_DAM\n", tag().c_str(),tts(m_live_state.time).c_str()); + logerror("%s: [%s live] READ_TWO_MORE_A1_DAM\n", tag(),tts(m_live_state.time).c_str()); m_last_live_state = m_live_state.state; } if(read_one_bit(limit)) return; - if (TRACE_SHIFT) logerror("%s: [%s live] shift = %04x data=%02x c=%d\n", tag().c_str(), tts(m_live_state.time).c_str(), m_live_state.shift_reg, + if (TRACE_SHIFT) logerror("%s: [%s live] shift = %04x data=%02x c=%d\n", tag(), tts(m_live_state.time).c_str(), m_live_state.shift_reg, get_data_from_encoding(m_live_state.shift_reg), m_live_state.bit_counter); // Repeat until we have collected 16 bits @@ -2279,23 +2279,23 @@ void hdc92x4_device::live_run_until(attotime limit) return; } else - if (TRACE_LIVE) logerror("%s: [%s live] Found an A1 mark\n", tag().c_str(),tts(m_live_state.time).c_str()); + if (TRACE_LIVE) logerror("%s: [%s live] Found an A1 mark\n", tag(),tts(m_live_state.time).c_str()); // Continue break; } - if (TRACE_LIVE) logerror("%s: [%s live] Found data value %02X\n", tag().c_str(),tts(m_live_state.time).c_str(), m_live_state.data_reg); + if (TRACE_LIVE) logerror("%s: [%s live] Found data value %02X\n", tag(),tts(m_live_state.time).c_str(), m_live_state.data_reg); if ((m_live_state.data_reg & 0xff) == 0xf8) { - if (TRACE_LIVE) logerror("%s: Found deleted data mark F8 after DAM sync\n", tag().c_str()); + if (TRACE_LIVE) logerror("%s: Found deleted data mark F8 after DAM sync\n", tag()); set_bits(m_register_r[CHIP_STATUS], CS_DELDATA, true); } else { if ((m_live_state.data_reg & 0xff) != 0xfb) { - if (TRACE_FAIL) logerror("%s: Missing FB/F8 data mark after DAM sync\n", tag().c_str()); + if (TRACE_FAIL) logerror("%s: Missing FB/F8 data mark after DAM sync\n", tag()); wait_for_realtime(SEARCH_DAM_FAILED); return; } @@ -2306,7 +2306,7 @@ void hdc92x4_device::live_run_until(attotime limit) break; } case SEARCH_DAM_FAILED: - if (TRACE_FAIL) logerror("%s: SEARCH_DAM failed\n", tag().c_str()); + if (TRACE_FAIL) logerror("%s: SEARCH_DAM failed\n", tag()); m_live_state.state = IDLE; return; @@ -2314,7 +2314,7 @@ void hdc92x4_device::live_run_until(attotime limit) { if (TRACE_LIVE && m_last_live_state != READ_SECTOR_DATA) { - logerror("%s: [%s live] READ_SECTOR_DATA\n", tag().c_str(),tts(m_live_state.time).c_str()); + logerror("%s: [%s live] READ_SECTOR_DATA\n", tag(),tts(m_live_state.time).c_str()); m_last_live_state = m_live_state.state; } @@ -2339,7 +2339,7 @@ void hdc92x4_device::live_run_until(attotime limit) // Repeat until we have collected 16 bits if (m_live_state.bit_counter & 15) break; - if (TRACE_LIVE) logerror("%s: [%s live] Found data value %02X, CRC=%04x\n", tag().c_str(),tts(m_live_state.time).c_str(), m_live_state.data_reg, m_live_state.crc); + if (TRACE_LIVE) logerror("%s: [%s live] Found data value %02X, CRC=%04x\n", tag(),tts(m_live_state.time).c_str(), m_live_state.data_reg, m_live_state.crc); int slot = (m_live_state.bit_counter >> 4)-1; if (slot < calc_sector_size()) @@ -2360,7 +2360,7 @@ void hdc92x4_device::live_run_until(attotime limit) } else { - if (TRACE_LIVE) logerror("%s: [%s live] Sector read completed\n", tag().c_str(),tts(m_live_state.time).c_str()); + if (TRACE_LIVE) logerror("%s: [%s live] Sector read completed\n", tag(),tts(m_live_state.time).c_str()); wait_for_realtime(IDLE); } return; @@ -2372,14 +2372,14 @@ void hdc92x4_device::live_run_until(attotime limit) case READ_SECTOR_DATA_CONT: if (TRACE_LIVE && m_last_live_state != READ_SECTOR_DATA_CONT) { - logerror("%s: [%s live] READ_SECTOR_DATA_CONT\n", tag().c_str(),tts(m_live_state.time).c_str()); + logerror("%s: [%s live] READ_SECTOR_DATA_CONT\n", tag(),tts(m_live_state.time).c_str()); m_last_live_state = m_live_state.state; } // Did the system CPU send the DMA ACK in the meantime? if ((m_register_r[INT_STATUS] & ST_OVRUN)!=0) { - if (TRACE_FAIL) logerror("%s: No DMA ACK - buffer overrun\n", tag().c_str()); + if (TRACE_FAIL) logerror("%s: No DMA ACK - buffer overrun\n", tag()); set_bits(m_register_r[INT_STATUS], TC_DATAERR, true); m_live_state.state = IDLE; return; @@ -2418,13 +2418,13 @@ void hdc92x4_device::live_run_until(attotime limit) // 5. Write the CRC bytes if (TRACE_LIVE) - logerror("%s: [%s live] WRITE_DAM_AND_SECTOR\n", tag().c_str(), tts(m_live_state.time).c_str()); + logerror("%s: [%s live] WRITE_DAM_AND_SECTOR\n", tag(), tts(m_live_state.time).c_str()); skip_on_track(m_gap2_size, WRITE_DAM_SYNC); break; case WRITE_DAM_SYNC: - if (TRACE_WRITE && TRACE_DETAIL) logerror("%s: Write sync zeros\n", tag().c_str()); + if (TRACE_WRITE && TRACE_DETAIL) logerror("%s: Write sync zeros\n", tag()); // Clear the overrun/underrun flag set_bits(m_register_r[INT_STATUS], ST_OVRUN, false); @@ -2432,12 +2432,12 @@ void hdc92x4_device::live_run_until(attotime limit) break; case WRITE_A1: - if (TRACE_WRITE && TRACE_DETAIL) logerror("%s: Write three A1\n", tag().c_str()); + if (TRACE_WRITE && TRACE_DETAIL) logerror("%s: Write three A1\n", tag()); write_on_track(0x4489, 3, WRITE_DATAMARK); break; case WRITE_DATAMARK: - if (TRACE_WRITE && TRACE_DETAIL) logerror("%s: Write data mark and sector contents\n", tag().c_str()); + if (TRACE_WRITE && TRACE_DETAIL) logerror("%s: Write data mark and sector contents\n", tag()); if (fm_mode()) { // Init the CRC for the DAM and sector @@ -2515,7 +2515,7 @@ void hdc92x4_device::live_run_until(attotime limit) // byte in two iterations to get both if (m_live_state.byte_counter > 0) { - if (TRACE_WRITE && TRACE_DETAIL) logerror("%s: Write CRC\n", tag().c_str()); + if (TRACE_WRITE && TRACE_DETAIL) logerror("%s: Write CRC\n", tag()); m_live_state.byte_counter--; write_on_track(encode((m_live_state.crc >> 8) & 0xff), 1, WRITE_DATA_CRC); } @@ -2529,7 +2529,7 @@ void hdc92x4_device::live_run_until(attotime limit) case WRITE_DONE: if (m_substate == DATA_TRANSFER_WRITE) { - if (TRACE_WRITE && TRACE_DETAIL) logerror("%s: Write sector complete\n", tag().c_str()); + if (TRACE_WRITE && TRACE_DETAIL) logerror("%s: Write sector complete\n", tag()); m_pll.stop_writing(m_floppy, m_live_state.time); m_live_state.state = IDLE; return; @@ -2560,19 +2560,19 @@ void hdc92x4_device::live_run_until(attotime limit) // ================================================== case FORMAT_TRACK: - if (TRACE_LIVE) logerror("%s: FORMAT_TRACK\n", tag().c_str()); + if (TRACE_LIVE) logerror("%s: FORMAT_TRACK\n", tag()); m_live_state.state = WRITE_GAP0; m_pll.start_writing(m_live_state.time); break; case WRITE_GAP0: // GAP0 length is in DMA7_0 (negated, 2s comp) - if (TRACE_WRITE && TRACE_DETAIL) logerror("%s: Writing GAP0\n", tag().c_str()); + if (TRACE_WRITE && TRACE_DETAIL) logerror("%s: Writing GAP0\n", tag()); write_on_track(encode(fm_mode()? 0xff : 0x4e), m_gap0_size, WRITE_IXAM_SYNC); break; case WRITE_IXAM_SYNC: - if (TRACE_WRITE && TRACE_DETAIL) logerror("%s: Writing IXAM sync\n", tag().c_str()); + if (TRACE_WRITE && TRACE_DETAIL) logerror("%s: Writing IXAM sync\n", tag()); write_on_track(encode(0x00), m_sync_size, WRITE_IXAM); break; @@ -2580,7 +2580,7 @@ void hdc92x4_device::live_run_until(attotime limit) // FM: FC with clock D7 = 1111 -111 -111 1010 // MFM: C2 = 11000010 // 0101 0010 -010 0100 - if (TRACE_WRITE && TRACE_DETAIL) logerror("%s: Writing IXAM\n", tag().c_str()); + if (TRACE_WRITE && TRACE_DETAIL) logerror("%s: Writing IXAM\n", tag()); if (fm_mode()) write_on_track(0xf77a, 1, WRITE_GAP1); else @@ -2595,7 +2595,7 @@ void hdc92x4_device::live_run_until(attotime limit) case WRITE_GAP1: // GAP1 length is in DMA15_8 - if (TRACE_WRITE && TRACE_DETAIL) logerror("%s: Writing GAP1\n", tag().c_str()); + if (TRACE_WRITE && TRACE_DETAIL) logerror("%s: Writing GAP1\n", tag()); write_on_track(encode(fm_mode()? 0xff : 0x4e), m_gap1_size, WRITE_IDAM_SYNC); break; @@ -2604,7 +2604,7 @@ void hdc92x4_device::live_run_until(attotime limit) // We assume it reads the bytes and writes them directly on the disk case WRITE_IDAM_SYNC: - if (TRACE_WRITE && TRACE_DETAIL) logerror("%s: Writing IDAM sync\n", tag().c_str()); + if (TRACE_WRITE && TRACE_DETAIL) logerror("%s: Writing IDAM sync\n", tag()); write_on_track(encode(0x00), m_sync_size, WRITE_IDAM); break; @@ -2613,7 +2613,7 @@ void hdc92x4_device::live_run_until(attotime limit) set_bits(m_register_r[INT_STATUS], ST_OVRUN, true); m_out_dmarq(ASSERT_LINE); - if (TRACE_WRITE && TRACE_DETAIL) logerror("%s: Writing IDAM and header\n", tag().c_str()); + if (TRACE_WRITE && TRACE_DETAIL) logerror("%s: Writing IDAM and header\n", tag()); if (fm_mode()) { write_on_track(0xf57e, 1, WRITE_HEADER); @@ -2657,7 +2657,7 @@ void hdc92x4_device::live_run_until(attotime limit) if (m_live_state.byte_counter > 0) { UINT8 crct = (m_live_state.crc >> 8) & 0xff; - if (TRACE_WRITE && TRACE_DETAIL) logerror("%s: Write CRC byte %02x\n", tag().c_str(), crct); + if (TRACE_WRITE && TRACE_DETAIL) logerror("%s: Write CRC byte %02x\n", tag(), crct); m_live_state.byte_counter--; write_on_track(encode(crct), 1, WRITE_HEADER_CRC); } @@ -2667,13 +2667,13 @@ void hdc92x4_device::live_run_until(attotime limit) break; case WRITE_GAP2: - if (TRACE_WRITE && TRACE_DETAIL) logerror("%s: Writing GAP2\n", tag().c_str()); + if (TRACE_WRITE && TRACE_DETAIL) logerror("%s: Writing GAP2\n", tag()); write_on_track(encode(fm_mode()? 0xff : 0x4e), m_gap2_size, WRITE_DAM_SYNC); break; case WRITE_GAP3: m_sector_count--; - if (TRACE_WRITE && TRACE_DETAIL) logerror("%s: Writing GAP3\n", tag().c_str()); + if (TRACE_WRITE && TRACE_DETAIL) logerror("%s: Writing GAP3\n", tag()); write_on_track(encode(fm_mode()? 0xff : 0x4e), m_gap3_size, (m_sector_count>0)? WRITE_IDAM_SYNC : WRITE_GAP4); break; @@ -2682,7 +2682,7 @@ void hdc92x4_device::live_run_until(attotime limit) wait_line(INDEX_LINE, ASSERT_LINE, TRACKDONE, true); if (TRACE_WRITE && TRACE_DETAIL && m_last_live_state != WRITE_GAP4) { - logerror("%s: Writing GAP4\n", tag().c_str()); + logerror("%s: Writing GAP4\n", tag()); m_last_live_state = WRITE_GAP4; } // Write a single byte; when the index hole shows up, the live run will be aborted @@ -2697,7 +2697,7 @@ void hdc92x4_device::live_run_until(attotime limit) // Quite simple. Read the next ID fields, then the sector contents. // Continue until the next index hole shows up (live_abort). case READ_TRACK: - if (TRACE_LIVE) logerror("%s: READ_TRACK\n", tag().c_str()); + if (TRACE_LIVE) logerror("%s: READ_TRACK\n", tag()); m_live_state.state = READ_TRACK_ID; break; @@ -2711,12 +2711,12 @@ void hdc92x4_device::live_run_until(attotime limit) case READ_TRACK_ID_DONE: if ((m_register_r[INT_STATUS] & ST_OVRUN)!=0) { - if (TRACE_FAIL) logerror("%s: No DMA ACK - buffer overrun\n", tag().c_str()); + if (TRACE_FAIL) logerror("%s: No DMA ACK - buffer overrun\n", tag()); set_bits(m_register_r[INT_STATUS], TC_DATAERR, true); m_live_state.state = IDLE; return; } - if (TRACE_LIVE) logerror("%s: READ_TRACK1\n", tag().c_str()); + if (TRACE_LIVE) logerror("%s: READ_TRACK1\n", tag()); m_out_dip(ASSERT_LINE); @@ -2737,14 +2737,14 @@ void hdc92x4_device::live_run_until(attotime limit) // The pause is implemented by doing dummy reads on the floppy if (read_one_bit(limit)) { - if (TRACE_LIVE) logerror("%s: [%s live] return; limit=%s\n", tag().c_str(), tts(m_live_state.time).c_str(), tts(limit).c_str()); + if (TRACE_LIVE) logerror("%s: [%s live] return; limit=%s\n", tag(), tts(m_live_state.time).c_str(), tts(limit).c_str()); return; } // Repeat until we have collected 16 bits if ((m_live_state.bit_counter & 15)==0) { - if (TRACE_READ && TRACE_DETAIL) logerror("%s: [%s live] Read byte %02x, repeat = %d\n", tag().c_str(), tts(m_live_state.time).c_str(), m_live_state.data_reg, m_live_state.repeat); + if (TRACE_READ && TRACE_DETAIL) logerror("%s: [%s live] Read byte %02x, repeat = %d\n", tag(), tts(m_live_state.time).c_str(), m_live_state.data_reg, m_live_state.repeat); wait_for_realtime(READ_TRACK_NEXT_BYTE); return; } @@ -2790,14 +2790,14 @@ void hdc92x4_device::live_run_until(attotime limit) break; case NO_DMA_ACK: - if (TRACE_FAIL) logerror("%s: No DMA ACK - buffer underrun\n", tag().c_str()); + if (TRACE_FAIL) logerror("%s: No DMA ACK - buffer underrun\n", tag()); set_bits(m_register_r[INT_STATUS], TC_DATAERR, true); m_pll.stop_writing(m_floppy, m_live_state.time); m_live_state.state = IDLE; return; default: - logerror("%s: Unknown live state: %02x\n", tag().c_str(), m_live_state.state); + logerror("%s: Unknown live state: %02x\n", tag(), m_live_state.state); m_last_live_state = m_live_state.state; return; } @@ -2820,7 +2820,7 @@ void hdc92x4_device::live_run_until(attotime limit) void hdc92x4_device::live_run_hd_until(attotime limit) { int slot = 0; - if (TRACE_LIVE) logerror("%s: live_run_hd\n", tag().c_str()); + if (TRACE_LIVE) logerror("%s: live_run_hd\n", tag()); if (m_live_state.state == IDLE || m_live_state.next_state != -1) return; @@ -2828,16 +2828,16 @@ void hdc92x4_device::live_run_hd_until(attotime limit) if (TRACE_LIVE) { if (limit == attotime::never) - logerror("%s: [%s live] live_run_hd, live_state=%02x, mode=%s\n", tag().c_str(), tts(m_live_state.time).c_str(), m_live_state.state, fm_mode()? "FM":"MFM"); + logerror("%s: [%s live] live_run_hd, live_state=%02x, mode=%s\n", tag(), tts(m_live_state.time).c_str(), m_live_state.state, fm_mode()? "FM":"MFM"); else - logerror("%s: [%s live] live_run_hd until %s, live_state=%02x, mode=%s\n", tag().c_str(), tts(m_live_state.time).c_str(), tts(limit).c_str(), m_live_state.state, fm_mode()? "FM":"MFM"); + logerror("%s: [%s live] live_run_hd until %s, live_state=%02x, mode=%s\n", tag(), tts(m_live_state.time).c_str(), tts(limit).c_str(), m_live_state.state, fm_mode()? "FM":"MFM"); } // We did not specify an upper time bound, so we take the next index pulse if (limit == attotime::never && m_harddisk != nullptr) { limit = m_harddisk->track_end_time(); - if (TRACE_LIVE) logerror("%s: [%s live] live_run_hd new limit %s\n", tag().c_str(), tts(m_live_state.time).c_str(), tts(limit).c_str()); + if (TRACE_LIVE) logerror("%s: [%s live] live_run_hd new limit %s\n", tag(), tts(m_live_state.time).c_str(), tts(limit).c_str()); } while (true) @@ -2847,7 +2847,7 @@ void hdc92x4_device::live_run_hd_until(attotime limit) case SEARCH_IDAM: if (TRACE_LIVE && m_last_live_state != SEARCH_IDAM) { - logerror("%s: [%s live] SEARCH_IDAM [limit %s]\n", tag().c_str(),tts(m_live_state.time).c_str(), tts(limit).c_str()); + logerror("%s: [%s live] SEARCH_IDAM [limit %s]\n", tag(),tts(m_live_state.time).c_str(), tts(limit).c_str()); m_last_live_state = m_live_state.state; } @@ -2856,12 +2856,12 @@ void hdc92x4_device::live_run_hd_until(attotime limit) if (read_from_mfmhd(limit)) { - if (TRACE_LIVE) logerror("%s: [%s live] SEARCH_IDAM limit reached\n", tag().c_str(), tts(m_live_state.time).c_str()); + if (TRACE_LIVE) logerror("%s: [%s live] SEARCH_IDAM limit reached\n", tag(), tts(m_live_state.time).c_str()); return; } if (TRACE_LIVE) - if ((m_live_state.bit_counter & 0x000f)==0) logerror("%s: [%s live] Read %04x\n", tag().c_str(), tts(m_live_state.time).c_str(), m_live_state.shift_reg); + if ((m_live_state.bit_counter & 0x000f)==0) logerror("%s: [%s live] Read %04x\n", tag(), tts(m_live_state.time).c_str(), m_live_state.shift_reg); // [1] p. 9: The ID field sync mark must be found within 33,792 byte times if (m_live_state.bit_count_total > 33792*16) @@ -2876,7 +2876,7 @@ void hdc92x4_device::live_run_hd_until(attotime limit) if (found_mark(SEARCH_IDAM)) { - if (TRACE_LIVE) logerror("%s: [%s live] Found an A1 mark\n", tag().c_str(), tts(m_live_state.time).c_str()); + if (TRACE_LIVE) logerror("%s: [%s live] Found an A1 mark\n", tag(), tts(m_live_state.time).c_str()); m_live_state.crc = 0x443b; m_live_state.data_separator_phase = false; m_live_state.bit_counter = 0; @@ -2907,9 +2907,9 @@ void hdc92x4_device::live_run_hd_until(attotime limit) if (TRACE_LIVE) { if (m_live_state.data_reg == 0xf8 || m_live_state.data_reg == 0xfb) - logerror("%s: [%s live] Looks like a DAM; continue to next mark\n", tag().c_str(), tts(m_live_state.time).c_str()); + logerror("%s: [%s live] Looks like a DAM; continue to next mark\n", tag(), tts(m_live_state.time).c_str()); else - logerror("%s: [%s live] Missing ident data after A1, and it was not DAM; format corrupt?\n", tag().c_str(), tts(m_live_state.time).c_str()); + logerror("%s: [%s live] Missing ident data after A1, and it was not DAM; format corrupt?\n", tag(), tts(m_live_state.time).c_str()); } m_live_state.state = SEARCH_IDAM; } @@ -2924,7 +2924,7 @@ void hdc92x4_device::live_run_hd_until(attotime limit) case READ_ID_FIELDS_INTO_REGS: if (TRACE_LIVE && m_last_live_state != READ_ID_FIELDS_INTO_REGS) { - logerror("%s: [%s live] READ_ID_FIELDS_INTO_REGS\n", tag().c_str(),tts(m_live_state.time).c_str()); + logerror("%s: [%s live] READ_ID_FIELDS_INTO_REGS\n", tag(),tts(m_live_state.time).c_str()); m_last_live_state = m_live_state.state; } @@ -2933,7 +2933,7 @@ void hdc92x4_device::live_run_hd_until(attotime limit) // Repeat until we have collected 16 bits if (m_live_state.bit_counter & 15) break; - if (TRACE_LIVE) logerror("%s: slot %d = %02x, crc=%04x\n", tag().c_str(), slot, m_live_state.data_reg, m_live_state.crc); + if (TRACE_LIVE) logerror("%s: slot %d = %02x, crc=%04x\n", tag(), slot, m_live_state.data_reg, m_live_state.crc); m_register_r[id_field[slot++]] = m_live_state.data_reg; if(slot > 5) @@ -2952,7 +2952,7 @@ void hdc92x4_device::live_run_hd_until(attotime limit) case SEARCH_DAM: if (TRACE_LIVE && m_last_live_state != SEARCH_DAM) { - logerror("%s: [%s live] SEARCH_DAM\n", tag().c_str(),tts(m_live_state.time).c_str()); + logerror("%s: [%s live] SEARCH_DAM\n", tag(),tts(m_live_state.time).c_str()); m_last_live_state = m_live_state.state; } set_bits(m_register_r[CHIP_STATUS], CS_DELDATA, false); @@ -2960,18 +2960,18 @@ void hdc92x4_device::live_run_hd_until(attotime limit) if (read_from_mfmhd(limit)) return; if (TRACE_LIVE) - if ((m_live_state.bit_counter & 15)==0) logerror("%s: [%s live] Read %04x\n", tag().c_str(), tts(m_live_state.time).c_str(), m_live_state.shift_reg); + if ((m_live_state.bit_counter & 15)==0) logerror("%s: [%s live] Read %04x\n", tag(), tts(m_live_state.time).c_str(), m_live_state.shift_reg); if (m_live_state.bit_counter > 30*16) { - if (TRACE_FAIL) logerror("%s: SEARCH_DAM failed\n", tag().c_str()); + if (TRACE_FAIL) logerror("%s: SEARCH_DAM failed\n", tag()); wait_for_realtime(SEARCH_DAM_FAILED); return; } if (found_mark(SEARCH_DAM)) { - if (TRACE_LIVE) logerror("%s: [%s live] Found an A1 mark\n", tag().c_str(),tts(m_live_state.time).c_str()); + if (TRACE_LIVE) logerror("%s: [%s live] Found an A1 mark\n", tag(),tts(m_live_state.time).c_str()); m_live_state.crc = 0x443b; m_live_state.data_separator_phase = false; m_live_state.bit_counter = 0; @@ -2986,14 +2986,14 @@ void hdc92x4_device::live_run_hd_until(attotime limit) if ((m_live_state.data_reg & 0xff) == 0xf8) { - if (TRACE_LIVE) logerror("%s: [%s live] Found deleted data mark F8 after DAM sync\n", tag().c_str(), tts(m_live_state.time).c_str()); + if (TRACE_LIVE) logerror("%s: [%s live] Found deleted data mark F8 after DAM sync\n", tag(), tts(m_live_state.time).c_str()); set_bits(m_register_r[CHIP_STATUS], CS_DELDATA, true); } else { if ((m_live_state.data_reg & 0xff) != 0xfb) { - if (TRACE_FAIL) logerror("%s: [%s live] Missing FB/F8 data mark after DAM sync; found %04x\n", tag().c_str(), tts(m_live_state.time).c_str(), m_live_state.shift_reg); + if (TRACE_FAIL) logerror("%s: [%s live] Missing FB/F8 data mark after DAM sync; found %04x\n", tag(), tts(m_live_state.time).c_str(), m_live_state.shift_reg); wait_for_realtime(SEARCH_DAM_FAILED); return; } @@ -3003,14 +3003,14 @@ void hdc92x4_device::live_run_hd_until(attotime limit) break; case SEARCH_DAM_FAILED: - if (TRACE_FAIL) logerror("%s: SEARCH_DAM failed\n", tag().c_str()); + if (TRACE_FAIL) logerror("%s: SEARCH_DAM failed\n", tag()); m_live_state.state = IDLE; return; case READ_SECTOR_DATA: if (TRACE_LIVE && m_last_live_state != READ_SECTOR_DATA) { - logerror("%s: [%s live] READ_SECTOR_DATA\n", tag().c_str(),tts(m_live_state.time).c_str()); + logerror("%s: [%s live] READ_SECTOR_DATA\n", tag(),tts(m_live_state.time).c_str()); m_last_live_state = m_live_state.state; } @@ -3030,7 +3030,7 @@ void hdc92x4_device::live_run_hd_until(attotime limit) if (m_live_state.bit_counter & 15) break; slot = (m_live_state.bit_counter >> 4)-1; - if (TRACE_LIVE) logerror("%s: [%s live] Found data value [%d/%d] = %02X, CRC=%04x\n", tag().c_str(),tts(m_live_state.time).c_str(), slot, calc_sector_size(), m_live_state.data_reg, m_live_state.crc); + if (TRACE_LIVE) logerror("%s: [%s live] Found data value [%d/%d] = %02X, CRC=%04x\n", tag(),tts(m_live_state.time).c_str(), slot, calc_sector_size(), m_live_state.data_reg, m_live_state.crc); if (slot < calc_sector_size()) { @@ -3058,7 +3058,7 @@ void hdc92x4_device::live_run_hd_until(attotime limit) } else { - if (TRACE_LIVE) logerror("%s: [%s live] Sector read completed\n", tag().c_str(),tts(m_live_state.time).c_str()); + if (TRACE_LIVE) logerror("%s: [%s live] Sector read completed\n", tag(),tts(m_live_state.time).c_str()); wait_for_realtime(IDLE); } return; @@ -3071,7 +3071,7 @@ void hdc92x4_device::live_run_hd_until(attotime limit) // Did the system CPU send the DMA ACK in the meantime? if ((m_register_r[INT_STATUS] & ST_OVRUN)!=0) { - if (TRACE_FAIL) logerror("%s: No DMA ACK - buffer overrun\n", tag().c_str()); + if (TRACE_FAIL) logerror("%s: No DMA ACK - buffer overrun\n", tag()); set_bits(m_register_r[INT_STATUS], TC_DATAERR, true); m_live_state.state = IDLE; return; @@ -3085,7 +3085,7 @@ void hdc92x4_device::live_run_hd_until(attotime limit) m_out_dip(ASSERT_LINE); m_out_dma(0, m_register_r[DATA], 0xff); - if (TRACE_LIVE) logerror("%s: [%s live] Byte %02x sent via DMA\n", tag().c_str(),tts(m_live_state.time).c_str(), m_register_r[DATA] & 0xff); + if (TRACE_LIVE) logerror("%s: [%s live] Byte %02x sent via DMA\n", tag(),tts(m_live_state.time).c_str(), m_register_r[DATA] & 0xff); } m_live_state.state = READ_SECTOR_DATA; break; @@ -3096,14 +3096,14 @@ void hdc92x4_device::live_run_hd_until(attotime limit) // The pause is implemented by doing dummy reads on the hard disk if (read_from_mfmhd(limit)) { - if (TRACE_LIVE) logerror("%s: [%s live] return; limit=%s\n", tag().c_str(), tts(m_live_state.time).c_str(), tts(limit).c_str()); + if (TRACE_LIVE) logerror("%s: [%s live] return; limit=%s\n", tag(), tts(m_live_state.time).c_str(), tts(limit).c_str()); return; } // Repeat until we have collected 16 bits if ((m_live_state.bit_counter & 15)==0) { - if (TRACE_READ && TRACE_DETAIL) logerror("%s: [%s live] Read byte %02x, repeat = %d\n", tag().c_str(), tts(m_live_state.time).c_str(), m_live_state.data_reg, m_live_state.repeat); + if (TRACE_READ && TRACE_DETAIL) logerror("%s: [%s live] Read byte %02x, repeat = %d\n", tag(), tts(m_live_state.time).c_str(), m_live_state.data_reg, m_live_state.repeat); wait_for_realtime(READ_TRACK_NEXT_BYTE); return; } @@ -3123,7 +3123,7 @@ void hdc92x4_device::live_run_hd_until(attotime limit) case WRITE_TRACK_BYTE: if (write_to_mfmhd(limit)) { - if (TRACE_LIVE) logerror("%s: [%s live] write limit reached\n", tag().c_str(), tts(m_live_state.time).c_str()); + if (TRACE_LIVE) logerror("%s: [%s live] write limit reached\n", tag(), tts(m_live_state.time).c_str()); return; } @@ -3154,13 +3154,13 @@ void hdc92x4_device::live_run_hd_until(attotime limit) // ======= HD sector write ===================================== case WRITE_DAM_AND_SECTOR: - if (TRACE_LIVE) logerror("%s: [%s live] Skipping GAP2\n", tag().c_str(), tts(m_live_state.time).c_str()); + if (TRACE_LIVE) logerror("%s: [%s live] Skipping GAP2\n", tag(), tts(m_live_state.time).c_str()); skip_on_track(m_gap2_size, WRITE_DAM_SYNC); break; case WRITE_DAM_SYNC: - if (TRACE_WRITE && TRACE_DETAIL) logerror("%s: Write sync zeros\n", tag().c_str()); + if (TRACE_WRITE && TRACE_DETAIL) logerror("%s: Write sync zeros\n", tag()); // Clear the overrun/underrun flag set_bits(m_register_r[INT_STATUS], ST_OVRUN, false); @@ -3168,12 +3168,12 @@ void hdc92x4_device::live_run_hd_until(attotime limit) break; case WRITE_A1: - if (TRACE_WRITE && TRACE_DETAIL) logerror("%s: Write one A1\n", tag().c_str()); + if (TRACE_WRITE && TRACE_DETAIL) logerror("%s: Write one A1\n", tag()); write_on_track(encode_a1_hd(), 1, WRITE_DATAMARK); break; case WRITE_DATAMARK: - if (TRACE_WRITE && TRACE_DETAIL) logerror("%s: Write data mark\n", tag().c_str()); + if (TRACE_WRITE && TRACE_DETAIL) logerror("%s: Write data mark\n", tag()); // Init the CRC for the ident byte and sector m_live_state.crc = 0x443b; // value for 1*A1 @@ -3202,7 +3202,7 @@ void hdc92x4_device::live_run_hd_until(attotime limit) } else { - if (TRACE_WRITE && TRACE_DETAIL) logerror("%s: Write sector byte, %d to go\n", tag().c_str(), m_live_state.byte_counter); + if (TRACE_WRITE && TRACE_DETAIL) logerror("%s: Write sector byte, %d to go\n", tag(), m_live_state.byte_counter); // For floppies, set this for each byte; for hard disk, set it only at the beginning if (m_live_state.byte_counter == calc_sector_size()) @@ -3241,7 +3241,7 @@ void hdc92x4_device::live_run_hd_until(attotime limit) case WRITE_DATA_CRC: if (m_live_state.byte_counter > 0) { - if (TRACE_WRITE && TRACE_DETAIL) logerror("%s: Write CRC\n", tag().c_str()); + if (TRACE_WRITE && TRACE_DETAIL) logerror("%s: Write CRC\n", tag()); m_live_state.byte_counter--; write_on_track(encode_hd((m_live_state.crc >> 8) & 0xff), 1, WRITE_DATA_CRC); } @@ -3254,7 +3254,7 @@ void hdc92x4_device::live_run_hd_until(attotime limit) case WRITE_DONE: if (m_substate == DATA_TRANSFER_WRITE) { - if (TRACE_WRITE && TRACE_DETAIL) logerror("%s: Write sector complete\n", tag().c_str()); + if (TRACE_WRITE && TRACE_DETAIL) logerror("%s: Write sector complete\n", tag()); m_live_state.state = IDLE; return; } @@ -3272,7 +3272,7 @@ void hdc92x4_device::live_run_hd_until(attotime limit) // Read the next ID fields, then the sector contents. // Continue until the next index hole shows up (live_abort). case READ_TRACK: - if (TRACE_LIVE) logerror("%s: READ_TRACK\n", tag().c_str()); + if (TRACE_LIVE) logerror("%s: READ_TRACK\n", tag()); m_live_state.state = READ_TRACK_ID; break; @@ -3287,12 +3287,12 @@ void hdc92x4_device::live_run_hd_until(attotime limit) if ((m_register_r[INT_STATUS] & ST_OVRUN)!=0) { // We need an ACK right now, or the header bytes will be lost - if (TRACE_FAIL) logerror("%s: No DMA ACK - buffer overrun\n", tag().c_str()); + if (TRACE_FAIL) logerror("%s: No DMA ACK - buffer overrun\n", tag()); set_bits(m_register_r[INT_STATUS], TC_DATAERR, true); m_live_state.state = IDLE; return; } - if (TRACE_LIVE) logerror("%s: READ_TRACK_ID_DONE\n", tag().c_str()); + if (TRACE_LIVE) logerror("%s: READ_TRACK_ID_DONE\n", tag()); m_out_dip(ASSERT_LINE); // Write the header via DMA @@ -3319,18 +3319,18 @@ void hdc92x4_device::live_run_hd_until(attotime limit) // Write GAP4 until the next pulse // ================================================== case FORMAT_TRACK: - if (TRACE_LIVE) logerror("%s: FORMAT_TRACK\n", tag().c_str()); + if (TRACE_LIVE) logerror("%s: FORMAT_TRACK\n", tag()); m_live_state.state = WRITE_GAP1; break; case WRITE_GAP1: // GAP1 length is in DMA15_8 - if (TRACE_GAPS) logerror("%s: Writing GAP1; size=%d\n", tag().c_str(), m_gap1_size); + if (TRACE_GAPS) logerror("%s: Writing GAP1; size=%d\n", tag(), m_gap1_size); write_on_track(encode_hd(0x4e), m_gap1_size, WRITE_IDAM_SYNC); break; case WRITE_IDAM_SYNC: - if (TRACE_GAPS) logerror("%s: Writing IDAM sync, size=%d\n", tag().c_str(), m_sync_size); + if (TRACE_GAPS) logerror("%s: Writing IDAM sync, size=%d\n", tag(), m_sync_size); write_on_track(encode_hd(0x00), m_sync_size, WRITE_IDAM); break; @@ -3338,7 +3338,7 @@ void hdc92x4_device::live_run_hd_until(attotime limit) // Set the over/underrun flag and hope that it will be cleared before we enter the next state (after writing) set_bits(m_register_r[INT_STATUS], ST_OVRUN, true); m_out_dmarq(ASSERT_LINE); - if (TRACE_HEADER) logerror("%s: Writing IDAM and header: ", tag().c_str()); + if (TRACE_HEADER) logerror("%s: Writing IDAM and header: ", tag()); write_on_track(encode_a1_hd(), 1, WRITE_HEADER); m_live_state.byte_counter = 5; // TODO: Check this for AT mode m_live_state.crc = 0xffff; @@ -3382,13 +3382,13 @@ void hdc92x4_device::live_run_hd_until(attotime limit) break; case WRITE_GAP2: - if (TRACE_GAPS) logerror("%s: Writing GAP2, size=%d\n", tag().c_str(), m_gap2_size); + if (TRACE_GAPS) logerror("%s: Writing GAP2, size=%d\n", tag(), m_gap2_size); write_on_track(encode_hd(0x4e), m_gap2_size, WRITE_DAM_SYNC); break; case WRITE_GAP3: m_sector_count--; - if (TRACE_GAPS) logerror("%s: Writing GAP3, size=%d\n", tag().c_str(), m_gap3_size); + if (TRACE_GAPS) logerror("%s: Writing GAP3, size=%d\n", tag(), m_gap3_size); write_on_track(encode_hd(0x4e), m_gap3_size, (m_sector_count>0)? WRITE_IDAM_SYNC : WRITE_GAP4); break; @@ -3397,7 +3397,7 @@ void hdc92x4_device::live_run_hd_until(attotime limit) wait_line(INDEX_LINE, ASSERT_LINE, TRACKDONE, true); if (TRACE_GAPS && m_last_live_state != WRITE_GAP4) { - logerror("%s: Writing GAP4\n", tag().c_str()); + logerror("%s: Writing GAP4\n", tag()); m_last_live_state = WRITE_GAP4; } // Write a single byte; when the index hole shows up, the live run will be aborted @@ -3406,7 +3406,7 @@ void hdc92x4_device::live_run_hd_until(attotime limit) // -------------------------------------------------------- default: - if (TRACE_LIVE) logerror("%s: Unknown state: %02x\n", tag().c_str(), m_live_state.state); + if (TRACE_LIVE) logerror("%s: Unknown state: %02x\n", tag(), m_live_state.state); break; } } @@ -3427,7 +3427,7 @@ void hdc92x4_device::live_sync() if(m_live_state.time > machine().time()) { // If so, we must roll back to the last checkpoint - if (TRACE_SYNC) logerror("%s: [%s] Rolling back and replaying [%s live]\n", tag().c_str(), ttsn().c_str(), tts(m_live_state.time).c_str()); + if (TRACE_SYNC) logerror("%s: [%s] Rolling back and replaying [%s live]\n", tag(), ttsn().c_str(), tts(m_live_state.time).c_str()); rollback(); // and replay until we reach the machine time @@ -3447,7 +3447,7 @@ void hdc92x4_device::live_sync() { // We are behind machine time, so we will never get back to that // time, thus we can commit that position - if (TRACE_SYNC) logerror("%s: [%s] Committing [%s live]\n", tag().c_str(), ttsn().c_str(), tts(m_live_state.time).c_str()); + if (TRACE_SYNC) logerror("%s: [%s] Committing [%s live]\n", tag(), ttsn().c_str(), tts(m_live_state.time).c_str()); // Commit bits from pll buffer to disk until live time (if there is something to write) if (using_floppy()) @@ -3474,7 +3474,7 @@ void hdc92x4_device::live_abort() { if (!m_live_state.time.is_never() && m_live_state.time > machine().time()) { - if (TRACE_LIVE) logerror("%s: [%s] Abort; rolling back and replaying [%s live]\n", tag().c_str(), ttsn().c_str(), tts(m_live_state.time).c_str()); + if (TRACE_LIVE) logerror("%s: [%s] Abort; rolling back and replaying [%s live]\n", tag(), ttsn().c_str(), tts(m_live_state.time).c_str()); rollback(); live_run_until(machine().time()); } @@ -3541,7 +3541,7 @@ void hdc92x4_device::wait_for_realtime(int state) { m_live_state.next_state = state; m_timer->adjust(m_live_state.time - machine().time()); - if (TRACE_LIVE) logerror("%s: [%s live] Waiting for real time [%s] to catch up; next state = %02x\n", tag().c_str(), tts(m_live_state.time).c_str(), ttsn().c_str(), state); + if (TRACE_LIVE) logerror("%s: [%s live] Waiting for real time [%s] to catch up; next state = %02x\n", tag(), tts(m_live_state.time).c_str(), ttsn().c_str(), state); } /* @@ -3666,7 +3666,7 @@ void hdc92x4_device::encode_raw(UINT16 raw) m_live_state.bit_counter = 16; m_live_state.shift_reg = m_live_state.shift_reg_save = raw; m_live_state.last_data_bit = raw & 1; - if (TRACE_WRITE && TRACE_DETAIL) logerror("%s: [%s live] Write %02x (%04x)\n", tag().c_str(), tts(m_live_state.time).c_str(), get_data_from_encoding(raw), raw); + if (TRACE_WRITE && TRACE_DETAIL) logerror("%s: [%s live] Write %02x (%04x)\n", tag(), tts(m_live_state.time).c_str(), get_data_from_encoding(raw), raw); checkpoint(); } @@ -3923,7 +3923,7 @@ READ8_MEMBER( hdc92x4_device::read ) { // Data register reply = m_register_r[m_register_pointer]; - if (TRACE_READREG) logerror("%s: Read register[%d] -> %02x\n", tag().c_str(), m_register_pointer, reply); + if (TRACE_READREG) logerror("%s: Read register[%d] -> %02x\n", tag(), m_register_pointer, reply); // Autoincrement until DATA is reached. if (m_register_pointer < DATA) m_register_pointer++; @@ -3935,7 +3935,7 @@ READ8_MEMBER( hdc92x4_device::read ) // "The interrupt pin is reset to its inactive state // when the UDC interrupt status register is read." [1] (p.3) - if (TRACE_READREG) logerror("%s: Read interrupt status register -> %02x\n", tag().c_str(), reply); + if (TRACE_READREG) logerror("%s: Read interrupt status register -> %02x\n", tag(), reply); set_interrupt(CLEAR_LINE); // Clear the bits due to interrupt status register read. @@ -3955,8 +3955,8 @@ WRITE8_MEMBER( hdc92x4_device::write ) { if ((offset & 1) == 0) { - if (TRACE_COMMAND) logerror("%s: New register write access %02x\n", tag().c_str(), data & 0xff); - if (m_executing) logerror("%s: Error - previous command %02x not completed; register access ignored\n", tag().c_str(), current_command()); + if (TRACE_COMMAND) logerror("%s: New register write access %02x\n", tag(), data & 0xff); + if (m_executing) logerror("%s: Error - previous command %02x not completed; register access ignored\n", tag(), current_command()); else { m_regvalue = data & 0xff; @@ -3965,8 +3965,8 @@ WRITE8_MEMBER( hdc92x4_device::write ) } else { - if (TRACE_COMMAND) logerror("%s: New incoming command %02x\n", tag().c_str(), data); - if (m_executing) logerror("%s: Error - previous command %02x not completed; new command %02x ignored\n", tag().c_str(), current_command(), data); + if (TRACE_COMMAND) logerror("%s: New incoming command %02x\n", tag(), data); + if (m_executing) logerror("%s: Error - previous command %02x not completed; new command %02x ignored\n", tag(), current_command(), data); else { m_register_w[COMMAND] = data; @@ -3987,9 +3987,9 @@ void hdc92x4_device::process_command() if (TRACE_SETREG) { if (m_register_pointer == INT_COMM_TERM) - logerror("%s: Setting interrupt trigger DONE=%d READY=%d\n", tag().c_str(), (m_regvalue & TC_INTDONE)? 1:0, (m_regvalue & TC_INTRDCH)? 1:0); + logerror("%s: Setting interrupt trigger DONE=%d READY=%d\n", tag(), (m_regvalue & TC_INTDONE)? 1:0, (m_regvalue & TC_INTRDCH)? 1:0); else - logerror("%s: register[%d] <- %02x\n", tag().c_str(), m_register_pointer, m_regvalue); + logerror("%s: register[%d] <- %02x\n", tag(), m_register_pointer, m_regvalue); } m_register_w[m_register_pointer] = m_regvalue; @@ -4032,7 +4032,7 @@ void hdc92x4_device::process_command() } if (!found) { - logerror("%s: Command %02x not defined\n", tag().c_str(), m_register_w[COMMAND]); + logerror("%s: Command %02x not defined\n", tag(), m_register_w[COMMAND]); } } auxbus_out(); @@ -4040,7 +4040,7 @@ void hdc92x4_device::process_command() void hdc92x4_device::reenter_command_processing() { - if (TRACE_DELAY) logerror("%s: Re-enter command processing; live state = %02x\n", tag().c_str(), m_live_state.state); + if (TRACE_DELAY) logerror("%s: Re-enter command processing; live state = %02x\n", tag(), m_live_state.state); // Do we have a live run on the track? if (m_live_state.state != IDLE) { @@ -4052,7 +4052,7 @@ void hdc92x4_device::reenter_command_processing() // We're here when there is no live_run anymore // Where were we last time? // Take care not to restart commands because of the index callback - if (TRACE_DELAY) logerror("%s: Continue with substate %02x\n", tag().c_str(), m_substate); + if (TRACE_DELAY) logerror("%s: Continue with substate %02x\n", tag(), m_substate); if (m_executing && m_substate != UNDEF) (this->*m_command)(); auxbus_out(); } @@ -4071,15 +4071,15 @@ void hdc92x4_device::set_command_done(int flags) { set_bits(m_register_r[INT_STATUS], ST_TERMCOD, false); // clear the previously set flags m_register_r[INT_STATUS] |= flags; - if (TRACE_DONE) logerror("%s: command %02x done, flags=%02x\n", tag().c_str(), current_command(), flags); + if (TRACE_DONE) logerror("%s: command %02x done, flags=%02x\n", tag(), current_command(), flags); } else { - if (TRACE_DONE) logerror("%s: command %02x done\n", tag().c_str(), current_command()); + if (TRACE_DONE) logerror("%s: command %02x done\n", tag(), current_command()); } // [1], p. 6 - if (TRACE_INT) logerror("%s: Raise interrupt DONE\n", tag().c_str()); + if (TRACE_INT) logerror("%s: Raise interrupt DONE\n", tag()); set_interrupt(ASSERT_LINE); m_substate = UNDEF; @@ -4147,7 +4147,7 @@ void hdc92x4_device::auxbus_in(UINT8 data) return; if (TRACE_AUXBUS) logerror("%s: Got value %02x via auxbus: ecc=%d index=%d seek_comp=%d tr00=%d user=%d writeprot=%d ready=%d fault=%d\n", - tag().c_str(), data, + tag(), data, (data&HDC_DS_ECCERR)? 1:0, (data&HDC_DS_INDEX)? 1:0, (data&HDC_DS_SKCOM)? 1:0, (data&HDC_DS_TRK00)? 1:0, (data&HDC_DS_UDEF)? 1:0, (data&HDC_DS_WRPROT)? 1:0, @@ -4181,20 +4181,20 @@ bool hdc92x4_device::waiting_for_other_line(int line) void hdc92x4_device::index_handler() { int level = index_hole()? ASSERT_LINE : CLEAR_LINE; - if (TRACE_LINES) logerror("%s: [%s] Index handler; level=%d\n", tag().c_str(), ttsn().c_str(), level); + if (TRACE_LINES) logerror("%s: [%s] Index handler; level=%d\n", tag(), ttsn().c_str(), level); // Synchronize our position on the track live_sync(); if (level==ASSERT_LINE) { - if (TRACE_INDEX) logerror("%s: Index pulse\n", tag().c_str()); + if (TRACE_INDEX) logerror("%s: Index pulse\n", tag()); if (m_wait_for_index) m_stop_after_index = true; } if (waiting_for_line(INDEX_LINE, level)) { - if (TRACE_LINES) logerror("%s: [%s] Index pulse level=%d triggers event\n", tag().c_str(), ttsn().c_str(), level); + if (TRACE_LINES) logerror("%s: [%s] Index pulse level=%d triggers event\n", tag(), ttsn().c_str(), level); m_substate = m_state_after_line; m_state_after_line = UNDEF; if (m_stopwrite) @@ -4216,7 +4216,7 @@ void hdc92x4_device::index_handler() void hdc92x4_device::ready_handler() { int level = drive_ready()? ASSERT_LINE : CLEAR_LINE; - if (TRACE_LINES) logerror("%s: [%s] Ready handler; level=%d\n", tag().c_str(), ttsn().c_str(), level); + if (TRACE_LINES) logerror("%s: [%s] Ready handler; level=%d\n", tag(), ttsn().c_str(), level); // Set the interrupt status flag set_bits(m_register_r[INT_STATUS], ST_RDYCHNG, true); @@ -4227,7 +4227,7 @@ void hdc92x4_device::ready_handler() // Raise an interrupt if desired if (m_register_w[INT_COMM_TERM] & TC_INTRDCH) { - if (TRACE_INT) logerror("%s: Raise interrupt READY change\n", tag().c_str()); + if (TRACE_INT) logerror("%s: Raise interrupt READY change\n", tag()); set_interrupt(ASSERT_LINE); } @@ -4243,7 +4243,7 @@ void hdc92x4_device::ready_handler() void hdc92x4_device::seek_complete_handler() { int level = seek_complete()? ASSERT_LINE : CLEAR_LINE; - if (TRACE_LINES) logerror("%s: [%s] Seek complete handler; level=%d\n", tag().c_str(), ttsn().c_str(), level); + if (TRACE_LINES) logerror("%s: [%s] Seek complete handler; level=%d\n", tag(), ttsn().c_str(), level); // Synchronize our position on the track live_sync(); @@ -4290,7 +4290,7 @@ void hdc92x4_device::auxbus_out() m_output2 = (m_output2 & 0xb0) | desired_head(); if (m_reduced_write_current) m_output2 |= OUT2_REDWRT; - if (TRACE_AUXBUS) logerror("%s: [%s] Setting OUTPUT1=%02x, OUTPUT2=%02x\n", tag().c_str(), ttsn().c_str(), m_output1, m_output2); + if (TRACE_AUXBUS) logerror("%s: [%s] Setting OUTPUT1=%02x, OUTPUT2=%02x\n", tag(), ttsn().c_str(), m_output1, m_output2); if (m_output1 != m_output1_old || m_output2 != m_output2_old) { @@ -4304,7 +4304,7 @@ void hdc92x4_device::auxbus_out() void hdc92x4_device::dma_address_out(UINT8 addrub, UINT8 addrhb, UINT8 addrlb) { - if (TRACE_DMA) logerror("%s: Setting DMA address %06x\n", tag().c_str(), (addrub<<16 | addrhb<<8 | addrlb)&0xffffff); + if (TRACE_DMA) logerror("%s: Setting DMA address %06x\n", tag(), (addrub<<16 | addrhb<<8 | addrlb)&0xffffff); m_out_auxbus((offs_t)HDC_OUTPUT_DMA_ADDR, addrub); m_out_auxbus((offs_t)HDC_OUTPUT_DMA_ADDR, addrhb); m_out_auxbus((offs_t)HDC_OUTPUT_DMA_ADDR, addrlb); @@ -4344,7 +4344,7 @@ WRITE_LINE_MEMBER( hdc92x4_device::dmaack ) { if (state==ASSERT_LINE) { - if (TRACE_DMA) logerror("%s: [%s] DMA acknowledged\n", tag().c_str(), ttsn().c_str()); + if (TRACE_DMA) logerror("%s: [%s] DMA acknowledged\n", tag(), ttsn().c_str()); set_bits(m_register_r[INT_STATUS], ST_OVRUN, false); } } @@ -4365,7 +4365,7 @@ void hdc92x4_device::connect_hard_drive(mfm_harddisk_device* harddisk) { m_harddisk = harddisk; m_hd_encoding = m_harddisk->get_encoding(); - if (TRACE_SELECT && TRACE_DETAIL) logerror("%s: HD encoding = %d\n", tag().c_str(), m_hd_encoding); + if (TRACE_SELECT && TRACE_DETAIL) logerror("%s: HD encoding = %d\n", tag(), m_hd_encoding); } /* @@ -4405,7 +4405,7 @@ WRITE_LINE_MEMBER( hdc92x4_device::reset ) { if (state == ASSERT_LINE) { - if (TRACE_LINES) logerror("%s: Reset via RST line\n", tag().c_str()); + if (TRACE_LINES) logerror("%s: Reset via RST line\n", tag()); device_reset(); } } |