Consider the following program fragment in assembly language: mov ax, 0h mov cx, 0A h doloop: dec ax loop doloop What is the value of ax and cx registers after the completion of the doloop?
ax = FFF6 h and cx = 0 h
CX starts at 0Ah, or 10. Each LOOP instruction decrements CX and repeats while it is nonzero, so DEC AX executes ten times.
\(AX=(0-10)\bmod 2^{16}=65526=\mathrm{FFF6}_{16}\)
Thus AX = FFF6h and CX = 0000h.
The following language uses mnemonic OP codes
What will be the hexadecimal value in the register ax (32-bit) after executing the following instructions ?
mov al, 15
mov ah, 15
xor al, al
mov cl, 3
shr ax, cl
Codes :