toddbranch / ECE382

USAFA ECE382 Course Website

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Assembly question

GoodRyan opened this issue · comments

This is based on the lesson 3 assignment.

If I have efbe in r8 and I do

and.w #0xff, r8

would the and function affect 0xef or 0xbe?

I'm assuming it's 0xef so the result is r8 = 0xefbe. Is this correct?

If you have 0xefbe in r8, then the result would be 0xbe. AND with 0xff is the same as AND with 0x00ff, which would clear the upper byte.

But values in registers are not little-endian...so if you moved #0xbeef into r8 initially, it would not be stored as 0xefbe.