using Assembly language or MASM
CSC 221 Project 03 - Fibonacci Again Calculate the numbers in the Mbonacci 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 2. note this limits the range of values for the sequence numbers to 255 4 using a loop, calculate the Fibonacel sequence up to the given sequence value ce if the user give us 11 we calculate the sequence up to the 11 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 Gh 0 1 1 2 3 To read in a value from the user use the ReadDec procedure nov 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 of eax has the user's given value (as a DWORD) mov Nun, al mov lowest 8 bits in to Nun (BYTE) nov ecx, o zero out the whole ecx register nov cl, Num nove lower 8 bits of eax into lower 8 bits of ecx novci, al ; do we really need to store given value in Num? To loop a certain number of times es, write out "hello no" five times where is then 4, then 3. - mov ecx, 5 number of times to go through loop (loop loops at ecx (DWORD)) TOP_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 1f and only if (-ecx) - the loop instruction automatically decrenents ecx Output: Hello +5 Hello + Hello 3 Hello +2 Hello +1 Read up on both loop/ecx and reading in an user value (book and notes) Use http://ec.cudh.edu/mmccullough/asm_help as a reference Make sure: 1) your program builds (assembles and links) before turning it in 2) your program has comments (line and header) and is well formatted 3) asm file is named correctly and is the only thing upload