Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

MASM Assembly Language x86 Processor - Print Fibonacci Until Overflow Hello ther

ID: 3590421 • Letter: M

Question

MASM Assembly Language x86 Processor - Print Fibonacci Until Overflow

Hello there chegg expert, I really need your help on this 32-bit programming assignment for my class.

Using Irvine32 library

Here is the assignment:

Thank you in advance...

Print_Fibonacci_Util_Overflow (Chapter 6) This program calculates the signed Fibonacci number sequence, stopping onty when the number is over the signed DWORD range. Don't let your loop counter be 46 or any others, since you are not supposed to know in advance. The program displays each decimal integer alue an a separate line, prefixed with a index as follows 5: 5 40: 102334155 1655uu141 43: 433494437 134903170 16: 1836311903 Press any key to continne Think about what d the Fibonacci numbers are considered as unsigned? top

Explanation / Answer

INCLUDE Irvine32.inc
.data
prompt BYTE ": "

.code
Fib PROC
   mov eax, 1
   mov ebx, 0
   mov esi, 1
   mov edx, 0
L1:  

   call PrintFib
   inc esi
   mov edx, eax
   add eax, ebx
   mov ebx, edx
   jno L1

   exit
Fib ENDP


;------------------------------------------------------------
PrintFib PROC
;
; Write a fibonacci number to screen in a formatted way.
; Receives: ESI holds the index number,
;           EAX = fib number
; Returns: nothing
;------------------------------------------------------------
   pushad
   xchg eax, esi
   call WriteDec
   xchg eax, esi
   mov edx,OFFSET prompt
   call WriteString
   call WriteDec
   call crlf
   popad
   ret
PrintFib ENDP

END Fib