Consider the following x86 – assembly language instructions: MOV AL, 153 NEG…

2018

Consider the following x86 – assembly language instructions:

MOV AL, 153

NEG AL

The contents of the destination register 𝐴𝐿 (in 8-bit binary notation), th status of Carry Flag (𝐶𝐹) and Sign Flag (𝑆𝐹) after the execution of above instructions, are

  1. A.

    𝐴𝐿=01100110;𝐶𝐹=0;𝑆𝐹=0

  2. B.

    𝐴𝐿=01100111;𝐶𝐹=0;𝑆𝐹=1

  3. C.

    𝐴𝐿=01100110;𝐶𝐹=1;𝑆𝐹=1

  4. D.

    𝐴𝐿=01100111;𝐶𝐹=1;𝑆𝐹=0

Attempted by 54 students.

Show answer & explanation

Correct answer: D

Explanation:

  • MOV AL, 153 sets AL to decimal 153, which is binary 10011001.

  • NEG AL computes AL := 0 - AL. Calculate 0 - 153 = -153; in 8-bit unsigned this is 256 - 153 = 103, which is binary 01100111.

  • Carry Flag (CF): NEG sets CF = 1 when the operand is non-zero, so CF = 1.

  • Sign Flag (SF): SF reflects the most significant bit of the result. The result 01100111 has MSB = 0, so SF = 0.

Final result: AL = 01100111; CF = 1; SF = 0

A video solution is available for this question — log in and enroll to watch it.

Explore the full course: Mppsc Assistant Professor