Question

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 ENDP
END main

Homework Answers

Answer #1
.386
.model flat,stdcall
.stack 4096
ExitProcess PROTO, dwExitCode:DWORD

.data
count DWORD 5
array DWORD 7 DUP (1,1,?,?,?,?,?)
.code
main PROC

  mov ecx, count
  mov ESI, OFFSET array
  Add ESI, TYPE array
  Add ESI, TYPE array

  L1:
 MOV EAX,[ESI-4]
 MOV EBX,[ESI-8]
 ADD EAX,EBX
 MOV [ESI],EAX
 ADD ESI, TYPE array
  Loop L1

INVOKE ExitProcess,0
main ENDP
END main

NOTE: Let me know if you face any kind of error. I'll try to resolve your issues.

UPVOTE!!! PLEASE... Thank You!!

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
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)
Implement the following expression in assembly language:                                  &nb
Implement the following expression in assembly language:                                                 BX = –val2 + 7 - (- val3 + val1) * 2 Assume that val1, val2, and val3 are 8-bit integer variables Initialize val1 with 12, val2 with 9, and val3 with 2 You are only allowed to use 16-bit registers to hold intermediate results, whenever needed. Use ONLY mov, add, sub, movzx, movzx, or neg instructions whenever needed. Use the debugger to verify your answer. Please answer using this format for...
PLEASE COMMENT CODE AND TEST THAT IT WORKS: Write a assembly program to find the largest...
PLEASE COMMENT CODE AND TEST THAT IT WORKS: Write a assembly program to find the largest item in an array and store it in a AX. Hint: Use both Jump and loop instruction to write the program. logic: Assume that the first item of the array is the minimum and store it in AX Write a loop. Inside the loop, compare the each array item with the AX If the array item is less than the AX, update AX with...
Write an assembly program to compute the following expressions Create a list named ‘z’ of size...
Write an assembly program to compute the following expressions Create a list named ‘z’ of size 3 using DUP operator. Leave the list ‘z’ uninitialized. You can denote the items in the list as [z0, z1, z2]. z0 =x+13 z1 = y-x z2= r+z1-13 Where x, y, r are 16-bit integer memory variables. x = 7, y = 20, r = 4 Use the debugger to verify your answer. Please answer using this format for code: .386 .model flat, stdcall...
Please Code in Assembly Language Code solution using the provided template AL_Template_Irvine32.asm located towards the bottom...
Please Code in Assembly Language Code solution using the provided template AL_Template_Irvine32.asm located towards the bottom of the question. Debug programs with Visual Studio2017/19. Please add single line or block comments explaining the purpose or functionality of your code statements. Draw Text Colors Write a program that displays the same string in four different colors, using a loop. Call the Set-TextColor procedure from the book’s link library. Any colors may be chosen, but you may find it easiest to change...
A) Is the code below secure? Explain your rationale. ExitProcess PROTO .data firstval qword 20002000h secondval...
A) Is the code below secure? Explain your rationale. ExitProcess PROTO .data firstval qword 20002000h secondval qword 11111111h thirdval qword 22222222h sum qword 0 .code main proc      mov rax,firstval                         add rax,secondval             add    rax,thirdval      mov    sum,rax      mov    ecx,0      invoke ExitProcess main endp end main b) Transmitted messages often include a parity bit, whose value is combined with a data byte to produce an even number of 1 bits. Suppose a message byte in the AL...
Please Write the whole program in assembly i am able to calculate the fibonacci series but...
Please Write the whole program in assembly i am able to calculate the fibonacci series but not sure how to print it in reverse order. Please give a Complete code !! Programming Exercise 1 (10 points): [call it Ass2-Q1.asm] Write an ASM program that reads an integer number N and then displays the first N values of the Fibonacci number sequence, described by: Fib(0) = 0, Fib(1) = 1, Fib(N) = Fib(N-2) + Fib(N-1) Thus, if the input is N...
Please Code in Assembly Language Code solution using the provided template AL_Template_Irvine32.asm located towards the bottom...
Please Code in Assembly Language Code solution using the provided template AL_Template_Irvine32.asm located towards the bottom of the question.. Debug programs with Visual Studio2017/19. Please add single line or block comments explaining the purpose or functionality of your code statements. 6.) Random Strings Create a procedure that generates a random string of length L, containing all capital letters. When calling the procedure, pass the value of L in EAX, and pass a pointer to an array of byte that will...
Written in MASM Assembly Problem Definition: Write a program to calculate Fibonacci numbers. • Display the...
Written in MASM Assembly Problem Definition: Write a program to calculate Fibonacci numbers. • Display the program title and programmer’s name. Then get the user’s name, and greet the user. • Prompt the user to enter the number of Fibonacci terms to be displayed. Advise the user to enter an integer in the range [1 .. 46]. • Get and validate the user input (n). • Calculate and display all of the Fibonacci numbers up to and including the nth...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT