Using a structure declaration you can be read and clearly take values in a data object better than it is possible for a data object with the given options. For this purpose, the pre-processor sets the values given in the corresponding commands such as „.db“, „.dw“, etc. The structure declaration itself consumpts no memory and used only to defining how data is structured and how they should be interpreted.

Usage

The data that e.g. repeating for a table to successive values are not as usual so defined with the following „.db“, „.dw“:

StructureName { ElementValue[, ElementValue1, ..] }

  • StructureName is the name of the declared structure.
  • ElementValue Strings which exceed the length declared in the structure will be cut. If the length is belower, they are filled with blanks.

Example

[..]
struct ENTRY
  byte   index
  string text[12]
  byte   terminate
  word   value
endstruct
[..]
data table
  ENTRY { 1, "entry No. 1", 0, 0xcd44 }
  ENTRY { 2, "entry No. 2", 0, 0x1122 }
  ENTRY { 3, "entry No. 3", 0, 0xff00 }
enddata

This example is preprocessed to:

data table
  .db 1
  .db "entry No. 1 ",0
  .dw 0xcd44
  .db 2
  .db "entry No. 2 ",0
  .dw 0x1122
  .db 3
  .db "entry No. 3 ",0
  .dw 0xff00
enddata