I'm using an assebler project in ATMEL Studio 7 (ATtiny84A) and I ran into a strange problem. In a code segment, if a .DB
has two bytes it's fine, but two .DB
on separate lines gives a misalignment warning.
.CSEG
; one row
.DB 0x01, 0x02
; same data on two rows
.DB 0x01
.DB 0x02
I understand what misalignment is, but I can't see why the compiler is complaining since putting the data on one row vs two rows yeld the exact same amount of data, in the exact same order.
Do I need some "pack" directive to make it understand that this should be treated as the same chunk of data?
The reason to divide it up in one .DB per line is because it defines character glyphs, like this
.db 0b00000000 ; 0 - 0
.db 0b00111000
.db 0b01000100
.db 0b01000100
.db 0b01000100
.db 0b01000100
.db 0b01000100
.db 0b00111000
It's a lot easier to design/change the glyphs in this way.
EDIT:
Ok, I figured it out. You can simply split one line with \
; 0 - 0
.db 0b00000000, \
0b00111000
.db 0b01000100, \
0b01000100
.db 0b01000100, \
0b01000100
.db 0b01000100, \
0b00111000
I guess it got confused bacause .CSEG
is word oriented. But the compiler should be smart enough to figure out this on its own.