Significantly speed up floppy turbo mode when the FDC is using DMA.

This commit is contained in:
OBattler
2025-05-07 23:08:26 +02:00
parent 58f342c277
commit d6338e42cc
3 changed files with 25 additions and 3 deletions

View File

@@ -279,6 +279,15 @@ fdc_is_mfm(fdc_t *fdc)
return fdc->mfm ? 1 : 0;
}
int
fdc_is_dma(fdc_t *fdc)
{
if ((fdc->flags & FDC_FLAG_PCJR) || !fdc->dma)
return 0;
else
return 1;
}
void
fdc_request_next_sector_id(fdc_t *fdc)
{

View File

@@ -2414,16 +2414,28 @@ d86f_turbo_poll(int drive, int side)
case STATE_0C_READ_DATA:
case STATE_11_SCAN_DATA:
case STATE_16_VERIFY_DATA:
d86f_turbo_read(drive, side);
if (fdc_is_dma(d86f_fdc))
for (int i = 0; i < (128 << dev->last_sector.id.n); i++)
d86f_turbo_read(drive, side);
else
d86f_turbo_read(drive, side);
break;
case STATE_05_WRITE_DATA:
case STATE_09_WRITE_DATA:
d86f_turbo_write(drive, side);
if (fdc_is_dma(d86f_fdc))
for (int i = 0; i < (128 << dev->last_sector.id.n); i++)
d86f_turbo_write(drive, side);
else
d86f_turbo_write(drive, side);
break;
case STATE_0D_FORMAT_TRACK:
d86f_turbo_format(drive, side, (side && (d86f_get_sides(drive) != 2)));
if (fdc_is_dma(d86f_fdc))
while (dev->state == STATE_0D_FORMAT_TRACK)
d86f_turbo_format(drive, side, (side && (d86f_get_sides(drive) != 2)));
else
d86f_turbo_format(drive, side, (side && (d86f_get_sides(drive) != 2)));
return;
case STATE_IDLE:

View File

@@ -206,6 +206,7 @@ extern int fdc_get_drive(fdc_t *fdc);
extern int fdc_get_perp(fdc_t *fdc);
extern int fdc_get_format_n(fdc_t *fdc);
extern int fdc_is_mfm(fdc_t *fdc);
extern int fdc_is_dma(fdc_t *fdc);
extern double fdc_get_hut(fdc_t *fdc);
extern double fdc_get_hlt(fdc_t *fdc);
extern void fdc_request_next_sector_id(fdc_t *fdc);