From a9b4bb30d8653f2f50c59fbc46f1debea89f9f8e Mon Sep 17 00:00:00 2001 From: Alex Oughton Date: Mon, 28 Feb 2022 09:07:57 -0500 Subject: [PATCH] x86: Eject floppy before inserting new (#560) --- support/x86/x86.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/support/x86/x86.cpp b/support/x86/x86.cpp index 59101b3..a5c9334 100644 --- a/support/x86/x86.cpp +++ b/support/x86/x86.cpp @@ -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);