Byte Data Declaration (Syntax 2)

In DAT blocks, syntax 2 of BYTE is used to declare byte-aligned, and/or byte-sized data that is compiled as constant values in main memory. DAT blocks allow this declaration to have an optional symbol preceding it, which can be used for later reference (see DAT). For example:

DAT 
  MyData      byte 64, $AA, 55   'Byte-aligned and byte-sized data 
  MyString    byte "Hello",0     'A string of bytes (characters) 

The above example declares two data symbols, MyData and MyString. Each data symbol points to the start of byte-aligned and byte-sized data in main memory. MyData's values, in main memory, are 64, $AA and 55, respectively. MyString's values, in main memory, are "H", "e", "l", "l", "o", and 0, respectively. This data is compiled into the object and resulting application as part of the executable code section and may be accessed using the read/write form, syntax 3, of BYTE (see below). For more information about using BYTE in this way, refer to the DAT section's Declaring Data (Syntax 1) and keep in mind that BYTE is used for the Size field in that description.

Data items may be repeated by using the optional Count field. For example:

DAT
  MyData      byte 64. $AA[8], 55

The above example declares a byte-aligned, byte-sized data table, called MyData, consisting of the following ten values: 64, $AA, $AA, $AA, $AA, $AA, $AA, $AA, $AA, 55. There were eight occurrences of $AA due to the [8] in the declaration immediately after it.

Unless otherwise noted, content on this site is licensed under the
Creative Commons Attribution-ShareAlike 4.0 International License.