Write a complete assembly language program that computes in EAX the value of the expression x − 2y + 4z for doublewords in memory at x, y, and z. Choose the current month (1–12), day (1–31), and year (all four digits) for the values of x, y, and z.
ANS)
The complete assembly language programis written as
.data
msg1 db 'Enter x between 1 to 12:',0
x dw
msg2 db 'Enter y between 1 to 31:',0
y dw
msg3 db 'Enter z as the year:',0
z dw
result db 'The result is:',0
result dw
start:
mov eax,@data
mov ds,ax
mov eax,offset msg1
call put_str
call getn
mov x,eax
mov eax,offset msg2
call put_str
call getn
mov y,eax
mov eax,offset msg3
call put_str
call getn
mov ax,offset result
mov z,eax
call put_str
mov eax,y
mov ebx,'2'
mul ebx
sub ebx,'0'
mov ebx,x
add eax,ebx
mov edx,4
mov ecx,z
mul edx
add,eax,ecx
int 0x80
end start
Get Answers For Free
Most questions answered within 1 hours.