Header Ads

Find the Value of EAX Register and the Sign Flag After the Following Line Execute | MOV EAX,5 Sub EAX,6

In This Post We Discuss the How to Find the Value of EAX Register and the Sign Flag After the Following Line Execute  | MOV EAX,5  Sub EAX,6

Problem Statement :

Find the Register Value of EAX

Example 1: MOV EAX,38  Sub EAX,29

Example 1: MOV EAX,45  Sub EAX,63

Example 1: MOV EAX,5  Sub EAX,6


Example 1:

Mov EAX, 38

SUB EAX,29

38 – 29

38 + (-29)

Subtracting Smaller Value from Large Vale

  1. Convert Decimal Number into Binary Number  using 8 bit
  2. Determine 1’s complement of smaller number
  3. Add the result of step 2 to the larger number . Ignore last carry bit
  4. Add the last carry bit to the result
  5. Convert the result of binary number into decimal

Solution of Example 1

Mov EAX, 38

Sub EAX,29

38 + (-29)

Convert 38 into Binary Number = (00100110)2

Convert 29 into Binary Number and Then 1’s Complement = (00011101)2   

(00011101)2    After 1’s Complement  = (11100010)   (Hint replace 1 into 0 and 0 into 1)

     00100110

+  11100010

-----------------------

  100001000

Add Carry bit   1 into result

00001001  = 9  


Example 2

Mov EAX, 45

Sub EAX,63

45 + (-63)

Subtracting Large Value from Small Vale

  1. Convert Decimal Number into Binary Number  using 8 bit
  2. Determine 1’s complement of Larger number
  3. Add the result of step 2 to the larger number . In this Step is no carry bit
  4. To Find the value of Register Add 1 to Result of Step 3
  5. Take 1’s complement of the result Step 3 and place a negative sign before it
  6. Convert the result of binary number into decimal

Solution of Example 2

Mov EAX, 45

Sub EAX,63

45 + (-63)

Convert 45  into Binary Number = (00101101)2

Convert 63 into Binary Number and Then 1’s Complement = (00111111)2  

(001111111)2    After 1’s Complement  = (11000000)   (Hint replace 1 into 0 and 0 into 1)

     00101101

+  11000000

-----------------------

    11101101     Add 1 in result . The Value Register EAX  = 11101110 = EE

Take 1’s

-(00010010 ) = -18


Solution of Example 3

MOV EAX ,5

SUB EAX,6

5 + (-6)

Convert 5  into Binary Number = (00000101)2

Convert 6 into Binary Number and Then 1’s Complement = (00000110)2   

(00000110)2    After 1’s Complement  = (11111001)   (Hint replace 1 into 0 and 0 into 1)

     00000101

+   11111001

-----------------------

     11111110    Add 1 in result . The Value Register EAX = 1111 1111  = FF

Take 1’s complement

- (00000001) = -1


Related Video




 


No comments

Powered by Blogger.