BACKGROUND on this part of assignment:
COUNTLIST:
Generate an array counts which holds the number of times each value [10, 29] is seen in randArray. For example, counts[0] should equal the number instances of the value10in array. counts[14] should equal the number of instances of the value24in randArray
Added context: the list randArray is sorted in ascending order before countList is called. So an array with numbers: 10, 10, 11, 12, 12, would be copied over to another array as 2,1,2.
countList PROC
    push    EBP
    mov     EBP, ESP
    
    mov     ESI, [ESP + 20]            ; randArray (200 digits w/n this array)
    mov     ECX, [ESP + 16]            ; loop counter (ARRAYSIZE, which is 200)
    dec     ECX                        ; 200 - 1
    mov     EBX, [ESP + 12]            ; array we want to add to (countArray)
    mov     EDX, [ESP + 8]             ;"counter" for # of repeats for a digit
    _FirstLoop:
        ; grab first digit of sorted array
        mov     EAX, [ESI]
        ; compare current value to next value
        cmp     EAX, [ESI + 4]
        je      _NextDigit
        jne     _AddCountArray
    _NextDigit:
        ; move to next item in array
        inc     EDX
        add     ESI, 4
        loop    _FirstLoop
    _AddCountArray:
        ; add total number of instances of specified digit to countArray
        mov     [EBX], EDX
        add     EBX,  TYPE DWORD
        loop    _FirstLoop
    pop     EBP
    RET     16
countList ENDP
Maybe because I've looked at this assignment too long I'm missing where exactly the loop is messing up? The array that's meant to have values added into it is empty.
Any step in the right direction is much appreciated.
 
    