Appearance
FloppyDriveAPI
cpp
#include <VAmiga.h>cpp
class FloppyDriveAPIDefined in VAmiga.h:1189
API of a floppy drive.
Public Methods
| Return | Name | Description |
|---|---|---|
const FloppyDriveConfig & | getConfig const | Returns the component's current configuration. |
const FloppyDriveInfo & | getInfo const | Returns the component's current state. |
const FloppyDriveInfo & | getCachedInfo const | Returns the most recent state snapshot recorded by the emulator thread (see getInfo()). |
bool | getFlag const | Queries a disk flag. |
void | setFlag | Sets or clears one or more disk flags. |
bool | isInsertable const | Checks whether the drive is compatible with disks of a particular geometry. |
void | insertBlankDisk | Inserts a new disk. |
void | insertBlankDiskAsync | Asynchronous version of insertBlankDisk(): queues the request and returns at once. |
void | insert | Inserts a disk created from an image file. |
void | insert | Inserts a disk created from an image stored in memory. |
void | insertAsync | Asynchronous version of insert(): queues the request and returns at once. |
void | ejectDisk | Ejects the current disk. |
void | writeToFile | Exports the current disk to a file. |
std::filesystem::path | path const | Returns the file the disk lives in. |
bool | needsPersisting const | Indicates whether the disk holds changes its file does not have yet. |
void | persist | Writes all changes back to the file the disk lives in. |
string | readTrackBits | Creates a textual bit representation of a track's data. |
getConfig
const
cpp
const FloppyDriveConfig & getConfig() constDefined in VAmiga.h:1199
Returns the component's current configuration.
getInfo
const
cpp
const FloppyDriveInfo & getInfo() constDefined 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() constDefined in VAmiga.h:1212
Returns the most recent state snapshot recorded by the emulator thread (see getInfo()).
getFlag
const
cpp
bool getFlag(DiskFlags mask) constDefined 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) constDefined 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
| Parameter | Type | Description |
|---|---|---|
fstype | retro::vault::amiga::FSFormat | File system format |
id | retro::vault::amiga::BootBlockId | Boot block identifier |
name | string | Name of the disk |
path | const std::filesystem::path & | Optional folder to import |
Exceptions
| Exception | Description |
|---|---|
Error | if 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
| Parameter | Type | Description |
|---|---|---|
path | const std::filesystem::path & | Path to the disk image. |
wp | bool | Write-protection status of the disk. |
Exceptions
| Exception | Description |
|---|---|
Error | if 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
| Parameter | Type | Description |
|---|---|---|
buffer | std::span< const u8 > | Buffer holding the raw image data. |
fmt | retro::vault::ImageFormat | Format of the supplied image data. |
wp | bool | Write-protection status of the disk. |
Exceptions
| Exception | Description |
|---|---|
Error | if 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
| Parameter | Type | Description |
|---|---|---|
path | const std::filesystem::path & | Path to the destination file. |
path
const
cpp
std::filesystem::path path() constDefined 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() constDefined 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.