Title: | Access and Manipulate Amiga Disk Files |
Version: | 2.0.3 |
Maintainer: | Pepijn de Vries <pepijn.devries@outlook.com> |
Description: | Amiga Disk Files (ADF) are virtual representations of 3.5 inch floppy disks for the Commodore Amiga. Most disk drives from other systems (including modern drives) are not able to read these disks. The 'adfExplorer' package enables you to establish R connections to files on such virtual DOS-formatted disks, which can be use to read from and write to those files. |
License: | GPL (≥ 3) |
Encoding: | UTF-8 |
RoxygenNote: | 7.2.3 |
LinkingTo: | cpp11 |
Collate: | 'adfExplorer-package.R' 'blocks.R' 'compress.R' 'cpp11.R' 'connect_adf.R' 'demo.R' 'deprecated.R' 'move.R' 'device_info.R' 'device_create.R' 'helpers.R' 'directory.R' 'entry_info.R' 'remove.R' 's3_conn.R' 's3_methods.R' 'virtual_path.R' |
Depends: | R (≥ 3.5.0) |
Imports: | methods, vctrs |
Suggests: | adfExplorer, knitr, rmarkdown, testthat (≥ 3.0.0) |
VignetteBuilder: | knitr |
URL: | https://pepijn-devries.github.io/adfExplorer/ |
BugReports: | https://github.com/pepijn-devries/adfExplorer/issues |
Config/testthat/edition: | 3 |
NeedsCompilation: | yes |
Packaged: | 2025-01-07 22:01:35 UTC; vries171 |
Author: | Pepijn de Vries |
Repository: | CRAN |
Date/Publication: | 2025-01-10 22:50:02 UTC |
adfExplorer: Access and Manipulate Amiga Disk Files
Description
Amiga Disk Files (ADF) are virtual representations of 3.5 inch floppy disks for the Commodore Amiga. Most disk drives from other systems (including modern drives) are not able to read these disks. The 'adfExplorer' package enables you to establish R connections to files on such virtual DOS-formatted disks, which can be use to read from and write to those files.
Author(s)
Maintainer: Pepijn de Vries pepijn.devries@outlook.com (ORCID)
Authors:
Laurent Clévy (Creator of the original ADFlib library) [copyright holder]
See Also
Useful links:
Report bugs at https://github.com/pepijn-devries/adfExplorer/issues
Changing and creating directories on a virtual device
Description
adf_directory()
shows the current directory of a virtual device, when a file
system is present. When connecting to or creating a new device, the current
directory is the disk's root by default. To change the current directory,
use adf_directory()
in combination with the assign operator (<-
).
Usage
adf_directory(dev, ...)
## S3 method for class 'adf_device'
adf_directory(dev, ...)
adf_directory(dev, ...) <- value
## S3 replacement method for class 'adf_device'
adf_directory(dev, ...) <- value
## S3 replacement method for class 'adf_device.character'
adf_directory(dev, ...) <- value
## S3 replacement method for class 'adf_device.virtual_path'
adf_directory(dev, ...) <- value
make_adf_dir(x, path, ...)
## S3 method for class 'adf_device'
make_adf_dir(x, path, ...)
## S3 method for class 'virtual_path'
make_adf_dir(x, path, ...)
## S3 method for class 'character'
make_adf_dir.adf_device(x, path, ...)
## S3 method for class 'virtual_path'
make_adf_dir.adf_device(x, path, ...)
Arguments
dev |
The virtual adf device for which information needs to be obtained.
It should be of class |
... |
Ignored |
value |
A |
x |
An |
path |
A |
Details
To create a new directory on a device use make_adf_dir()
and use a full or
relative path name to specify the new directory name.
See vignette("virtual_paths")
for a note on file and directory names on the Amiga.
Value
make_adf_dir()
returns the device connection. adf_directory()
returns
the current directory as a virtual_path
class object.
Author(s)
Pepijn de Vries
Examples
## Open virtual device to demonstrate methods
my_device <- demo_adf(write_protected = FALSE)
## Show the current directory
adf_directory(my_device)
## Create a new directory
make_adf_dir(my_device, "DF0:s/newdir")
## Change the current dir to the new directory:
adf_directory(my_device) <- "DF0:s/newdir"
## Close the virtual device
close(my_device)
Retrieve information from entry headers on virtual ADF devices
Description
Retrieve information from entry (file and directory) headers on virtual ADF devices. Get information like entry name, modification date, file size etc.
Usage
adf_entry_info(x, path, ...)
## S3 method for class 'adf_device'
adf_entry_info(x, path, ...)
## S3 method for class 'virtual_path'
adf_entry_info.adf_device(x, path, ...)
## S3 method for class 'character'
adf_entry_info.adf_device(x, path, ...)
## S3 method for class 'virtual_path'
adf_entry_info(x, path, ...)
## S3 method for class 'adf_file_con'
adf_entry_info(x, path, ...)
Arguments
x |
Either a virtual device or virtual path. |
path |
A |
... |
Ignored |
Value
Returns a list
of named list
s of entry properties.
Elements included in the named list
depend on the type of entry (root, directory or file).
Author(s)
Pepijn de Vries
Examples
## First setup a connection to a virtual device
my_device <- demo_adf()
adf_entry_info(my_device, "DF0:")
adf_entry_info(my_device, "s")
adf_entry_info(my_device, "s/startup-sequence")
close(my_device)
Obtain or modify an entry name on a virtual device
Description
Get the name of an entry (root, file or directory) or update it with the
assign operator (<-
).
Usage
adf_entry_name(x, path, ...) <- value
adf_entry_name(x, path, ...)
## S3 replacement method for class 'adf_file_con'
adf_entry_name(x, path, ...) <- value
## S3 replacement method for class 'adf_device'
adf_entry_name(x, path, ...) <- value
## S3 replacement method for class 'virtual_path'
adf_entry_name(x, path, ...) <- value
## S3 replacement method for class 'adf_device.character'
adf_entry_name(x, path, ...) <- value
## S3 replacement method for class 'adf_device.virtual_path'
adf_entry_name(x, path, ...) <- value
Arguments
x |
Either a virtual device or virtual path. |
path |
A |
... |
Ignored |
value |
New name for the entry. The name will be sanitised and truncated before it is assigned to the entry. |
Value
Returns the entry name of the requested path or in case of an assign
operation (<-
) an updated version of x
.
Author(s)
Pepijn de Vries
Examples
## Open virtual device to demonstrate methods
my_device <- demo_adf(write_protected = FALSE)
## rename a specific entry
adf_entry_name(my_device, "DF0:mods/mod.intro") <- "mod.music"
## rename disk (also possible with `volume_name<-()`)
adf_entry_name(my_device, "DF0:") <- "my_disk"
close(my_device)
Open a connection to a file on a virtual ADF device
Description
Open a connection to a file on a virtual ADF device. The created connection (if valid)
should be accepted by any R function that reads from or writes to a connection,
such as readLines()
, writeLines()
, readBin()
, writeBin()
, etc.
Usage
adf_file_con(x, ..., writable = FALSE)
## S3 method for class 'adf_device'
adf_file_con(x, path, ..., writable = FALSE)
## S3 method for class 'character'
adf_file_con.adf_device(x, path, ..., writable = FALSE)
## S3 method for class 'virtual_path'
adf_file_con(x, ..., writable = FALSE)
Arguments
x |
Either a connection to a virtual ADF device created with |
... |
Ignored. |
writable |
A |
path |
Only required when |
Value
Returns an R connection that can be handled by any function that
accepts a connection for reading or writing. Remember to call close()
after
use.
Author(s)
Pepijn de Vries
Examples
## First setup a connection to a virtual device
adz_file <- system.file("example.adz", package = "adfExplorer")
my_device <- connect_adf(adz_file)
## Open a connection to a file on the virtual device
fcon <- adf_file_con(my_device, "DF0:s/startup-sequence")
## Read from the file
my_startup <- readLines(fcon, warn = FALSE)
## Close the file
close(fcon)
## Close the virtual device
close(my_device)
Test if an entry exists on a virtual device
Description
Test if an entry (file or directory) exists on a virtual ADF device.
adf_file_exists()
is the equivalent of file.exists()
on a virtual ADF device.
adf_dir_exists()
is the equivalent of dir.exists()
on a virtual ADF device.
Usage
adf_file_exists(x, path, ...)
## S3 method for class 'adf_device'
adf_file_exists(x, path, ...)
## S3 method for class 'virtual_path'
adf_file_exists(x, path, ...)
adf_dir_exists(x, path, ...)
## S3 method for class 'adf_device'
adf_dir_exists(x, path, ...)
## S3 method for class 'virtual_path'
adf_dir_exists(x, path, ...)
Arguments
x |
Either a virtual device or virtual path. |
path |
A |
... |
Ignored |
Value
adf_file_exists()
returns TRUE
if the path exists on the virtual device, FALSE
otherwise.
adf_dir_exists()
returns TRUE
when the path exists and is a directory, FALSE
otherwise.
Author(s)
Pepijn de Vries
Examples
## First setup a connection to a virtual device
my_device <- demo_adf()
adf_file_exists(my_device, "s/startup-sequence")
adf_dir_exists(my_device, "s/startup-sequence")
close(my_device)
Deprecated functions
Description
Functions documented here are deprecated and will be removed in future
versions of the package. Please use the new functions as indicated instead
or revert to old releases when no alternative is available. See also
vignette("version2")
for more information.
Usage
amigaDateToRaw(...)
amigaIntToRaw(...)
bitmapToRaw(...)
displayRawData(...)
rawToAmigaDate(...)
rawToAmigaInt(...)
rawToBitmap(...)
adf.disk.name(...) <- value
adf.file.mode(...) <- value
adf.file.time(...) <- value
amigaBlock(...) <- value
current.adf.dir(...) <- value
adf.disk.name(...)
adf.file.exists(...)
adf.file.info(...)
adf.file.mode(...)
adf.file.remove(...)
adf.file.size(...)
adf.file.time(...)
amigaBlock(...)
blank.amigaDOSDisk(...)
current.adf.dir(...)
dir.create.adf(...)
dir.exists.adf(...)
get.blockID(...)
get.diskLocation(...)
is.amigaDOS(...)
is.bootable(...)
list.adf.files(...)
put.adf.file(...)
read.adf(...)
read.adz(...)
write.adf(...)
write.adz(...)
Arguments
... |
Ignored. |
value |
Ignored. |
Value
NULL
Close all virtual devices
Description
Close all virtual devices that are currently open. This function is useful when you have multiple devices opened at the same time.
Usage
close_all_devices()
Value
Returns NULL
invisibly.
Compress ADF to ADZ files and vice versa
Description
The ADZ format is essentially a compressed (gzip) version of the
Amiga Disk File (ADF) format. The adfExplorer
allows you to connect
to both formats. However, you can only open a 'read-only' connection
to ADZ files. Use the compression and decompression functions documented
here to move back and forth from and to ADF and ADZ formats.
Usage
compress_adf(source, destination)
decompress_adz(source, destination)
Arguments
source |
Path to the source file to read. |
destination |
Path to the destination file to write. |
Value
Returns NULL
invisibly.
Author(s)
Pepijn de Vries
Examples
adz_file <- system.file("example.adz", package = "adfExplorer")
adf_file <- tempfile(fileext = ".adf")
adz_file2 <- tempfile(fileext = ".adz")
decompress_adz(adz_file, adf_file)
compress_adf(adf_file, adz_file2)
Create a connection to a virtual disk
Description
Establish a connection to a virtual disk stored as Amiga Disk Files (ADF).
You cannot write or read directly from this connection. Instead, use the
methods provided in this package to retrieve information about the virtual
disk or create connections to the files on the disk, to which you can
write and read from (see adf_file_con()
). Like any other connection,
please use close()
to close the connection after use.
Usage
connect_adf(filename, write_protected = TRUE)
Arguments
filename |
Filename of the |
write_protected |
A |
Value
Returns an R connection of class adf_device
.
Author(s)
Pepijn de Vries
Examples
adz_file <- system.file("example.adz", package = "adfExplorer")
my_device <- connect_adf(adz_file)
device_capacity(my_device)
close(my_device)
Copy or move files between physical and virtual devices
Description
With these functions you can copy or move entries (files and directories) between
a physical and virtual ADF device. With copy_adf_entry()
the files are duplicated,
with move_adf_entry()
the files are moved (and deleted from its source).
Usage
copy_adf_entry(source, destination, ...)
## S3 method for class 'character'
copy_adf_entry(source, destination, ...)
## S3 method for class 'virtual_path'
copy_adf_entry(source, destination, ...)
## S3 method for class 'virtual_path'
copy_adf_entry.character(source, destination, ...)
## S3 method for class 'virtual_path'
copy_adf_entry.virtual_path(source, destination, ...)
## S3 method for class 'character'
copy_adf_entry.virtual_path(source, destination, ...)
move_adf_entry(source, destination, ...)
## S3 method for class 'character'
move_adf_entry(source, destination, ...)
## S3 method for class 'virtual_path'
move_adf_entry(source, destination, ...)
## S3 method for class 'virtual_path'
move_adf_entry.character(source, destination, ...)
## S3 method for class 'virtual_path'
move_adf_entry.virtual_path(source, destination, ...)
## S3 method for class 'character'
move_adf_entry.virtual_path(source, destination, ...)
Arguments
source , destination |
The |
... |
Ignored |
Author(s)
Pepijn de Vries
Examples
## Create an Amiga Disk File
## and prepare a file system on the virtual device
my_device <-
create_adf_device(
tempfile(fileext = ".adf"),
write_protected = FALSE) |>
prepare_adf_device()
## Copy the packaged R scripts of this package to the virtual device
copy_adf_entry(
system.file("R", package = "adfExplorer"),
virtual_path(my_device, "DF0:")
)
## List all entries on the virtual device
list_adf_entries(my_device, recursive = TRUE)
## Move the entire virtual device content to
## the tempdir on your physical device
dest <- file.path(tempdir(), "DF0")
dir.create(dest)
move_adf_entry(
virtual_path(my_device, "DF0:"),
dest
)
## cleanup the temp directory
unlink(dest, recursive = TRUE)
close(my_device)
Create and format a virtual ADF device
Description
These functions help you to create an empty virtual device that can be used
in Commodore Amiga emulation. create_adf_device()
simply creates a file
of the proper size (the file size represents the device capacity) and fills it
with raw
zeros. In order to use the device in the Amiga operating system, a
file system needs to be installed on the device. This can be achieved with
prepare_adf_device()
. Note that the file system itself will also consume
disk space on the virtual device.
Usage
create_adf_device(destination, type = "DD", ..., connect = TRUE)
prepare_adf_device(
dev,
name = "EMPTY",
ffs = TRUE,
international = TRUE,
dircache = FALSE,
bootable = TRUE,
...
)
## S3 method for class 'adf_device'
prepare_adf_device(
dev,
name = "EMPTY",
ffs = TRUE,
international = TRUE,
dircache = FALSE,
bootable = TRUE,
...
)
Arguments
destination |
File path where the virtual device needs to be stored. |
type |
Specify the type of virtual device you wish to create.
Should be one of |
... |
Ignored for |
connect |
A |
dev |
The virtual adf device for which information needs to be obtained.
It should be of class |
name |
A |
ffs |
A |
international |
A |
dircache |
A |
bootable |
A If set to |
Value
Either an adf_device
connection or NULL
depending on the value of
connect
.
Author(s)
Pepijn de Vries
Examples
## Filepath to store the virtual device:
dest <- tempfile(fileext = ".adf")
## Create a blank unformated virtual device (a double density floppy disk):
my_device <- create_adf_device(dest, "DD", connect = TRUE, write_protected = FALSE)
print(my_device)
## Format the floppy and create a file system on the device:
prepare_adf_device(my_device, name = "foobar")
print(my_device)
## don't forget to close the device connection after use:
close(my_device)
Connect with a demonstration ADF file
Description
Opens a connection to a virtual device for demonstration purposes It is used in examples.
Usage
demo_adf(write_protected = TRUE)
Arguments
write_protected |
A |
Value
Returns a connection to a virtual device of class adf_device
Obtain information about an adf_device
connection
Description
A collection of functions to retrieve information about the virtual device, or any volume (file system) available on the device. See examples for usage and results.
Usage
device_type(dev, ...)
## S3 method for class 'adf_device'
device_type(dev, ...)
device_capacity(dev, ...)
## S3 method for class 'adf_device'
device_capacity(dev, ...)
volume_capacity(dev, ...)
## S3 method for class 'adf_device'
volume_capacity(dev, vol = 0L, ...)
volume_name(dev, ...)
volume_name(dev, ...) <- value
## S3 method for class 'adf_device'
volume_name(dev, vol = 0L, ...)
## S3 replacement method for class 'adf_device'
volume_name(dev, vol = 0L, ...) <- value
n_volumes(dev, ...)
## S3 method for class 'adf_device'
n_volumes(dev, ...)
bytes_free(dev, ...)
## S3 method for class 'adf_device'
bytes_free(dev, vol = 0L, ...)
is_bootable(dev, ...)
## S3 method for class 'adf_device'
is_bootable(dev, vol = 0L, ...)
is_fast_file_system(dev, ...)
## S3 method for class 'adf_device'
is_fast_file_system(dev, vol = 0L, ...)
is_international(dev, ...)
## S3 method for class 'adf_device'
is_international(dev, vol = 0L, ...)
is_dircache(dev, ...)
## S3 method for class 'adf_device'
is_dircache(dev, vol = 0L, ...)
is_write_protected(dev, ...)
## S3 method for class 'adf_device'
is_write_protected(dev, ...)
Arguments
dev |
The virtual adf device for which information needs to be obtained.
It should be of class |
... |
Ignored |
vol |
Volume index number on the device starting at |
value |
Replacement value. In case of |
Value
Returns the requested information, or an updated copy of dev
in case
of an assign operation (<-
).
Author(s)
Pepijn de Vries
Examples
## Open virtual device to demonstrate methods
my_device <- demo_adf(write_protected = FALSE)
device_type(my_device)
device_capacity(my_device) # in bytes
volume_capacity(my_device) # in bytes
n_volumes(my_device) # number of volumes available on device
volume_name(my_device) # name of the volume
volume_name(my_device) <- "new_name" # rename the volume
bytes_free(my_device) # bytes available for writing
is_bootable(my_device) # tests if device is potentially bootable
is_fast_file_system(my_device) # tests if volume uses FFS
is_international(my_device) # tests if file system uses intl mode
is_dircache(my_device) # tests if file system uses dir caching
is_write_protected(my_device) # tests if device is protected against writing
close(my_device)
Basic methods for S3 class objects
Description
Format and print methods for all S3 class objects created with adfExplorer
Usage
## S3 method for class 'adf_device'
format(x, ...)
## S3 method for class 'adf_file_con'
format(x, ...)
## S3 method for class 'adf_block'
format(x, ...)
## S3 method for class 'virtual_path'
format(x, width = 20L, ...)
## S3 method for class 'adf_device'
print(x, ...)
## S3 method for class 'adf_file_con'
print(x, ...)
## S3 method for class 'adf_block'
print(x, ...)
## S3 method for class 'virtual_path'
print(x, ...)
## S3 method for class 'virtual_path'
as.character(x, ...)
Arguments
x |
Object to be formatted or printed |
... |
Ignored or passed on to next methods |
width |
Set the text width for formatting virtual paths |
Examples
my_device <- demo_adf()
vp <- list_adf_entries(my_device, recursive = TRUE)
con <- adf_file_con(my_device, "s/startup-sequence")
block <- read_adf_block(my_device, 0L)
format(my_device)
format(vp)
format(con)
format(block)
print(my_device)
print(vp)
print(con)
print(block)
close(con)
close(my_device)
List entries in a directory of a virtual ADF device
Description
Get an overview of all entries (files and directories) in a specific directory.
Usage
list_adf_entries(x, path, recursive = FALSE, nested = FALSE, ...)
## S3 method for class 'adf_device'
list_adf_entries(x, path, recursive = FALSE, nested = FALSE, ...)
## S3 method for class 'virtual_path'
list_adf_entries(x, path, recursive = FALSE, nested = FALSE, ...)
## S3 method for class 'character'
list_adf_entries.adf_device(x, path, recursive = FALSE, nested = FALSE, ...)
## S3 method for class 'virtual_path'
list_adf_entries.adf_device(x, path, recursive = FALSE, ...)
Arguments
x |
Either an |
path |
The virtual path for which you wish to obtain a list
of entries (see also |
recursive |
A |
nested |
A |
... |
Ignored |
Value
A vector of virtual_path
class objects, or a nested list
in
case nested
is TRUE
.
Author(s)
Pepijn de Vries
Examples
## First setup a connection to a virtual device
my_device <- demo_adf()
## List all entries in the disk's root:
list_adf_entries(my_device)
## List all entries on the disk as a vector of `virtual paths`:
list_adf_entries(my_device, recursive = TRUE)
## List all entries on the disk as a nested list:
list_adf_entries(my_device, recursive = TRUE, nested = TRUE)
close(my_device)
Transfer binary data to and from connections
Description
These methods mask the identical functions in the base
package (see base::readBin()
,
base::readLines()
, base::readChar()
, base::writeBin()
, base::writeLines()
and
base::writeChar()
. They behave exactly the
same as their base counterpart, with the exception that they can read and write to connections
opened with adf_file_con()
.
Usage
readBin(
con,
what,
n = 1L,
size = NA_integer_,
signed = TRUE,
endian = .Platform$endian
)
## Default S3 method:
readBin(
con,
what,
n = 1L,
size = NA_integer_,
signed = TRUE,
endian = .Platform$endian
)
## S3 method for class 'adf_file_con'
readBin(
con,
what,
n = 1L,
size = NA_integer_,
signed = TRUE,
endian = .Platform$endian
)
readLines(
con,
n = -1L,
ok = TRUE,
warn = TRUE,
encoding = "unknown",
skipNul = FALSE
)
## Default S3 method:
readLines(
con = stdin(),
n = -1L,
ok = TRUE,
warn = TRUE,
encoding = "unknown",
skipNul = FALSE
)
## S3 method for class 'adf_file_con'
readLines(
con,
n = -1L,
ok = TRUE,
warn = TRUE,
encoding = "unknown",
skipNul = FALSE
)
writeBin(
object,
con,
size = NA_integer_,
endian = .Platform$endian,
useBytes = FALSE
)
## Default S3 method:
writeBin(
object,
con,
size = NA_integer_,
endian = .Platform$endian,
useBytes = FALSE
)
## S3 method for class 'adf_file_con'
writeBin(
object,
con,
size = NA_integer_,
endian = .Platform$endian,
useBytes = FALSE
)
writeLines(text, con, sep = "\n", useBytes = FALSE)
## Default S3 method:
writeLines(text, con = stdout(), sep = "\n", useBytes = FALSE)
## S3 method for class 'adf_file_con'
writeLines(text, con = stdout(), sep = "\n", useBytes = FALSE)
Arguments
con |
A connection to a file on a virtual ADF device. Such a connection can
be established with |
what |
Either an object whose mode will give the mode of the
vector to be read, or a character vector of length one describing
the mode: one of |
n |
numeric. The (maximal) number of records to be
read. You can use an over-estimate here, but not too large as
storage is reserved for |
size |
integer. The number of bytes per element in the byte
stream. The default, |
signed |
logical. Only used for integers of sizes 1 and 2, when it determines if the quantity on file should be regarded as a signed or unsigned integer. |
endian |
The endian-ness ( |
ok |
logical. Is it OK to reach the end of the connection before
|
warn |
logical. Warn if a text file is missing a final EOL or if there are embedded nuls in the file. |
encoding |
encoding to be assumed for input strings. It is
used to mark character strings as known to be in
Latin-1, UTF-8 or to be bytes: it is not used to re-encode the input.
To do the
latter, specify the encoding as part of the connection |
skipNul |
logical: should nuls be skipped? |
object |
An R object to be written to the connection. |
useBytes |
See |
text |
A character vector |
sep |
character string. A string to be written to the connection after each line of text. |
Value
Returns NULL
invisibly
Read or write raw data blocks to a virtual device
Description
The Amiga file system is structured around 512 byte blocks. A double density
floppy disk consists of 1760 blocks of 512 bytes. read_adf_block
and write_adf_block
can be used to transform raw data from and to virtual devices (created with
create_adf_device()
or connect_adf()
). Note that writing raw data to
a disk could corrupt the file system on the device. So it is generally not
advised unless you know what you are doing.
Usage
read_adf_block(dev, sector, ...)
## S3 method for class 'adf_device'
read_adf_block(dev, sector, ...)
write_adf_block(dev, sector, data, ...)
## S3 method for class 'adf_device'
write_adf_block(dev, sector, data, ...)
## S3 method for class 'raw'
write_adf_block.adf_device(dev, sector, data, ...)
## S3 method for class 'adf_block'
write_adf_block.adf_device(dev, sector, data, ...)
## Default S3 method:
write_adf_block.adf_device(dev, sector, data, ...)
as_adf_block(data, ...)
new_adf_block()
Arguments
dev |
The virtual adf device for which information needs to be obtained.
It should be of class |
sector |
Sector ID of the block you wish to read/write. It is an integer value. For double density disks, the ID ranges from 0 to 1759. |
... |
Ignored |
data |
Block data ( |
Value
In case of write_adf_block
NULL
is returned invisibly. In case of read_adf_block
the raw
data is returned as a adf_block
class object.
Author(s)
Pepijn de Vries
Examples
my_device <- demo_adf(write_protected = FALSE)
info <- adf_entry_info(my_device, "S/startup-sequence")
filedata_block <- read_adf_block(my_device, rev(info[[1]]$dataBlocks)[[1]])
filedata_block
empty_block <- new_adf_block()
empty_block <- as_adf_block(raw(512L))
## Write some random data to block 5 on the device
## Note that this could break the file system on the virtual device!
write_adf_block(my_device, 5, as.raw(runif(512, 0, 255)))
## converting the data to an adf block object first
## is optional:
write_adf_block(my_device, 6, as_adf_block(as.raw(runif(512, 0, 255))))
close(my_device)
Remove entry (file / directory) from a virtual ADF device
Description
This function removes an entry (file or directory) from a virtual ADF device. At the moment this function only removes a single entry per call, and in case the entry is a directory, the directory needs to be empty before it can be removed.
Usage
remove_adf_entry(x, path, flush = FALSE, ...)
## S3 method for class 'adf_device'
remove_adf_entry(x, path, flush = FALSE, ...)
## S3 method for class 'virtual_path'
remove_adf_entry(x, path, flush = FALSE, ...)
## S3 method for class 'character'
remove_adf_entry.adf_device(x, path, flush = FALSE, ...)
## S3 method for class 'virtual_path'
remove_adf_entry.adf_device(x, path, flush = FALSE, ...)
Arguments
x |
The virtual ADF device from which an entry needs to be deleted or a virtual path pointing
at the entry to be deleted. In case of a virtual device, it should be of class |
path |
A |
flush |
A |
... |
Ignored |
Value
Returns the device connection
Author(s)
Pepijn de Vries
Examples
# Open a connection to a virtual device:
my_device <- demo_adf(write_protected = FALSE)
## List files in directory 'Devs':
list_adf_entries(my_device, "Devs")
## remove the file 'system-configuration' from the virtual device
remove_adf_entry(my_device, "devs/system-configuration")
## List files in directory 'Devs' again:
list_adf_entries(my_device, "Devs")
## close the connection to the virtual device
close(my_device)
A path pointing to a file or directory on a virtual ADF device
Description
This function creates a path pointing to a file or directory
on a virtual ADF device (created with connect_adf()
or create_adf_device()
).
The virtual path created with this function can be used to establish a readable
or writable connection to a file, or obtain information about a file or directory.
See also vignette("virtual_paths")
Usage
virtual_path(dev, path)
Arguments
dev |
A virtual ADF device (created with |
path |
A |
Value
Returns a virtual_path
class object.
Author(s)
Pepijn de Vries
Examples
# Open a connection to a virtual device:
my_device <- demo_adf()
# specify a virtual path:
my_path <- virtual_path(my_device, "DF0:s/startup-sequence")
# close the virtual device:
close(my_device)