; ************************************************************ Experiment Code
Datarea segment
Mess1 db ' Please enter character string: ', 13, 10, ' $ '
Mess2 DB ' The number is ', ' $ '
MESS3 DB ' The number of digit is ', ' $ '
MESS4 DB ' The number of other is ', ' $ '
CString label Byte
Max DB 80
Act DB?
CStr db 80D dup (?)
Letter db 0
Digit DB 0
Other DB 0
; number db ' 10 ', ' $ ', ' 11 ', ' $ ', ' 12 ', ' $ ', ' 13 ', ' $ ', ' 14 ', ' $ ', ' 15 ', ' $ '
Number db 41h,42h,43h,44h,45h,46h, ' $ '
Datarea ends
;************************************************************
;************************************************************
Prognam segment
Main Procfar
Assume Ds:datarea,cs:prognam
;--------------------------------------------------------------
Start
Push DS
Sub Ax,ax
Push AX
MOV Ax,datarea
MOV Ds,ax
Lea Dx,mess1; display string
MOV ah,09h
int 21h
Sub Ax,ax; Initial storage unit of count to 0
MOV Letter,al
MOV Digit,al
MOV Other,al
Lea dx,cstring; Type a line of characters
MOV ah,0ah
int 21h
Do you need to change the line?
MOV cl,[cstring+1]; Number of counts of classification
Lea si,cstring+2; The initial pointer points to
Call newline
;----------------------------------------------------------------
Begin
MOV Bl,[si]
;------------------------------------
CMP1:; classify characters
CMP bl, ' 0 '
JNB CMP2
JB Others
CMP2:
CMP bl, ' 9 '
JNA digits
JA cmp3
Cmp3:
CMP bl, ' A '
JNB Cmp4
JB Others
Cmp4:
CMP bl, ' Z '