Skip to content

Commit

Permalink
Fixed image truncate and a lockup during disk formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
mizapf committed Jul 14, 2015
1 parent 32fd5e1 commit 2fe1b16
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
12 changes: 7 additions & 5 deletions src/emu/machine/hdc9234.c
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion src/osd/sdl/sdlfile.c
Expand Up @@ -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;

Expand Down

0 comments on commit 2fe1b16

Please sign in to comment.