BYTE - rosco-pc/propeller-wiki GitHub Wiki

A byte is an unsigned integer. Unlike a long which is signed.

BYTE is used as a keyword in 4 different ways:

BYTE Symbol

BYTE <Size> <Data> <,<Size> Data>...

BYTE [BaseAddressInBytes] BYTE [BaseAddressInBytes]``[OffsetInBytes]

Symbol.BYTE[OffsetInBytes]

BYTE Symbol <[Count]>

Declaration of a Spin byte variable. When compiling, Spin groups all the byte declarations together in a block after all the long and word declarations, so you can't count on the order of differently sized variables in memory being as in the source. However, all same sized variables will be in the order you declare them. These variables only exist in Hub memory. They will exist at a place past the binary image created by PropTool. They are always initialised to zero. To access them from assembler, you'd have to pass the address of one to the assembly program through the [[PAR]] mechanism and use RDBYTE/WRBYTE.

BYTE <Size> <Data> <,<Size> Data>...

Declare a byte aligned label. Size [BYTE|WORD|LONG] indicates how much space to allocate for that labelled location. Size defaults to BYTE. Data will be put into the location modulus the Size field. Layout in memory will reflect the order declared in the source, however differently aligned declarations may result in padding. The data exists in Hub RAM, and may be copied to Cog RAM when starting a Cog. Spin references will use the original in Hub RAM, Assembler references will use the Cog RAM copy (unless done by reference though PAR and RDBYTE/WRBYTE ]].

BYTE [BaseAddressInBytes]

BYTE [BaseAddressInBytes] [OffsetInBytes]

In spin will read/write to a byte in Hub RAM.

Symbol.BYTE[OffsetInWords]

In spin will read/write to a byte in Hub RAM. Symbol may be a long, word or byte variable (although as a byte, it'd be more straightforward to use simple array indexing - Symbol[Offset]).

See also

LONG | WORD | Symbol Address operator

⚠️ **GitHub.com Fallback** ⚠️