155 |
|
int sector; |
156 |
|
|
157 |
|
// Encode each sector |
158 |
< |
for (sector = 0; sector < num_sectors[track]; sector++) { |
158 |
> |
for (sector = 0; sector < format->num_sectors[track]; sector++) { |
159 |
|
encode_header(track, sector, 0x41, 0x41); |
160 |
|
encode_data(track, track_buf + SECTOR_SIZE * sector); |
161 |
|
} |
172 |
|
|
173 |
|
// Write empty track |
174 |
|
inb(c.iobase + 1); |
175 |
< |
for (i = 0; i < bps[std_speed[track]] * 60 / drive_rpm; i++) |
175 |
> |
for (i = 0; i < format->bps[format->std_speed[track]] * 60 / drive_rpm; i++) |
176 |
|
PUT(2); |
177 |
|
outb(0xff, c.io_mem); |
178 |
< |
if (!catweasel_write(c.drives + drive, 0, 1, 1100 * 60 / drive_rpm)) { |
178 |
> |
if (!catweasel_write(c.drives + drive, track > format->tracks_per_side ? 1 : 0, 1, 1100 * 60 / drive_rpm)) { |
179 |
|
fprintf(stderr, "Error writing track %d\n", track); |
180 |
|
return 0; |
181 |
|
} |
225 |
|
if (!catweasel_write_protected(c.drives + drive_num)) { |
226 |
|
|
227 |
|
// No, write all tracks |
228 |
< |
for (track = 1; track <= NUM_TRACKS; track++) { |
228 |
> |
for (track = 1; track <= format->sides * format->tracks_per_side; track++) { |
229 |
|
printf("Track %d...\n", track); |
230 |
< |
if (fread(track_buf, 256, num_sectors[track], f) != num_sectors[track]) { |
230 |
> |
if (fread(track_buf, 256, format->num_sectors[track], f) != format->num_sectors[track]) { |
231 |
|
fprintf(stderr, "Error reading input file\n"); |
232 |
|
break; |
233 |
|
} |