Knowledge Base

defBYTE Directive

The defBYTE directive directs SPLat/PC to create a byte variable and reserve a nominated amount of RAM to hold its data.  The variable will be initialised to 0 at power on.  The location of the variable is allocated automatically by SPLat/PC and might move the next time you build the code.  Thus, you should always refer to the variable by its label.

Syntax:


Label defBYTE {NumberOfBytes}

Where:

  • Label is the name of the variable
  • NumberOfBytes is optional and may be used to specify how many bytes should be reserved for the variable.  It defaults to 1.  Reserving more than one is useful for making a buffer or an array of bytes.

Example:

Label     defBYTE      Value

This will automatically allocate Value bytes of RAM and assign the address of the first byte to Label.

An error will be raised if SPLat/PC is unable to find enough free RAM.