Hello everyone : )
i'm working on :
Write a program that takes an input sentence from the user and on next line display the number of capitals letters in the sentence.
Note:
· User is not allowed to enter a sentence with more than 9 Capital letters.
what i did is :
.MODEL SMALL
.STACK 100H
.DATA
MSG1 DB 'PLEASE ENTER YOUR SENTENCE: $'
MSG2 DB 0DH,0AH,'THE NUMBER OF CAPITAL LETTERS IN SENTENCE :$'
MSG3 DB 0DH,0AH,'You have entered more than 9 capital liter $'
.CODE
MAIN PROC
MOV AX,@DATA ;initialize DS
MOV DS,AX
;DISPLAY MSG1
LEA DX,MSG1 ;GET MSG1
MOV AH,9 ;DISPLAY STRING
INT 21H ;DISPLAY MSG1
;READ CHARCHTER
;if the user has entered more than 9 capital liter exit ...
MOV bx,0
mov cx,9
MOV AH,1 ;READ sentenc
TOP:
INT 21h
Mov bl,al
cmp bl,'A'
JGE Count
CMP bl,'Z'
JLE Count
Count:
INC bx
LOOP TOP
LEA DX,MSG2 ;GET MSG2
MOV AH,9 ;DISPLAY STRING
INT 21H ;DISPLAY MSG1
mov ah,2
mov DX,BX
INT 21H
MOV AH,4CH ; return control to DOS
INT 21H
MAIN ENDP
END MAIN
END
My problem is on counting the number of capital letters .
Can anyone help please ?