rawToAmigaInt {adfExplorer}R Documentation

Convert raw values into Amiga integers


Convert raw data into 8, 16, or 32-bit signed or unsigned integer values, conform Amiga specifications.


rawToAmigaInt(x, bits = 8, signed = F)



A vector of class raw to be converted into a character.


Number of bits that represents the integer value. Should be 8 or a positive multitude of 8.


A logical value indicating whether the integer should be signed (TRUE, default) or not (FALSE).


The Commodore Amiga has specified the following data formats to represent integer data: BYTE (signed 8-bit integer), UBYTE (unsigned 8-bit integer), WORD (signed 16-bit integer), UWORD (unsigned 16-bit integer), LONG (signed 32-bit integer), ULONG, (unsigned 32-bit integer). This function converts raw data into such integers. Note that WORD and UWORD are also referred to as SHORT and USHORT respectively.


A numeric value (or a vector of values), representing the integer data represented by the provided raw data. Note that R defines integer as 32-bit signed integers and cannot store the 32-bit signed values. Therefore a numeric value is returned rather than an explicit integer.


Pepijn de Vries

See Also

Other raw.operations: amigaDateToRaw(), amigaIntToRaw(), displayRawData(), rawToAmigaDate(), rawToBitmap()


## Let's start by obtaining unsigned 8-bit integers:

## note that this is the same as:

## but with this function we can also get signed values:
rawToAmigaInt(as.raw(0:255), signed = TRUE)

## Furthermore 32 or 16-bit integers can also be obtained.
## Let's look at 16-bit integers:
rawToAmigaInt(as.raw(0:255), 16)

## Note that 16-bit integers require twice as many bytes
## as 8 bit integers:
length(rawToAmigaInt(as.raw(0:255), 16))
length(rawToAmigaInt(as.raw(0:255), 8))

[Package adfExplorer version 0.1.6 Index]