x86: Eject floppy before inserting new (#560)

This commit is contained in:
Alex Oughton
2022-02-28 09:07:57 -05:00
committed by GitHub
parent 1c250abbce
commit a9b4bb30d8

View File

@@ -257,6 +257,10 @@ static void fdd_set(int num, char* filename)
printf(" total_sectors: %d\n\n", floppy_total_sectors);
uint32_t subaddr = num << 7;
IOWR(FDD0_BASE + subaddr, 0x0, 0); // Always eject floppy before insertion
usleep(100000);
IOWR(FDD0_BASE + subaddr, 0x0, floppy ? 1 : 0);
IOWR(FDD0_BASE + subaddr, 0x1, (floppy && (fdd_image->mode & O_RDWR)) ? 0 : 1);
IOWR(FDD0_BASE + subaddr, 0x2, floppy_cylinders);