Roger_2 0 Light Poster

hello everyone! my program is nearing completion and is due tommrow. However i have identified the source of an issue. i am cycling through a few functions which roll a dice 1-6 and add that result to a buffer to keep score.Then when i want to print, i am only able to print single digit integers and anything with two digits such as 10 or greater loops through my write_number function infinetly until a seg fault results. How can i alter this algorithm to accomodate for up to three digit integers as the score will need to progress to 100 before the progam ends? unless anyone has a better previously coded algorithm since my assignment was to use a working function found online. please, any insight is greatly appreciated!

section .bss

userScore: resd 4
pcScore: resb 4

number: resd 4
digit: resd 4
count:  resd 4  

. . . . . . . . . . .

    cmp edx, 6 ;dice roll result
    call write_number
    jmp printReadOption

write_number:

    add dword[userScore], edx
    mov edx, dword[userScore]
    mov dword[number], edx
        mov eax, dword[number]
        mov ecx, 0Ah ;hex for 10
        cdq
        div ecx ;eax=number/10,edx=number%10
        mov dword[number], eax ;number= number/10
        add edx, 30h ;add 48 (30h) to make a printable character
        push edx ;push edx in to the stack and
        inc dword[count] ;increment count of numbers in the stack
        cmp dword[number], 0 ;if number != 0, loop again
        jne write_number

loop2:

        pop dword[digit] ;pop the digit from the stack and
        call write_digit ;write it
        dec dword[count] ;decrement the count
        cmp dword[count], 0 ; if count != 0, loop again
        jne loop2
        ret

write_digit:    ;Print score

    mov eax, 4
    mov ebx, 1
    mov ecx, userScoreIs
    mov edx, userScoreIsLen
    int 80h

    mov eax, 4
    mov ebx, 1
    mov ecx, digit ;score to print
    mov edx, 4
    int 80h
    ret