Question

Write a complete assembly language program that computes in EAX the value of the expression x...

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.

Homework Answers

Answer #1

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

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Assembly Language Programming Write a complete assembly program that inputs a small signed integer n, whose...
Assembly Language Programming Write a complete assembly program that inputs a small signed integer n, whose value can fit within 8 bits, and outputs the value of the expression n2 – n + 6. (This is not C++ or Java. Has to be masm file)
Write a C++ program to compute the value of x * (x + 1) + y...
Write a C++ program to compute the value of x * (x + 1) + y * y + z * (z - 1) where x, y, and z are 3 floating point numbers entered by the user. Requirements: • You should have a function get3numbers() that asks the user to enter 3 numbers. • You should have a function computeExp() that computes the value of the expression. • Your main function should call the above 2 functions and get...
Write a MASM program that computes the sum of the integers from 1 to N where...
Write a MASM program that computes the sum of the integers from 1 to N where N is a positive integer. Use the equal sign directive to define N. Save the sum in the EAX register. You must use loops. For example, 1 = 1 1 + 2 = 3 1 + 2 + 3 = 6 1 + 2 + 3 + 4 = 10 1 + 2 + 3 + 4 + 5 = 15 Language ( Assembly)...
Write the following code segment in MARIE's assembly language: if x <= y then Y =...
Write the following code segment in MARIE's assembly language: if x <= y then Y = Y+1; else if x! =x then Y= Y -1; else z=z+1
write an assembly language program for 8085 microprocessor to read consecutive memory locations from 2000 to...
write an assembly language program for 8085 microprocessor to read consecutive memory locations from 2000 to 2FFF & transfer to 4000 to 4FFF,if interrupted display the current count at port5 this is for 8085 microprocessor for interrupt we have to write a program & subroutine
(MIPS Assembly Language): Write the following sequence of code using *native* MIPS instructions: x = x...
(MIPS Assembly Language): Write the following sequence of code using *native* MIPS instructions: x = x - y[0] + y[1]; In memory x, y are stored beginning at 0x010000cc. Use registers $s1 for x,  and $s2 for the base address of y. Make sure your code includes all necessary declarations such that it could run in SPIM.
Write a program in assembly language for x86 Processors, that uses a loop to calculate the...
Write a program in assembly language for x86 Processors, that uses a loop to calculate the first seven values of the Fibonacci number sequence, described by the following formula: Fib(1) = 1, Fib(2) = 1, Fib(n) = Fib(n -1) + Fib(n - 2)
Write a simple ARM assembly language program that finds the mean (as an integer) of all...
Write a simple ARM assembly language program that finds the mean (as an integer) of all values of an integer array. When your program starts, you should assume that r0 contains the address of the array and r1 contains the number of integers in the array. When you program finishes, the mean should be stored in r2. You may use other registers as stack registers.
Please complete in MASM (x86 assembly language). Use the code below to get started. Write a...
Please complete in MASM (x86 assembly language). Use the code below to get started. Write a program that uses a loop to calculate the first seven values of the Fibonacci number sequence, described by the following formula: Fib(1) = 1, Fib(2) = 1, Fib(n) = Fib(n – 1) + Fib(n – 2). .386 .model flat,stdcall .stack 4096 ExitProcess PROTO,dwExitCode:DWORD .data    ; define your variables here .code main PROC    ; write your assembly code here    INVOKE ExitProcess,0 main...
Write a program in Assembly language that calculates the maximum and minimum of 10 numbers stored...
Write a program in Assembly language that calculates the maximum and minimum of 10 numbers stored in memory and writes them to the memory locations. #using loop num: dw 56, 45, 36, 67, 76, 22, 89, 12, 29, 83 min: dw 0 max: dw 0 I wrote a codem but I got an error when I executed it [ORG 0x0100] jmp start num: dw 56, 45, 36, 67, 76, 22, 89, 12, 29, 83 min: dw 0 max: dw 0...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT