syntax:
[<label>] .ds <expr>
[<label>] .reserve <expr>
e.g.
fred .db 1 ; reserve 1 byte and call it fred
jack .db 1*2 ; reserve 1 word and call it jack
bert .db 1*4 ; reserve 1 long word and call it bert
The .ds statement is also very useful for generating series of constants
e.g.
.sect some_unique_sect_name
.data
monday .ds 1
tuesday .ds 1
wednesday .ds 1
thursday .ds 1
friday .ds 1
saturday .ds 1
sunday .ds 1
this gives us an ordered list of numbers coressponding to the days of the
week with monday as day 0 and sunday as day 6. If we needed to change this
so that monday is day 1 and sunday is day 7 we would simply add an .org
statement before monday like this:
.sect some_unique_sect_name
.data
.org 1
monday .ds 1
tuesday .ds 1
wednesday .ds 1
thursday .ds 1
friday .ds 1
saturday .ds 1
sunday .ds 1
If we then needed to change the list such that sunday becomes the first
day in the list and is day 1 and all the other days are relative to it
we would simply exit the above to give the following:
.sect some_unique_sect_name
.data
.org 1
sunday .ds 1
monday .ds 1
tuesday .ds 1
wednesday .ds 1
thursday .ds 1
friday .ds 1
saturday .ds 1
Compare this with the alternative below (which is much more difficult to
maintain):
monday .equ 0
tuesday .equ 1
wednesday .equ 2
thursday .equ 3
friday .equ 4
saturday .equ 5
sunday .equ 6
BEWARE: defining bytes in the code section of a CPU that has a program
counter that counts in words may cause the location counter to be incremented
to an odd address. Also note that the length of a block of data will be
reported as half the expected size. This will not affect the space reserved,
just the observed length.