Learn R Programming

AmigaFFH

The Amiga File Format Handler package (AmigaFFH) is designed to interpret file formats that were native to Commodore Amiga machines. In combination with the adfExplorer package this package can be used to interpret older file formats that were native to the Commodore Amiga. The focus of this package will be on the older system (Amiga OS <= 3.0). This will allow you to analyse and interpret these files in the scripted environment of R.

In the sections below there are some prominent examples of supported file formats. For a more detailed overview, please consult the package documentation (?AmigaFFH)

Installation

Get CRAN version

install.packages("ProTrackR")

Get development version from R-Universe

install.packages("ProTrackR", repos = c('https://pepijn-devries.r-universe.dev', 'https://cloud.r-project.org'))

Usage

Below there are some ultra-short demostrations of a selection of supported Amiga file types

IFF

The Interchange File Format (IFF) is and was a file container that could hold any kind of data. Below is an example of a bitmap image stored as such a file.

library(AmigaFFH)
#> Loading required package: tuneR

example.iff <-
  system.file("ilbm8lores.iff", package = "AmigaFFH") |>
  read.iff()

par(bg = "black")
plot(example.iff, interpolate = FALSE)

AmigaBasic

AmigaBasic is a simple interpreted programming language for the early Commodore Amiga’s. Its code was stored in a binary format to save disk and memory space. Below an example of how to read such a file.

system.file("demo.bas", package = "AmigaFFH") |>
  read.AmigaBasic()
#> OPEN "ball.shp" FOR INPUT AS 1
#> OBJECT.SHAPE 1,INPUT$(LOF(1),1)
#> CLOSE 1
#> OBJECT.X 1,320
#> OBJECT.Y 1,127
#> OBJECT.ON 1
#> OBJECT.START
#> LET t=0
#> PRINT "Press any key to continue..."
#> WHILE INKEY$ =""
#>   OBJECT.X 1, 320+200*SIN(t)
#>   OBJECT.Y 1, 127+100*COS(t)
#>   t=t+.001
#> WEND
#> SCREEN 1,320,256,3,1
#> WINDOW 1,"Bob Window",(0,0)-(297,242),31,1
#> PALETTE 0,1,1,1
#> PALETTE 1,.1333333,.4,.7333333
#> PALETTE 2,.2,.4,.7333333
#> PALETTE 3,.2666667,.4666667,.6666667
#> PALETTE 4,.4666667,.5333333,.6
#> PALETTE 5,.6,.6,.6
#> PALETTE 6,.6666667,.6666667,.6666667
#> PALETTE 7,.7333333,.7333333,.7333333
#> FOR i% = 0 TO 7
#>   COLOR i%
#>   AREA (i%*10, 30)
#>   AREA STEP (10, 0)
#>   AREA STEP (0, 10)
#>   AREA STEP (-10,0)
#>   AREAFILL
#> NEXT i%
#> OPEN "r_logo.shp" FOR INPUT AS 1
#> OBJECT.SHAPE 2,INPUT$(LOF(1),1)
#> CLOSE 1
#> OBJECT.X 2,160
#> OBJECT.Y 2,127
#> OBJECT.ON 2
#> PRINT "Press any key to stop..."
#> WHILE INKEY$=""
#>   OBJECT.X 2, 160+100*SIN(t*.3)
#>   OBJECT.Y 2, 127+50*COS(t)
#>   t=t+.01
#> WEND
#> SCREEN CLOSE 1
#> END

Amiga File Icons

On the Amiga, file icons were stored as separate files. Below an example of how to create such a file.

icon <- simpleAmigaIcon()
plot(icon, interpolate = FALSE)

Amiga Fonts

The Commodore Amiga used bitmap fonts to display texts. The package comes with an example object that can be stored as an Amiga Font file.

data(font_example)

plot(font_example, interpolate = FALSE)

System configuration

The systemconfiguration file was used to store some system preferences (screen resolution, font, default printer, etc.). It was loaded during the boot process. The exaple below shows how to create such a file.

simpleSysConfig()
#> Amiga system-configuration
#> FontHeight:  8
#> Printer: parallel generic
#> Interlaced:  FALSE

Developmental status

It has been years since the initial release of this package. Since it’s release a lot has changed in R and in my skill set. I still have plans for this package, but this requires drastic changes. Therefore, I will only apply minimal maintenance to this package. Meanwhile I will work on a complete overhaul which will be released in due time as a new package. This new package will:

  • have the same or similar features as the current package.
  • implement rendering procedures in C++ giving the package a speed boost.

But until then, please enjoy the current package as is.

Copy Link

Version

Install

install.packages('AmigaFFH')

Monthly Downloads

354

Version

0.4.7

License

GPL-3

Issues

Pull Requests

Stars

Forks

Maintainer

Pepijn de Vries

Last Published

January 8th, 2025

Functions in AmigaFFH (0.4.7)

amiga_palettes

Commonly used palettes on the Commodore Amiga
amiga_monitors

