Hi I am trying to write a program that counts the number of letter in a string.
My code compiles fine but doesnt work when I run it.

My output should be "Capital letters appear x times in y"
Where x is the num (from my code) and y is (txt)

.8086
.model small
.stack 100h
.data

txt db "A Student of Carleton University", 0dh, 0ah, "$"
rslt db "Capital Letter appear x times in y", 0dh, 0ah, "$"
num db ?

.code
main PROC

        MOV AX, @data
        MOV DS, AX

        MOV BX, offset txt
        MOV SI, 0
        MOV rslt+ 33, AL

CheckForDone:
        CMP BYTE PTR [BX+SI], 0dh
        JE Done


        CMP BYTE PTR [BX+SI], 'A'
        JL NEXT
        CMP BYTE PTR [BX+SI], 'Z'
        JG NEXT
        ADD num, 1        

NEXT:
        ADD SI, 1
        JMP CheckForDone


Done:
        MOV AL, num
        MOV rslt+22, AL
        MOV AX, 09h
        MOV DX, offset rslt
        INT 21h
Exit:
        MOV AX, 4C00h
        INT 21h

main ENDP
END main 

At line 37, you need to covert the value in AL to a digit. See examples of converting Binary to ASCII. Simply, a value of 9 lets say in AL needs to be 39H so it will display as the digit 9. Otherwise it's interpreted on most systems as TAB.