Var Tvar Tempvar

This is another way to declare a label, designed to make adding variables which point to some location of safe RAM easier. The size argument is in bytes - 1 declares a byte, 2 a word, 324 a 324 byte region. The name is just any old label name (local label rules still apply!)

Available types are:

Type Description Size Castable Definable
byte Signed byte 1 Yes Yes
ubyte Unsigned byte 1 Yes Yes
asc ASCII character 1 Yes Yes
word Signed word 2 Yes Yes
uword Unsigned word 2 Yes Yes
int Signed integer 4 Yes Yes
uint Unsigned integer 4 Yes Yes
fpX.Y Signed fixed-point number Variable Yes Yes
ufpX.Y Unsigned fixed-point number Variable Yes Yes
tifloat TI floating-point number 9 No Yes
Any Structure User-defined structure Variable

You can also declare instances of structures (see the struct-endstruct for more information).

Fixed-point variables are sized depending on which values you specify for X and Y. For example, fp8.8 is a 16-bit fixed point number, with 8 bits for the integer part and 8 bits for the fractional part. fp16.8 would have 16 bits in the integer part and 8 in the fractional part, 24-bits (3 bytes) total.

Variables defined using .tempvar or .tvar are designed for temporary variables. Temporary variables defined in one module can potentially overwrite temporary variables defined in another module (as long as the modules do not overlap - for example, if one module is a child of the other).

You can declare an array of variables using square brackets and a size - for example:

.var fp8.8[256], TrigTable

This would declare an variable 512 bytes in size (fp8.8 would be 2 bytes per variable).

See varloc for examples.


.var size|type, name

Allowed inputs


See Also


Unless otherwise stated, the content of this page is licensed under GNU Free Documentation License.