Create a new MASM project by following the procedure as described in the tutorial. Go to the main.asm file and copy the following code.

This assignment covers the usage of basic arithmetic instructions as used in assignment 1, along with understanding of arrays and how arrays are stored in the main memory. Please make sure that you understand all the material covered until week 16 lectures. This assignment will mainly test your understanding of arrays, how to store them and how to access them from assembly language code.

Prerequisites

To complete this assignment, you need to understand 1) different memory addressing modes supported by the x86 instruction set 2) Using JUMP instructions to implement loop iterations 3) How arrays are stored in the memory. You also need to understand to use basic arithmetic instructions, which you should have a good grip on after completing assignment #1.

Problem description

Reverse Fibonacci sequence

The Fibonacci sequence is the sequence of numbers

0,1,1,2,3,5,8,…

In this sequence, the first two numbers are 0 and 1, and every new number of the sequence can be computed by adding two previous numbers in the sequence. The function to compute Fibonacci

sequence is defined as

๐‘“(๐‘›)=๐‘“(๐‘›โˆ’1)+๐‘“(๐‘›โˆ’2),

๐‘คโ„Ž๐‘’๐‘Ÿ๐‘’ ๐‘“(0)=0,๐‘Ž๐‘›๐‘‘ ๐‘“(1)=1

In this task, you will first print a few numbers from the fabonacci sequence and store it in an array. Then you will create another array and print the computed fabanocci sequence in reverse. The details of the procedure are given in next section.

Procedure

Create a new MASM project by following the procedure as described in the tutorial. Go to the main.asm file and copy the following code. In the code provided below, the number of elements of the Fibonacci sequence to be printed are stored in the variable โ€œfibonacciโ€ and the output result should be stored as an array with the array starting at location โ€œfib_sequenceโ€ and the reverse of the array โ€œfib_sequenceโ€ needs to be stored in a separate array called โ€œreverse_fibonacciโ€. Please note that this must be implemented using JUMP instruction to do loop iterations so that the code works for every valid input value . To aid your programming, you can define more variables if you like. .386

.model flat, stdcall

.stack 4096

ExitProcess PROTO, dwExitCode: DWORD

.data

; define your variables here

fibonacci byte 12

fib_sequence byte 0

reverse_fibonacci byte 0

.code

main PROC

; write your assembly code here

INVOKE ExitProcess, 0

main ENDP

END main

Deliverables

Please submit a single .asm file implementing the task as described.

Last Completed Projects

topic title academic level Writer delivered
© 2020 EssayQuoll.com. All Rights Reserved. | Disclaimer: For assistance purposes only. These custom papers should be used with proper reference.