Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Calculate the numbers in the Fibonacci Sequence up to a given sequence value. Write a program that 1) greets the user (describes task) 2) asks

Calculate the numbers in the Fibonacci Sequence up to a given sequence value.

Write a program that

1) greets the user (describes task)

2) asks the user for number value

3) store the value, of the lower 8 bits of the value given by the user, in a BYTE a. note this limits the range of values for the sequence numbers to <255

4) using a loop, calculate the Fibonacci sequence up to the given sequence value a. e.g. if the user give us 11 we calculate the sequence up to the 11th number in the sequence

5) neatly print out all the sequence values (separated by a space) For this program the sequence is 1st 2nd 3rd 4th 5th 6 th 0 1 1 2 3 5 To read in a value from the user use the ReadDec procedure . . . mov edx, OFFSET prompt ; mov address of prompt into edx call WriteString ; call proc to write out what is pointed to by edx call ReadDec ; user vale is put into eax . . . Save only the lower 8 bits of the given number e.g. eax has the users given value (as a DWORD) . . . mov Num, al ; mov lowest 8 bits in to Num (BYTE) . . . mov ecx, 0 ; zero out the whole ecx register mov cl, Num ; move lower 8 bits of eax into lower 8 bits of ecx ; or mov cl, al ; do we really need to store given value in Num? . . . To loop a certain number of times e.g. write out hello five times, where n is 5, then 4, then 3, . . . mov ecx, 5 ; number of times to go through loop (loop loops at ecx (DWORD)) TOP_OF_LOOP: ; start of loop mov edx, OFFSET hello ; should reall do this outside of loop call WriteString ; write out hello mov eax, ecx ; copy loop counter to eax (never change ecx in loop) call writeInt ; write out loop value of loop counter call CRLF ; printout a new line loop TOP_OF_LOOP ; go to top_of_loop if and only if (--ecx) == 0 ; the loop instruction automatically decrements ecx . . . Output: Hello +5 Hello +4 Hello +3 Hello +2 Hello +1

assembly language

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

7. Discuss how data can have a commercial value. (6)

Answered: 1 week ago