How would I calculate the first 12 values in the Fibonacci number sequence and be able to place it in EAX reg. and display calling DumpRegs? Using Indirect addressing I know I need a for loop here but I'm not sure how to even go about this. Any help or tips are appreciated.
INCLUDE Irvine32.inc
; (insert symbol definitions here)
.data
; (insert variables here)
Fibonacci BYTE 1, 1, 10 DUP (?)
.code
main PROC
; (insert executable instructions here)
; (This below will show hexa contents of string.)
mov esi, OFFSET Fibonacci ; offset the variables
mov ebx,1 ; byte format
mov ecx, SIZEOF Fibonacci ; counter
call dumpMem
exit ; exit to operating system
main ENDP
; (insert additional procedures here)
END main
You can make a loop like this:
mov ecx,12
your_label:
; your code
loop your_label
The loop instruction decrements ecx
and jumps to the specified label unless ecx
is equal to zero. You could also construct the same loop like this:
mov ecx,12
your_label:
; your code
dec ecx
jnz your_label