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

Function drive_step

src/disk.cpp:1836–1910  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1834}
1835
1836static void drive_step(drive *drv, int step_direction)
1837{
1838#ifdef CATWEASEL
1839 if (drv->catweasel) {
1840 int dir = direction ? -1 : 1;
1841 catweasel_step (drv->catweasel, dir);
1842 drv->cyl += dir;
1843 if (drv->cyl < 0)
1844 drv->cyl = 0;
1845 write_log (_T("%d -> %d\n"), dir, drv->cyl);
1846 return;
1847 }
1848#endif
1849 if (!drive_empty (drv))
1850 drv->dskchange = 0;
1851
1852#ifdef FLOPPYBRIDGE
1853 if (drv->bridge) {
1854 int dir = step_direction ? -1 : 1;
1855 drv->cyl += dir;
1856 if (drv->cyl < 0) {
1857 drv->cyl = 0;
1858 drv->bridge->handleNoClickStep(side);
1859 } else {
1860 if (drv->cyl >= drv->bridge->getMaxCylinder()) {
1861 drv->cyl = drv->bridge->getMaxCylinder() - 1;
1862 }
1863 drv->bridge->gotoCylinder(drv->cyl, side);
1864 }
1865 return;
1866 }
1867#endif
1868
1869 if (drv->steplimit && get_cycles() - drv->steplimitcycle < MIN_STEPLIMIT_CYCLE) {
1870 write_log (_T(" step ignored drive %ld, %lu\n"),
1871 drv - floppy, (get_cycles() - drv->steplimitcycle) / CYCLE_UNIT);
1872 return;
1873 }
1874 /* A1200's floppy drive needs at least 30 raster lines between steps
1875 * but we'll use very small value for better compatibility with faster CPU emulation
1876 * (stupid trackloaders with CPU delay loops)
1877 */
1878 set_steplimit (drv);
1879 if (step_direction) {
1880 if (drv->cyl) {
1881 drv->cyl--;
1882#ifdef DRIVESOUND
1883 if (isfloppysound (drv))
1884 driveclick_click(drv->drvnum, drv->cyl);
1885#endif
1886 }
1887 /* else
1888 write_log (_T("program tried to step beyond track zero\n"));
1889 "no-click" programs does that
1890 */
1891 } else {
1892 int maxtrack = drv->hard_num_cyls;
1893 if (drv->cyl < maxtrack + 3) {

Callers 1

DISK_selectFunction · 0.85

Calls 10

drive_emptyFunction · 0.85
get_cyclesFunction · 0.85
set_steplimitFunction · 0.85
isfloppysoundFunction · 0.85
driveclick_clickFunction · 0.85
rand_shifterFunction · 0.85
write_logFunction · 0.70
handleNoClickStepMethod · 0.45
getMaxCylinderMethod · 0.45
gotoCylinderMethod · 0.45

Tested by

no test coverage detected