Question

My teacher wants us to have a basic understanding of assembly, because later down the road, that might be helpful. I'm fine with that, but my college provides zero documentation on the subject, apart from 4 small examples. I'm trying to figure out what is happening in this one:

.DEVICE ATmega32

.CSEG
main:

ldi    ZL,low(varclist<<1)
ldi    ZH,high(varclist<<1)

.CSEG
varclist:
.db    1, 2
.db    3, 4
.db    5, 6
.db    7, 8
.db    9, 0

I'm am working in AVR studio 5, and looking at the 'processor' tab. I can't seem to find any relation between the values in 'varclist', and the hexadecimal values the registers are showing. How do i look at this?

I would expect the Z register to contain 0x0100 as i would imagine the 'most-significant' bit to be the first one declared, and the least significant the last declared. I'm seeing 0x0070, however. I'm not sure what the shifting does, though.

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top