amigaIntToRaw: Convert Amiga integers into raw values

Description Usage Arguments Details Value Author(s) See Also Examples

Description

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

Usage

1
amigaIntToRaw(x, bits = 8, signed = F)

Arguments

x

A vector of class numeric which needs to be converted into raw values.

bits

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

signed

A logical value indicating whether the numeric values is signed (TRUE, default) or not (FALSE).

Details

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 such integers into raw data.

Value

Returns (a vector of) raw data, representing the integer value(s) conform Amiga specifications.

Author(s)

Pepijn de Vries

See Also

Other raw.operations: amigaDateToRaw, displayRawData, rawToAmigaDate, rawToAmigaInt, rawToBitmap

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
## some unsigned 8-bit integers:
ubyte <- sample.int(255, 100, TRUE)

## The same values as raw data:
amigaIntToRaw(ubyte)

## some signed 8-bit integers:
byte <- sample.int(255, 100, TRUE) - 128

## The same values as raw data:
amigaIntToRaw(byte, signed = TRUE)

## some signed 16-bit integers:
word <- sample.int(2^16, 100, TRUE) - 2^15

## The same values as raw data:
amigaIntToRaw(word, 16, TRUE)

## note that 16-bit integers require
## twice as many raw values:
length(amigaIntToRaw(word, 16, TRUE))
length(amigaIntToRaw(byte, 8, TRUE))

Example output

  [1] 23 a8 f3 df 95 ab 29 f7 8a 38 ff ae d2 90 05 7a 05 d0 20 fa 99 e6 da 47 f8
 [26] 2d 7a 95 7f 11 91 81 07 3a 0d a6 9d 8a 92 72 bf e7 56 a8 13 aa 5b d7 b4 f1
 [51] b7 f8 27 6c e4 77 68 b7 53 b8 d0 b2 0d 5c 49 b6 03 45 d4 7e 8a ba f4 21 c7
 [76] 5d 72 3d de 5e 5b 4a ca 7b a5 5a 10 77 da 18 c9 93 d7 2d f9 f6 29 c5 f4 25
  [1] e6 5f ca b1 99 20 65 94 89 0e e2 4b 12 c2 55 e8 68 fe bb 3e 93 0f f5 4f cb
 [26] cf b3 ab 6d 48 40 29 ae 2d 16 86 43 aa fe 7f 1e 81 77 e9 32 c4 85 08 13 8c
 [51] 30 d0 45 25 56 97 ee fd c1 21 8d 35 88 0e c0 2e 76 3e 0f 44 46 1d 45 0f d6
 [76] b1 b8 e7 2c 4a 91 77 06 6d cf 0b 0b 10 d9 ba 12 15 88 58 22 d8 0d 66 79 b8
  [1] da 9b a8 9f 2d 92 cd 5d 30 6d d5 f2 e7 6b 61 68 32 78 7f bd dc 92 3e 68 7f
 [26] a7 7b 7a c3 27 94 4b b2 cb ec 11 8b 4d 1e 7b 86 c2 7d 3c 94 5f 41 08 3b 15
 [51] 5d ec 2d 91 7a 25 a1 10 2a 27 12 f4 ee 00 63 1b a9 c7 f6 f2 db b4 07 57 42
 [76] 9f 5c 9d 90 b0 02 80 c9 01 43 2c a6 a3 cb c6 c6 74 1a 82 4a 79 1d 7b 0e 72
[101] de 34 e8 bd 2a dd a8 17 56 1c 90 7c eb 12 73 d0 92 f4 c3 10 b9 45 76 c0 64
[126] a3 c0 6b e9 1f 1e c1 2f ef b0 40 13 d8 00 53 d1 6a 9d d1 35 73 d3 0c 6f cc
[151] d3 bf f6 66 5c 06 c2 7b 68 96 d5 7e ce f1 84 b0 cf eb 48 08 fd 5d 0e eb db
[176] 32 25 f6 d7 cf bf fd d1 02 d1 c7 76 2b 1b 61 8b b5 38 9f 0c 47 72 45 cd b2
[1] 200
[1] 100

adfExplorer documentation built on May 2, 2019, 6:37 a.m.