A list of Amiga monitors
AmigaBasicBMAP

The S3 AmigaBasicBMAP class
AmigaBasicShape

The S3 AmigaBasicShape class
as.AmigaBasic

Coerce raw or character data to an AmigaBasic class object
as.AmigaBasicBMAP

Coerce raw or named list to an AmigaBasicBMAP class object
IFFChunk-class

A class structure to represent IFF files
SysConfig

The S3 SysConfig class
amiga_display_keys

A list of special display modes
as.character

Coerce an AmigaBasic class object to its character representation
IFFChunk-method

Coerce to and create IFFChunk objects
as.raw.AmigaBasic

Convert AmigaFFH objects into raw data
check.names.AmigaBasic

Check Amiga Basic label/variable names for validity
WaveToIFF

Convert WaveMC objects into an Interchange File Format object
colourToAmigaRaw

Convert colours to Amiga compatible raw data or vice versa
availableFontSizes

Get available font sizes from an AmigaBitmapFontSet
bitmapToRaster

Convert an Amiga bitmap image into a raster
as.raster.AmigaBasicShape

Convert AmigaFFH objects into grDevices raster images
amiga_display_modes

A table of display modes on the Amiga and corresponding raw codes
names.AmigaBasic

Extract or replace variable and label names from Amiga Basic scripts
fontName

Extract or replace a font name
c

Combine multiple AmigaFFH objects
packBitmap

A routine to (un)pack bitmap data
hardwareSprite-class

The hardwareSprite class
deltaFibonacciCompress

(De)compress 8-bit continuous signals.
font_example

An example object for the AmigaBitmapFontSet class
getAmigaBitmapFont

Extract a specific AmigaBitmapFont from a AmigaBitmapFontSet
ilbm8lores.iff

An example file of a bitmap image stored in the Interchange File Format
dither

Image dithering
index.colours

Quantisation of colours and indexing a grDevices raster image
getIFFChunk

Get a specific IFFChunk nested inside other IFFChunks
interpretIFFChunk

Interpret an IFFChunk object
rasterToBitmap

Convert a grDevices raster object into binary bitmap data
rawToIFFChunk

Coerce raw data to an IFFChunk class object
rasterToAmigaBasicShape

Convert a grDevices raster object into an AmigaBasicShape class object.
rasterToAmigaBitmapFont

Convert a raster image into an AmigaBitmapFont
rasterToHWSprite

Convert a raster object into an hardwareSprite object
read.AmigaBitmapFont

Read an AmigaBitmapFont class object from a file
write.AmigaBitmapFont

Write an AmigaBitmapFont(set) file
write.AmigaIcon

Write an Amiga Workbench icon (info) file
rawToSysConfig

Coerce raw data into a SysConfig class object
rawToAmigaBasicBMAP

Coerce raw data into an AmigaBasicBMAP class object
rasterToIFF

Convert a grDevices raster image into an IFF formated bitmap image
read.AmigaBitmapFontSet

Read AmigaBitmapFontSet from *.font file
read.AmigaIcon

Read an Amiga Workbench icon (info) file
read.iff

Read Interchange File Format (IFF)
rawToAmigaBasic

Coerce raw data into an AmigaBasic class object
read.SysConfig

Read an Amiga system-configuration file
rawToAmigaBasicShape

Coerce raw data into an AmigaBasicShape class object
simpleAmigaIcon

Create simple AmigaIcon objects
rawToAmigaBitmapFontSet

Coerce raw data into an AmigaBitmapFontSet class object
write.SysConfig

Write an Amiga system-configuration file
rawToAmigaBitmapFont

Coerce raw data into an AmigaBitmapFont class object
rawToAmigaIcon

Coerce raw data into an AmigaIcon class object
write.AmigaBasic

Write an AmigaBasic object to a file
rawToHWSprite

Convert raw data into an Amiga hardware sprite
write.iff

Write Interchange File Format (IFF)
play

Playing Amiga audio data
plot.AmigaBasicShape

Plot AmigaFFH objects
read.AmigaBasic

Read Amiga Basic files
write.AmigaBasicShape

Write an AmigaBasicShape object to a file
read.AmigaBasicShape

Read Amiga Basic Shape files
timeval

Get an Amiga timeval struct value from raw data
simpleSysConfig

Function to generate a simple Amiga system-configuration representation
read.AmigaBasicBMAP

Read and write Amiga Basic BMAP files
AmigaBasic-files

'demo.bas', 'r_logo.shp' and 'ball.shp' as example files for AmigaBasic and AmigaBasicShape objects
AmigaIcon

The S3 AmigaIcon class
[.AmigaBasic

Extract or replace lines of Amiga Basic code
AmigaBitmapFont

The S3 AmigaBitmapFont and AmigaBitmapFontSet classes
AmigaFFH-package

The Amiga File Format Handler package
AmigaBasic.reserved

List Amiga Basic reserved words.
AmigaBasic

The S3 AmigaBasic class