woryzower
woryzower

Reputation: 976

x86 assembler adding

I am a newbie on assembly and probably this question has a very basic answer but i really can't figure it out. As the result of this code AL gets the value FE. Why is not 00 ?

MOV BL,0ff;
MOV AL,0ff;
ADD AL,BL

Upvotes: 1

Views: 436

Answers (2)

Viktor Latypov
Viktor Latypov

Reputation: 14467

You're getting 0xFE because 0xFF + 0xFF = 0x1FE. The lower byte is 0xFE, obviously.

Upvotes: 2

Pethical
Pethical

Reputation: 1482

Because FF + FF = 1FE. So, AL will be FE, and your carry flag will be set (1).

Upvotes: 4

Related Questions