]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
x86 bridgeboard floppy drive support.
authorToni Wilen <twilen@winuae.net>
Mon, 27 Jul 2015 16:24:50 +0000 (19:24 +0300)
committerToni Wilen <twilen@winuae.net>
Mon, 27 Jul 2015 16:24:50 +0000 (19:24 +0300)
disk.cpp
include/disk.h

index d6c0995a9b48855581a07dbf686508d041f6b486..d680cee900eba04b0d3b29e3a89d73a93ddbc5cb 100644 (file)
--- a/disk.cpp
+++ b/disk.cpp
@@ -609,7 +609,8 @@ static void drive_settype_id (drive *drv)
                drv->drive_id = DRIVE_ID_525SD;
                break;
        case DRV_NONE:
-       case DRV_PC_ONLY:
+       case DRV_PC_ONLY_40:
+       case DRV_PC_ONLY_80:
                drv->drive_id = DRIVE_ID_NONE;
                break;
        }
@@ -692,9 +693,9 @@ static void reset_drive (int num)
        drv->lastdataacesstrack = -1;
        disabled &= ~(1 << num);
        reserved &= ~(1 << num);
-       if (currprefs.floppyslots[num].dfxtype < 0 || currprefs.floppyslots[num].dfxtype >= DRV_PC_ONLY)
+       if (currprefs.floppyslots[num].dfxtype < 0 || currprefs.floppyslots[num].dfxtype >= DRV_PC_ONLY_40)
                disabled |= 1 << num;
-       if (currprefs.floppyslots[num].dfxtype >= DRV_PC_ONLY)
+       if (currprefs.floppyslots[num].dfxtype >= DRV_PC_ONLY_40)
                reserved |= 1 << num;
        reset_drive_gui (num);
        /* most internal Amiga floppy drives won't enable
@@ -1138,6 +1139,9 @@ static int drive_insert (drive * drv, struct uae_prefs *p, int dnum, const TCHAR
                canauto = 1;
        if (!canauto && drv->diskfile && isrecognizedext (zfile_getname (drv->diskfile)))
                canauto = 1;
+       // if PC-only drive, make sure PC-like floppies are alwayss detected
+       if (!canauto && currprefs.floppyslots[dnum].dfxtype >= DRV_PC_ONLY_40)
+               canauto = 1;
 
        if (drv->catweasel) {
 
@@ -4668,7 +4672,7 @@ int getdebug(void)
        return floppy[0].mfmpos;
 }
 
-void disk_reserved_setinfo(int num, int cyl, int head, int motor)
+static int get_reserved_id(int num)
 {
        for (int i = 0; i < MAX_FLOPPY_DRIVES; i++) {
                if (reserved & (1 << i)) {
@@ -4676,32 +4680,47 @@ void disk_reserved_setinfo(int num, int cyl, int head, int motor)
                                num--;
                                continue;
                        }
-                       drive *drv = &floppy[i];
-                       reserved_side = head;
-                       drv->cyl = cyl;
-                       drv->state = motor;
-                       update_drive_gui(i, false);
+                       return i;
                }
        }
+       return -1;
+}
+
+void disk_reserved_setinfo(int num, int cyl, int head, int motor)
+{
+       int i = get_reserved_id(num);
+       if (i >= 0) {
+               drive *drv = &floppy[i];
+               reserved_side = head;
+               drv->cyl = cyl;
+               drv->state = motor;
+               update_drive_gui(i, false);
+       }
 }
 
 bool disk_reserved_getinfo(int num, struct floppy_reserved *fr)
 {
-       for (int i = 0; i < MAX_FLOPPY_DRIVES; i++) {
-               if (reserved & (1 << i)) {
-                       if (num > 0) {
-                               num--;
-                               continue;
-                       }
-                       drive *drv = &floppy[i];
-                       fr->img = drv->diskfile;
-                       fr->wrprot = drv->wrprot;
-                       fr->cyl = drv->cyl;
-                       fr->cyls = drv->num_tracks / 2;
-                       fr->secs = drv->num_secs;
-                       fr->heads = 2;
-                       return true;
-               }
+       int i = get_reserved_id(num);
+       if (i >= 0) {
+               drive *drv = &floppy[i];
+               fr->img = drv->diskfile;
+               fr->wrprot = drv->wrprot;
+               fr->cyl = drv->cyl;
+               fr->cyls = drv->num_tracks / 2;
+               fr->drive_cyls = currprefs.floppyslots[i].dfxtype == DRV_PC_ONLY_40 ? 40 : 80;
+               fr->secs = drv->num_secs;
+               fr->heads = 2;
+               fr->disk_changed = drv->dskchange || fr->img == NULL;
+               return true;
        }
        return false;
 }
+
+void disk_reserved_reset_disk_change(int num)
+{
+       int i = get_reserved_id(num);
+       if (i >= 0) {
+               drive *drv = &floppy[i];
+               drv->dskchange = false;
+       }
+}
\ No newline at end of file
index 8d8bb342c2b81f9b419b2a80f4fa483a8f99d19b..933f05cc45116b8d0efc1955a0837bd479760dd2 100644 (file)
@@ -6,7 +6,7 @@
   * (c) 1995 Bernd Schmidt
   */
 
-typedef enum { DRV_NONE = -1, DRV_35_DD = 0, DRV_35_HD, DRV_525_SD, DRV_35_DD_ESCOM, DRV_PC_ONLY } drive_type;
+typedef enum { DRV_NONE = -1, DRV_35_DD = 0, DRV_35_HD, DRV_525_SD, DRV_35_DD_ESCOM, DRV_PC_ONLY_40, DRV_PC_ONLY_80 } drive_type;
 
 #define HISTORY_FLOPPY 0
 #define HISTORY_CD 1
@@ -35,9 +35,12 @@ struct floppy_reserved
        int cyls;
        int heads;
        int secs;
+       int drive_cyls;
+       bool disk_changed;
 };
 void disk_reserved_setinfo(int num, int cyl, int head, int motor);
 bool disk_reserved_getinfo(int num, struct floppy_reserved *fr);
+void disk_reserved_reset_disk_change(int num);
 
 extern void DISK_init (void);
 extern void DISK_free (void);