Jump to Navigation

Basic Elements

Basic Elements

Basic Storage Elements

All other elements can be descibed in terms of these three basic storage elements:

Abbr. Full Desciption

B Byte 1 byte long (8 bits)
W Word 2 bytes long
L Long 4 bytes long

All numbers are written in hexcode. So 48 equals 72 decimal. A sequence of bytes is written like 4E 00 00 10. As the Psion uses little endian, this corresponds to the number 1000004E. Negative numbers are expressed using two's complement notation: F7 corresponds to -9.

Sometimes, we need to talk about individual bits. A byte has 8 bits; bit 0 is the LSB (value: 1), bit 7 the MSB (value: 80).

Lists

Often lists are used. A list consists of an indication of its length, followed by length elements. A BListB uses a byte as length indicator and its length is counted in bytes. A LListB uses a long to encode the length, counted in bytes, etc. So the first letter tells how the length indicator is encoded: in a byte (B), word (W), long (L), special (S) or extra (X). The last letter tells what unit the length count is in: bytes (B), words (W), Longs (L) or elements as described (E).

We can make the following matrix:

   Element Size

Indicator B W L E
B BlistB BListW BListL BlistE
W WlistB WListW WListL WlistE
L LlistB LListW LListL LlistE
S SlistB SListW SListL SlistE
X XlistB XListW XListL XlistE

The special and extra encodings need some more explanation.They are both used in cases where it is unclear how big a number needs to be represented. Both use an expandable scheme to encode numbers.

Special encoding:

Length described  Length of indicator  Value of indicator  How to recognize

00000000 - 0000003F B 4 * length + 2 First byte & 03 == 02
00000080 - 00001FFF W 8 * length + 5 First byte & 07 == 05

Extra encoding:

Length described  Length of indicator  Value of indicator  How to recognize

00000000 - 0000007F B 2 * length First byte & 01 == 00
00000080 - 00003FFF W 4 * length + 1 First byte & 03 == 01
00004000 - 1FFFFFFF L 8 * length + 3 First byte & 07 == 03



Psifiles | by Dr. Radut