From 2fe1b16c633e11bb9a7d41a2861a15ed17784d48 Mon Sep 17 00:00:00 2001 From: Michael Zapf Date: Tue, 14 Jul 2015 23:08:06 +0200 Subject: [PATCH] Fixed image truncate and a lockup during disk formatting --- src/emu/machine/hdc9234.c | 12 +++++++----- src/osd/sdl/sdlfile.c | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/emu/machine/hdc9234.c b/src/emu/machine/hdc9234.c index 06d1eba4cc31a..4247f17aa51f3 100644 --- a/src/emu/machine/hdc9234.c +++ b/src/emu/machine/hdc9234.c @@ -1740,7 +1740,7 @@ void hdc9234_device::format_track() switch (m_substate) { case WAITINDEX0: - if (TRACE_FORMAT && TRACE_DETAIL) logerror("%s: Format track - waiting for index hole\n", tag()); + if (TRACE_FORMAT && TRACE_DETAIL) logerror("%s: Format track; looking for track start\n", tag()); if (!index_hole()) { m_substate = WAITINDEX1; @@ -1749,13 +1749,14 @@ void hdc9234_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 ... waiting for next\n", tag()); - wait_line(INDEX_LINE, ASSERT_LINE, WAITINDEX1, false); + 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()); wait_line(INDEX_LINE, ASSERT_LINE, TRACKSTART, false); cont = WAIT; break; @@ -2503,8 +2504,9 @@ void hdc9234_device::live_run_until(attotime limit) write_on_track(encode((m_live_state.crc >> 8) & 0xff), 1, WRITE_DATA_CRC); } else - // Write a filler byte so that the last CRC bit is saved correctly - write_on_track(encode(0xff), 1, WRITE_DONE); + // Write a filler byte so that the last CRC bit is saved correctly (why actually?) + // write_on_track(encode(0xff), 1, WRITE_DONE); + m_live_state.state = WRITE_DONE; break; diff --git a/src/osd/sdl/sdlfile.c b/src/osd/sdl/sdlfile.c index 24fe05ac0278b..74779252641ce 100644 --- a/src/osd/sdl/sdlfile.c +++ b/src/osd/sdl/sdlfile.c @@ -375,7 +375,7 @@ file_error osd_truncate(osd_file *file, UINT64 offset) { case SDLFILE_FILE: result = ftruncate(file->handle, offset); - if (!result) + if (result) return error_to_file_error(errno); return FILERR_NONE;