Floppy changes.

This commit is contained in:
OBattler
2020-03-23 09:02:32 +01:00
parent 103bdacfaa
commit 04193fb199
3 changed files with 29 additions and 22 deletions

View File

@@ -702,10 +702,6 @@ fdc_write(uint16_t addr, uint8_t val, void *priv)
fdc->stat = 0x00;
fdc->pnum = fdc->ptot = 0;
}
if (val&4) {
fdc->stat = 0x80;
fdc->pnum = fdc->ptot = 0;
}
if ((val&4) && !(fdc->dor&4)) {
timer_set_delay_u64(&fdc->timer, 8 * TIMER_USEC);
fdc->interrupt = -1;
@@ -775,7 +771,16 @@ fdc_write(uint16_t addr, uint8_t val, void *priv)
fdc->stat |= 0x10;
fdc_log("Starting FDC command %02X\n",fdc->command);
switch (fdc->command & 0x1f) {
if (((fdc->command & 0x1f) == 0x02) || ((fdc->command & 0x1f) == 0x05) ||
((fdc->command & 0x1f) == 0x06) || ((fdc->command & 0x1f) == 0x0a) ||
((fdc->command & 0x1f) == 0x0c) || ((fdc->command & 0x1f) == 0x0d) ||
((fdc->command & 0x1f) == 0x11) || ((fdc->command & 0x1f) == 0x16) ||
((fdc->command & 0x1f) == 0x19) || ((fdc->command & 0x1f) == 0x1d))
fdc->processed_cmd = fdc->command & 0x1f;
else
fdc->processed_cmd = fdc->command;
switch (fdc->processed_cmd) {
case 0x01: /*Mode*/
if (fdc->flags & FDC_FLAG_NSC) {
fdc->pnum = 0;
@@ -921,7 +926,7 @@ fdc_write(uint16_t addr, uint8_t val, void *priv)
}
if (fdc->pnum == fdc->ptot) {
fdc_log("Got all params %02X\n", fdc->command);
fdc->interrupt = fdc->command & 0x1F;
fdc->interrupt = fdc->processed_cmd;
fdc->reset_stat = 0;
/* Disable timer if enabled. */
timer_disable(&fdc->timer);
@@ -950,7 +955,7 @@ fdc_write(uint16_t addr, uint8_t val, void *priv)
break;
}
/* Process the firt phase of the command. */
switch (fdc->interrupt & 0x1F) {
switch (fdc->processed_cmd) {
case 0x02: /* Read a track */
fdc_io_command_phase1(fdc, 0);
fdc->read_track_sector.id.c = fdc->params[1];
@@ -1072,7 +1077,8 @@ fdc_write(uint16_t addr, uint8_t val, void *priv)
fdc->stat = (1 << fdc->drive);
if (!(fdc->flags & FDC_FLAG_PCJR))
fdc->stat |= 0x80;
fdc->head = (fdc->params[0] & 4) ? 1 : 0;
/* fdc->head = (fdc->params[0] & 4) ? 1 : 0; */
fdc->head = 0; /* TODO: See if this is correct. */
fdc->st0 = fdc->params[0] & 0x03;
fdc->st0 |= (fdc->params[0] & 4);
fdc->st0 |= 0x80;
@@ -1210,21 +1216,22 @@ fdc_read(uint16_t addr, void *priv)
}
} else {
if (is486 || !fdc->enable_3f1)
return 0xff;
ret = 0xff;
else {
ret = 0x70;
ret = 0x70;
drive = real_drive(fdc, fdc->dor & 3);
drive = real_drive(fdc, fdc->dor & 3);
if (drive)
ret &= ~0x40;
else
ret &= ~0x20;
if (drive)
ret &= ~0x40;
else
ret &= ~0x20;
if (fdc->dor & 0x10)
ret |= 1;
if (fdc->dor & 0x20)
ret |= 2;
if (fdc->dor & 0x10)
ret |= 1;
if (fdc->dor & 0x20)
ret |= 2;
}
}
break;
case 2:

View File

@@ -36,7 +36,7 @@
typedef struct {
uint8_t dor, stat, command, dat, st0, swap;
uint8_t dor, stat, command, processed_cmd, dat, st0, swap;
uint8_t swwp, disable_write;
uint8_t params[256], res[256];
uint8_t specify[256], format_dat[256];

View File

@@ -826,7 +826,7 @@ d86f_byteperiod(int drive)
int
d86f_is_mfm(int drive)
{
return (d86f_track_flags(drive) & 8) ? 1 : 0;
return ((d86f_track_flags(drive) & 0x18) == 0x08) ? 1 : 0;
}