Skip to content

FloppyDriveAPI ​

cpp
#include <VAmiga.h>
cpp
class FloppyDriveAPI

Defined in VAmiga.h:1189

API of a floppy drive.

Public Methods ​

ReturnNameDescription
const FloppyDriveConfig &getConfig constReturns the component's current configuration.
const FloppyDriveInfo &getInfo constReturns the component's current state.
const FloppyDriveInfo &getCachedInfo constReturns the most recent state snapshot recorded by the emulator thread (see getInfo()).
boolgetFlag constQueries a disk flag.
voidsetFlagSets or clears one or more disk flags.
boolisInsertable constChecks whether the drive is compatible with disks of a particular geometry.
voidinsertBlankDiskInserts a new disk.
voidinsertBlankDiskAsyncAsynchronous version of insertBlankDisk(): queues the request and returns at once.
voidinsertInserts a disk created from an image file.
voidinsertInserts a disk created from an image stored in memory.
voidinsertAsyncAsynchronous version of insert(): queues the request and returns at once.
voidejectDiskEjects the current disk.
voidwriteToFileExports the current disk to a file.
std::filesystem::pathpath constReturns the file the disk lives in.
boolneedsPersisting constIndicates whether the disk holds changes its file does not have yet.
voidpersistWrites all changes back to the file the disk lives in.
stringreadTrackBitsCreates a textual bit representation of a track's data.

getConfig ​

const

cpp
const FloppyDriveConfig & getConfig() const

Defined in VAmiga.h:1199

Returns the component's current configuration.


getInfo ​

const

cpp
const FloppyDriveInfo & getInfo() const

Defined in VAmiga.h:1210

Returns the component's current state.

getInfo() reads the live state on the calling thread. The result is only consistent if the emulator is paused or suspended. getCachedInfo() returns the snapshot the emulator thread has recorded most recently, which is the one to use while the emulator runs. Both return references that can be overwritten by a later call or by the emulator thread, so copy the data if you need to keep it.


getCachedInfo ​

const

cpp
const FloppyDriveInfo & getCachedInfo() const

Defined in VAmiga.h:1212

Returns the most recent state snapshot recorded by the emulator thread (see getInfo()).


getFlag ​

const

cpp
bool getFlag(DiskFlags mask) const

Defined in VAmiga.h:1216

Queries a disk flag.


setFlag ​

cpp
void setFlag(DiskFlags mask, bool value)

Defined in VAmiga.h:1220

Sets or clears one or more disk flags.


isInsertable ​

const

cpp
bool isInsertable(Diameter t, Density d) const

Defined in VAmiga.h:1225

Checks whether the drive is compatible with disks of a particular geometry.


insertBlankDisk ​

cpp
void insertBlankDisk(retro::vault::amiga::FSFormat fstype, retro::vault::amiga::BootBlockId id, string name, const std::filesystem::path & path = {})

Defined in VAmiga.h:1235

Inserts a new disk.

Parameters ​

ParameterTypeDescription
fstyperetro::vault::amiga::FSFormatFile system format
idretro::vault::amiga::BootBlockIdBoot block identifier
namestringName of the disk
pathconst std::filesystem::path &Optional folder to import

Exceptions ​

ExceptionDescription
Errorif the file cannot be read or does not contain valid data.

insertBlankDiskAsync ​

cpp
void insertBlankDiskAsync(retro::vault::amiga::FSFormat fstype, retro::vault::amiga::BootBlockId id, string name, const std::filesystem::path & path = {})

Defined in VAmiga.h:1242

Asynchronous version of insertBlankDisk(): queues the request and returns at once.

Success and failure are both reported by the usual message (DISK_INSERT). If the request failed, the message carries the exception.


insert ​

cpp
void insert(const std::filesystem::path & path, bool wp)

Defined in VAmiga.h:1251

Inserts a disk created from an image file.

Parameters ​

ParameterTypeDescription
pathconst std::filesystem::path &Path to the disk image.
wpboolWrite-protection status of the disk.

Exceptions ​

ExceptionDescription
Errorif the file cannot be read or does not contain valid data.

insert ​

cpp
void insert(std::span< const u8 > buffer, retro::vault::ImageFormat fmt, bool wp)

Defined in VAmiga.h:1267

Inserts a disk created from an image stored in memory.

Parameters ​

ParameterTypeDescription
bufferstd::span< const u8 >Buffer holding the raw image data.
fmtretro::vault::ImageFormatFormat of the supplied image data.
wpboolWrite-protection status of the disk.

Exceptions ​

ExceptionDescription
Errorif the data is not valid.

insertAsync ​

cpp
void insertAsync(const std::filesystem::path & path, bool wp)

Defined in VAmiga.h:1258

Asynchronous version of insert(): queues the request and returns at once.

The file is read on the emulator thread. Success and failure are both reported by the usual message (e.g., CRT_ATTACHED). If the request failed, the message carries the exception.


ejectDisk ​

cpp
void ejectDisk()

Defined in VAmiga.h:1271

Ejects the current disk.


writeToFile ​

cpp
void writeToFile(const std::filesystem::path & path)

Defined in VAmiga.h:1276

Exports the current disk to a file.

Parameters ​

ParameterTypeDescription
pathconst std::filesystem::path &Path to the destination file.

path ​

const

cpp
std::filesystem::path path() const

Defined in VAmiga.h:1281

Returns the file the disk lives in.

NOTE

Always empty, since floppy disks always live in memory.


needsPersisting ​

const

cpp
bool needsPersisting() const

Defined in VAmiga.h:1289

Indicates whether the disk holds changes its file does not have yet.

NOTE

Always false for a floppy disk, which has no file. Whether the disk has been modified since it was inserted is reported by FloppyDriveInfo::hasModifiedDisk.


persist ​

cpp
void persist()

Defined in VAmiga.h:1294

Writes all changes back to the file the disk lives in.

NOTE

Does nothing for a floppy disk, which has no file.


readTrackBits ​

cpp
string readTrackBits(isize track)

Defined in VAmiga.h:1298

Creates a textual bit representation of a track's data.