So I'm building a simple 8086 Assembly program that allows the user to input 4 digits, store them in an array and print out the sum of those digits (The sum must be a one digit number):
data segment
    i db ?
    array db 20 dup(?)
    sum db ?
ends
stack segment
    dw 128 dup(0)
ends
code segment
    mov ax, data
    mov ds, ax
    mov es, ax
    mov i, 0
Enter:
    mov ah, 1
    int 21h
    mov bl, i
    mov bh, 0
    mov array[bx], al
    inc i
    cmp i, 4
    jne Enter
    mov sum, 0
    mov i, 0
Calc:
    mov bl, i
    mov bh, 0
    mov al, array[bx]
    add sum, al
    inc i
    cmp i, 4
    jne Calc
    mov dl, sum
    mov ah, 2
    int 21h
    mov ax, 4c00h
    int 21h
ends
However when I input the numbers 1 1 2 5 instead of giving me 9 it gives me some random character.
Any ideas?
 
     
    