1. What will be the contents of BX after the following instructions execute? mov
ID: 638668 • Letter: 1
Question
1. What will be the contents of BX after the following instructions execute?
mov bx,5
stc
mov ax,60h
adc bx,ax
2. Describe the output when the following code executes in 64-bit mode:
.data
dividend_hi QWORD 00000108h
dividend_lo QWORD 33300020h
divisor QWORD 00000100h
.code
mov rdx,dividend_hi
mov rax,dividend_lo
div divisor
3. The following program is supposed to subtract val2 from val1. Find and correct all logic
errors (CLC clears the Carry flag):
.data
val1 QWORD 20403004362047A1h
val2 QWORD 055210304A2630B2h
result QWORD 0
.code
mov cx,8 ; loop counter
mov esi,val1 ; set index to start
mov edi,val2
clc ; clear Carry flag
top:
mov al,BYTE PTR[esi] ; get first number
sbb al,BYTE PTR[edi] ; subtract second
mov BYTE PTR[esi],al ; store the result
dec esi
dec edi
loop top
4. What will be the hexadecimal contents of RAX after the following instructions execute in
64-bit mode?
.data
multiplicand QWORD 0001020304050000h
.code
imul rax,multiplicand, 4
Explanation / Answer
1)
The final value will be (5 in bx + 1 for carry+ 60h address)
bx= 0066h
2)
RAX = 0108000000003330
RDX = 0000000000000020
3)
.data
val1 QWORD 2040300 436 2047A1h
val2 QWORD 055210 304A2630B2h
result QWORD 0
. code
mov ecx, 8
mov esi , offset val1
mov edi , offset val2
mov ebx , offset result
clc
top :
mov al, BYTE PTR[esi]
sbb al, BYTE PTR[edi]
mov BYTE PTR [ebx], al
inc esi
inc edi
inc ebx
loop top
4)
RAX = 01000001020304050000
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.