Sanitized some stuff in fdd_86f.c.

This commit is contained in:
OBattler
2020-06-28 04:46:32 +02:00
parent d5f43204c9
commit 926ed40741

View File

@@ -103,10 +103,6 @@ enum {
/* 1 11 01 ??? */ /* 1 11 01 ??? */
STATE_0D_SPIN_TO_INDEX = 0xE8, /* FORMAT TRACK */ STATE_0D_SPIN_TO_INDEX = 0xE8, /* FORMAT TRACK */
STATE_0D_FORMAT_TRACK, STATE_0D_FORMAT_TRACK,
/* 1 11 11 ??? */
STATE_0D_NOP_SPIN_TO_INDEX = 0xF8, /* FORMAT TRACK */
STATE_0D_NOP_FORMAT_TRACK
}; };
enum { enum {
@@ -821,16 +817,14 @@ uint32_t
d86f_get_data_len(int drive) d86f_get_data_len(int drive)
{ {
d86f_t *dev = d86f[drive]; d86f_t *dev = d86f[drive];
uint32_t i, ret = 128;
if (dev->req_sector.id.n) { if (dev->req_sector.id.n)
if (dev->req_sector.id.n == 8) return 32768; ret = (uint32_t)128 << dev->req_sector.id.n;
return (128 << ((uint32_t) dev->req_sector.id.n)); else if ((i = fdc_get_dtl(d86f_fdc)) < 128)
} else { ret = i;
if (fdc_get_dtl(d86f_fdc) < 128)
return fdc_get_dtl(d86f_fdc); return ret;
else
return (128 << ((uint32_t) dev->req_sector.id.n));
}
} }
@@ -1769,7 +1763,7 @@ d86f_spin_to_index(int drive, int side)
d86f_advance_bit(drive, side); d86f_advance_bit(drive, side);
if (dev->track_pos == d86f_handler[drive].index_hole_pos(drive, side)) { if (dev->track_pos == d86f_handler[drive].index_hole_pos(drive, side)) {
if ((dev->state == STATE_0D_SPIN_TO_INDEX) || (dev->state == STATE_0D_NOP_SPIN_TO_INDEX)) { if (dev->state == STATE_0D_SPIN_TO_INDEX) {
/* When starting format, reset format state to the beginning. */ /* When starting format, reset format state to the beginning. */
dev->preceding_bit[side] = 1; dev->preceding_bit[side] = 1;
dev->format_state = FMT_PRETRK_GAP0; dev->format_state = FMT_PRETRK_GAP0;
@@ -2089,22 +2083,6 @@ d86f_format_track(int drive, int side, int do_write)
} }
void
d86f_format_track_normal(int drive, int side)
{
d86f_t *dev = d86f[drive];
d86f_format_track(drive, side, (dev->version == D86FVER));
}
void
d86f_format_track_nop(int drive, int side)
{
d86f_format_track(drive, side, 0);
}
void void
d86f_initialize_last_sector_id(int drive, int c, int h, int r, int n) d86f_initialize_last_sector_id(int drive, int c, int h, int r, int n)
{ {
@@ -2306,7 +2284,6 @@ d86f_turbo_poll(int drive, int side)
switch(dev->state) { switch(dev->state) {
case STATE_0D_SPIN_TO_INDEX: case STATE_0D_SPIN_TO_INDEX:
case STATE_0D_NOP_SPIN_TO_INDEX:
dev->sector_count = 0; dev->sector_count = 0;
dev->datac = 5; dev->datac = 5;
/*FALLTHROUGH*/ /*FALLTHROUGH*/
@@ -2401,11 +2378,7 @@ d86f_turbo_poll(int drive, int side)
break; break;
case STATE_0D_FORMAT_TRACK: case STATE_0D_FORMAT_TRACK:
d86f_turbo_format(drive, side, 0); d86f_turbo_format(drive, side, (side && (d86f_get_sides(drive) != 2)));
return;
case STATE_0D_NOP_FORMAT_TRACK:
d86f_turbo_format(drive, side, 1);
return; return;
case STATE_IDLE: case STATE_IDLE:
@@ -2449,7 +2422,6 @@ d86f_poll(int drive)
switch(dev->state) { switch(dev->state) {
case STATE_02_SPIN_TO_INDEX: case STATE_02_SPIN_TO_INDEX:
case STATE_0D_SPIN_TO_INDEX: case STATE_0D_SPIN_TO_INDEX:
case STATE_0D_NOP_SPIN_TO_INDEX:
d86f_spin_to_index(drive, side); d86f_spin_to_index(drive, side);
return; return;
@@ -2536,12 +2508,7 @@ d86f_poll(int drive)
case STATE_0D_FORMAT_TRACK: case STATE_0D_FORMAT_TRACK:
if (! (dev->track_pos & 15)) if (! (dev->track_pos & 15))
d86f_format_track_normal(drive, side); d86f_format_track(drive, side, (!side || (d86f_get_sides(drive) == 2)) && (dev->version == D86FVER));
return;
case STATE_0D_NOP_FORMAT_TRACK:
if (! (dev->track_pos & 15))
d86f_format_track_nop(drive, side);
return; return;
case STATE_IDLE: case STATE_IDLE:
@@ -3421,10 +3388,7 @@ d86f_common_format(int drive, int side, int rate, uint8_t fill, int proxy)
dev->index_count = dev->error_condition = dev->satisfying_bytes = dev->sector_count = 0; dev->index_count = dev->error_condition = dev->satisfying_bytes = dev->sector_count = 0;
dev->dma_over = 0; dev->dma_over = 0;
if (!side || (d86f_get_sides(drive) == 2)) dev->state = STATE_0D_SPIN_TO_INDEX;
dev->state = STATE_0D_SPIN_TO_INDEX;
else
dev->state = STATE_0D_NOP_SPIN_TO_INDEX;
} }