Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Need help Asap on . fibonacci loop asm file keep getting an undefined symbol Error for FirstN edit code please also show proof that the

Need help Asap on .fibonacci loop asm file keep getting an undefined symbol Error for FirstN edit code please also show proof that the program is working. INCLUDE C:\Irvine\Irvine32.inc
.data
welcome BYTE "--------------------------------------------------",13,
10,
13,10," CSC 221 Project 02: Fibonacci Numbers Again ",
13,10," Author: Jack ",
13,10," Hello, user! Lets Write some Fibonacci Numbers. ",
13,10," tell me when to stop! OK!",
13,10,"--------------------------------------------------",
0
prompt BYTE "What number you want to stop at?",13,10
Num BYTE "-->",0
;hello Byte "HELLO",0
n0 DWORD 0 ; first variable, used in calculations (n-2)
n1 DWORD 1 ; second variable
message BYTE "",0
.code
main PROC ; start of the MAIN prodecure
mov edx, OFFSET welcome ; mov address of prompt into edx
call WriteString ; call proc to write out what is pointed to by edx
CALL CRLF ; printout a new line
CALL CRLF ; printout a new line
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
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
mov cl, al ; store given value in Num
mov al, Num ; number of times to go through loop (loop loops at ecx (DWORD))
mov edx, OFFSET FirstN ; mov address of prompt into edx
call WriteString ; call proc to write out what is pointed to by edx
TOP_OF_LOOP: ; start of loop
mov eax, ecx ; copy loop counter to eax (never change ecx in loop)
;--------------------------------------------------
mov eax, n0 ; mov first value into eax
call writeDec ; write out loop value of loop counter
mov eax, n1 ; eax = n1
add eax, n0 ; eax = n2= n1+ n0- calcuate the 3rd value (new send value)
mov ebx , n1 ; save n1's value in register
mov n0, ebx ; save n1's value into n0(new first value)
mov n1, eax ; new n1= n2
mov n0, ebx ; new n0= old n1
;------------------------------------------------
mov edx, OFFSET message ; mov address of prompt into edx
call WriteString ; call proc to write out what is pointed to by edx
loop TOP_OF_LOOP ; go to top_of_loop if and only if (--ecx)
; the loop instructionautomatically decrements ecx ==0
CALL CRLF
CALL CRLF
exit ; Exit to the operating system
main ENDP ; end of MAIN procedure
END main ; program tell MASM to execute start the MAIN procedure
EXIT

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

Recommended Textbook for

Databases Illuminated

Authors: Catherine M. Ricardo, Susan D. Urban, Karen C. Davis

4th Edition

1284231585, 978-1284231588

More Books

Students also viewed these Databases questions

Question

What role will relationships with coworkers play in your life?

Answered: 1 week ago