Search code examples
assemblyx86masm

"Project.exe (process 15848) exited with code 0" in Assembly Language?


I am trying to run a procedure that displays N terms of a Fibonacci sequence in hexadecimal (with N = 30), and when I run my code, I get no display of hexadecimal numbers, yet I get a message saying "Project.exe (process 15848) exited with code 0". Can someone please help me and explain why I get this message instead of 30 hexadecimal numbers? Thank you! I am using Visual Studio 2019 on Windows 10.

Here is my code:

; Create a procedure that produces N terms of a Fibonacci sequence in hexadecimal

INCLUDE Irvine32.inc
.data
fibArray DWORD 0h, 01h ; F0 = 0 and F1 = 1

.code
main proc
    mov ecx, 30 ; Number of values wanted

    mov edx, 0h 
    mov ebx, 1h 

    mov esi, 8; fibarray[0] = 0, fibarray[4] = 1, so fibarray[8] = fibarray[0]+fibarray[1]
    sub ecx, 1; Because indexing starts at 0 and ecx is that amount of values we want
    call Fibonacci 

    ;DumpMem register parameters fulfilled
    mov esi, OFFSET fibArray
    mov ecx, LENGTHOF fibArray
    mov ebx, TYPE fibArray
    call DumpMem



exit
main endp
; Fibonacci procedure
Fibonacci proc
    L1:
        mov eax, edx
        add eax, ebx
        mov fibArray[esi], eax
        mov edx, ebx
        mov ebx, eax
        add esi, 4
        loop L1
    ret
    Fibonacci endp

end main

Solution

  • I fixed the problem by calling "fibArray DWORD dup 30 (?)" To give the array 30 uninitialized spots. Thank you @Jester!