floppy: Fix for a segfault when emulating HP9895 drive [F.Ulivi]

This commit is contained in:
fulivi 2017-05-21 19:24:11 +02:00 committed by Olivier Galibert
parent a43cc7edeb
commit a662d26e29

View File

@ -737,7 +737,14 @@ uint32_t floppy_image_device::find_position(attotime &base, const attotime &when
base -= rev_time;
}
return (delta*floppy_ratio_1).as_ticks(1000000000/1000);
uint32_t res = (delta*floppy_ratio_1).as_ticks(1000000000/1000);
if (res > 200000000) {
// Due to rounding errors in the previous operation,
// 'res' sometimes overflows 2E+8
res -= 200000000;
base += rev_time;
}
return res;
}
attotime floppy_image_device::get_next_index_time(std::vector<uint32_t> &buf, int index, int delta, attotime base)