mirror of
https://github.com/holub/mame
synced 2025-04-23 17:00:53 +03:00
woz/flux: better implementation
This commit is contained in:
parent
5b034e4921
commit
709bb88139
@ -1743,20 +1743,24 @@ bool a2_woz_format::load(util::random_read &io, uint32_t form_factor, const std:
|
||||
uint32_t boff = (uint32_t)r16(img, trks_off + 0) * 512;
|
||||
uint32_t track_size = r32(img, trks_off + 4);
|
||||
|
||||
uint32_t total_ticks = 0;
|
||||
for(uint32_t i=0; i != track_size; i++)
|
||||
total_ticks += img[boff+i];
|
||||
// Ticks are 125ns, e.g. 8000000 ticks per second
|
||||
static const int ticks_per_speed_zone[5] = {
|
||||
60 * 8000000 / 394,
|
||||
60 * 8000000 / 429,
|
||||
60 * 8000000 / 472,
|
||||
60 * 8000000 / 525,
|
||||
60 * 8000000 / 590
|
||||
};
|
||||
|
||||
// Assumptions: track starts at index, there's no flux
|
||||
// change at index, there's no flux change at the end
|
||||
uint32_t total_ticks = is_35 ? ticks_per_speed_zone[trkid / (2*16)] : 60 * 8000000 / 300;
|
||||
|
||||
std::vector<uint32_t> &buf = image->get_buffer(track, head, subtrack);
|
||||
uint32_t cpos = 0;
|
||||
for(uint32_t i=0; i != track_size; i++) {
|
||||
uint8_t step = img[boff+i];
|
||||
cpos += step;
|
||||
if(step != 0xff && i != track_size-1)
|
||||
buf.push_back(uint64_t(cpos)*200000000/total_ticks);
|
||||
if(step != 0xff)
|
||||
buf.push_back(floppy_image::MG_F | uint64_t(cpos)*200000000/total_ticks);
|
||||
}
|
||||
|
||||
} else if(idx != 0xff) {
|
||||
|
Loading…
Reference in New Issue
Block a user