DescX
DescX

Reputation: 334

Explanation for Assembly

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.

Upvotes: 0

Views: 252

Answers (1)

Neil
Neil

Reputation: 55402

(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.

Upvotes: 1

Related Questions