[<label>:] DS[.<size>] <count>
where <size> = B (default), W, or L.
RMB (= DS.B)
RMD (2 bytes)
RMQ (4 bytes)
The DS directive is used to reserve memory for variables, as listed in the following listing. The content of the memory reserved is not initialized. The length of the block is <size> *<count>.
<count> may not contain undefined, forward, or external references. It may range from 1 to 4096.
Counter: DS.B 2 ; 2 continuous bytes in memory DS.B 2 ; 2 continuous bytes in memory ; can only be accessed through the label Counter DS.W 5 ; 5 continuous words in memory
The label Counter references the lowest address of the defined storage area.
In the following listing, a variable, a constant, and code were put in the same section. Because code has to be in ROM, then all three elements must be put into ROM.
; How it should NOT be done ... Counter: DS 1 ; 1-byte used InitialCounter: DC.B $f5 ; constant $f5 main: NOP ; NOP instruction
In order to allocate them separately, put them in different sections, as listed in the following listing:
DataSect: SECTION ; separate section for variables Counter: DS 1 ; 1-byte used ConstSect: SECTION ; separate section for constants InitialCounter: DC.B $f5 ; constant $f5 CodeSect: SECTION ; section for code main: NOP ; NOP instruction
An ORG directive also starts a new section.