- ;Write a program that take input as string and counts
- ;number of characters and display. When user press
- ;'ENTER' key it must show the result not including the
- ;'ENTER' key .
- print macro p1
- mov dx,offset p1
- mov ah,9
- int 21h
- endm
- .model small
- .stack 100h
- .data
- str1 db 10,13,'Please enter your statement:$'
- str2 db 10,13,'Total number of character=','$'
- str3 db 10,13,'press Y to run again or Press ESC to terminate program$'
- .code
- main proc
- mov ax,@data
- mov ds,ax
- start:
- print str1
- mov bl,0
- L1:
- mov ah,1
- int 21h
- cmp al,13
- je end1
- inc bl
- cmp al,32
- je decr
- jmp L1
- decr:
- dec bl
- jmp L1
- end1:
- print str2
- mov al,bl
- mov ah,0 ; ax=bl
- aam ;ax=Dh->13d-> ah=1 ; al=3
- mov bl,al
- mov dl,ah
- mov ah,2
- int 21h ; al=dl
- mov dl,bl
- mov ah,2
- int 21h
- L2:
- print str3
- mov ah,1
- int 21h
- cmp al,'Y'
- je start
- cmp al,'y'
- je start
- cmp al,27
- je end2
- jmp L2
- end2:
- mov ah,4ch
- int 21h
- main endp
- end main
Recent Pastes