user2672288
user2672288

Reputation:

Assembly - the effect on EAX by AL

I'm aware that the following code:

MOV AL, 8 ; 

will put the value 8 (decimal) into the lowest byte of EAX. However, if EAX already has the decimal value 1 stored therein, what happens, does it overwrite it?

So...

XOR EAX, EAX ;
INC EAX ; 
MOV AL, 8 ; 

Does EAX now just contain the decimal 8?

Upvotes: 0

Views: 606

Answers (2)

Youka
Youka

Reputation: 2715

Source: wwwi10.lrr.in.tum.de/~jasmin/basics.html

When EAX contains 1, the higher bytes contain 0 and AL 1 - that's the number representation in a 32 bits integer. When moving 8 in AL, EAX has still the three other bytes with 0 and the whole integer is 8 now.

Upvotes: 2

Nhat M Le
Nhat M Le

Reputation: 276

Yes it copies and replaces the destination operand with the source operand, the source operand is unchanged.

Upvotes: 0

Related Questions