I am supposed to take signed integers from a user, calculate the sum of inputted numbers and then display the average. The problem is, negative numbers don't seem to be displaying correctly, although I know the sum and average are being calculated correctly.
What do I need to add to my procedure to account for negative numbers so they are displayed correctly?
.
.
.
writeVal PROC   USES eax
    LOCAL   resultString[11]:BYTE
    lea     eax, resultString
    push    eax
    push    [ebp + 8]
    call    intToStr
    lea     eax, resultString
    displayString eax ; print num
    ret     4
writeVal ENDP
intToStr PROC       USES eax ebx ecx
    LOCAL   tempChar:DWORD
    mov     eax, [ebp + 8]
    mov     ebx, 10
    mov     ecx, 0
    cld
divideByTen:
    cdq
    idiv    ebx
    push    edx
    inc     ecx
    cmp     eax, 0
    jne     divideByTen
    mov     edi, [ebp + 12] ; move into dest array
    jmp     storeChar
;store char in array
storeChar:
    pop     tempChar
    mov     al, BYTE PTR tempChar
    add     al, 48
    stosb
    loop    storeChar
    mov     al, 0
    stosb
    ret     8
intToStr ENDP
.
.
.
 
     
    