Question

Could someone explain me what the following snippet of assembly code does? I'm not really sure what the last line really does.

.def main = r16

.equ O = 5
.equ P = 6

ldi main, 0
ldi r16, (1<<O) | (1<<P)

Im particularly wondering what the last line really does. Does it load register 16 with the value of a two logical shifs to the left after an OR statement?

Thanks alot.

Was it helpful?

Solution

(1<<O) | (1<<P) is an expression evaluated by the assembler, the result of which (in this case, 96) is then substituted in the final machine code.

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