MCPcopy Create free account
hub / github.com/BlitterStudio/amiberry / reset_drive

Function reset_drive

src/disk.cpp:862–911  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

860}
861
862static void reset_drive (int num)
863{
864 drive *drv = &floppy[num];
865
866 drv->amax = 0;
867 drive_image_free (drv);
868 drv->motoroff = 1;
869 drv->idbit = 0;
870 drv->drive_id = 0;
871 drv->drive_id_scnt = 0;
872 drv->lastdataacesstrack = -1;
873 disabled &= ~(1 << num);
874 reserved &= ~(1 << num);
875 if (currprefs.floppyslots[num].dfxtype < 0 || ispcbridgedrive(num))
876 disabled |= 1 << num;
877 if (ispcbridgedrive(num))
878 reserved |= 1 << num;
879 reset_drive_gui (num);
880 /* most internal Amiga floppy drives won't enable
881 * diskready until motor is running at full speed
882 * and next indexsync has been passed
883 */
884 drv->indexhackmode = 0;
885 if (num == 0 && currprefs.floppyslots[num].dfxtype == 0)
886 drv->indexhackmode = 1;
887 drv->dskchange_time = 0;
888 drv->dskeject_time = 0;
889 drv->dskchange = false;
890 drv->dskready_down_time = 0;
891 drv->dskready_up_time = 0;
892 drv->buffered_cyl = -1;
893 drv->buffered_side = -1;
894 gui_led (num + LED_DF0, 0, -1);
895 drive_settype_id (drv);
896 _tcscpy (currprefs.floppyslots[num].df, changed_prefs.floppyslots[num].df);
897 drv->newname[0] = 0;
898 drv->newnamewriteprotected = false;
899#ifdef FLOPPYBRIDGE
900 if (drv->bridge) {
901 drv->bridge->resetDrive(drv->cyl);
902 drv->indexhackmode = 0;
903 drv->num_tracks = drv->bridge->getMaxCylinder() * 2;
904 drv->filetype = ADF_FLOPPYBRIDGE;
905 drv->tracklen = drv->bridge->maxMFMBitPosition();
906 drv->ddhd = drv->bridge->getDriveTypeID() == FloppyDiskBridge::DriveTypeID::dti35HD ? 2 : 1;
907 }
908#endif
909 if (!drive_insert (drv, &currprefs, num, currprefs.floppyslots[num].df, false, false))
910 disk_eject (num);
911}
912
913/* code for track display */
914static void update_drive_gui(int num, bool force)

Callers 2

DISK_check_changeFunction · 0.85
DISK_resetFunction · 0.85

Calls 10

drive_image_freeFunction · 0.85
ispcbridgedriveFunction · 0.85
reset_drive_guiFunction · 0.85
drive_settype_idFunction · 0.85
disk_ejectFunction · 0.85
gui_ledFunction · 0.50
resetDriveMethod · 0.45
getMaxCylinderMethod · 0.45
maxMFMBitPositionMethod · 0.45
getDriveTypeIDMethod · 0.45

Tested by

no test coverage detected