toddbranch / ECE382

USAFA ECE382 Course Website
13 stars 23 forks source link

Assembly question #175

Closed GoodRyan closed 10 years ago

GoodRyan commented 10 years ago

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?

toddbranch commented 10 years ago

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.