describe the main function of the following code 1./ NUM1 DB 5 NUM2 DB 9 NUM3 DB
ID: 3678998 • Letter: D
Question
describe the main function of the following code
1./
NUM1 DB 5
NUM2 DB 9
NUM3 DB 7
MOV AL,[NUM1]
ADD AL,[NUM2]
ADD AL,[NUM3]
MOV AH,0
MOV DL,3
DIV DL ; divide AX by DL
What will be the value in AL?
2./
string1 db “originalstring”
mov ecx, 14
mov eax, 0
mov bl, [string1+eax]
cmp bl, 0
je done
add bl, ‘A’-‘a’
mov [string1+eax], bl
inc eax
loop l1
done:
3./ Convert the following statement in Java to a piece of assembly language code (should use NASM language)
int sum = 0 ;
for (i = 5; i <= 10; i++)
sum = sum + i;
Explanation / Answer
1.This will add the numbers 1 ,2,3 and store the result in AL=>9+5+7=21
AH=0, AL=21
DL=3
we will divide al/dl=21/3=7
AH=0
AL=7
2.This will compare the original string with string itself and loop is executed untill it is same as the string.It will add A-a infront of the string original string.As a result the output will be like this
originalstringA-a
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.