Long Data Declaration (Syntax 2)

In DAT blocks, syntax 2 of LONG is used to declare and initialize long-aligned, and/or long-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 long 640_000, $BB50                'Long-aligned/sized data
  MyList byte long $FF995544, long 1_000    'Byte-aligned/long-sized

The above example declares two data symbols, MyData and MyList. MyData points to the start of long-aligned and long-sized data in main memory. MyData's values, in main memory, are 640,000 and $0000BB50, respectively. MyList uses a special DAT block syntax of LONG that creates a byte-aligned but long-sized set of data in main memory. MyList's values, in main memory, are $FF995544 and 1,000, respectively. When accessed a byte at a time, MyList contains $44, $55, $99, $FF, 232 and 3, 0 and 0 since the data is stored in little-endian format.

Note: MyList could have been defined as word-aligned, long-sized data if the "byte" reference were replaced with "word".

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 LONG (see below). For more information about using LONG in this way, refer to the DAT section's Declaring Data (Syntax 1) and keep in mind that LONG is used for the Size field in that description.

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

DAT
  MyData long 640_000, $BB50[3]

The above example declares a long-aligned, long-sized data table, called MyData, consisting of the following four values: 640000, $BB50, $BB50, $BB50. There were three occurrences of $BB50 due to the [3] 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.