Hi
I am struggling to understand an assembler directive "DCD" which is stated as below..!
"DCD inserts up to three bytes of padding before the first defined word, if necessary, to achieve four-byte alignment."
I would have thought that by inserting three bytes of padding before the first byte not word would achieve four-byte alignment or am I missing somthing..???
I have copied below the Usage example from the ARM assembler reference if this helps..?
Usage
DCD inserts up to three bytes of padding before the first defined word, if necessary, to achieve
four-byte alignment.
Use DCDU if you do not require alignment.
Examples
data1 DCD 1,5,20 ; Defines 3 words containing
; decimal values 1, 5, and 20
data2 DCD mem06 + 4 ; Defines 1 word containing 4 +
; the address of the label mem06
AREA MyData, DATA, READWRITE
DCB 255 ; Now misaligned ...
data3 DCDU 1,5,20 ; Defines 3 words containing
; 1, 5 and 20, not word aligned
I am struggling to understand an assembler directive "DCD" which is stated as below..!
"DCD inserts up to three bytes of padding before the first defined word, if necessary, to achieve four-byte alignment."
I would have thought that by inserting three bytes of padding before the first byte not word would achieve four-byte alignment or am I missing somthing..???
I have copied below the Usage example from the ARM assembler reference if this helps..?
Usage
DCD inserts up to three bytes of padding before the first defined word, if necessary, to achieve
four-byte alignment.
Use DCDU if you do not require alignment.
Examples
data1 DCD 1,5,20 ; Defines 3 words containing
; decimal values 1, 5, and 20
data2 DCD mem06 + 4 ; Defines 1 word containing 4 +
; the address of the label mem06
AREA MyData, DATA, READWRITE
DCB 255 ; Now misaligned ...
data3 DCDU 1,5,20 ; Defines 3 words containing
; 1, 5 and 20, not word aligned
Comment