I wrote a program that receives a string and then I want to search and display the number of characters l
in the string
Show number if present; 0 if not present
The problem with the program is exactly in the search
loop
The rest of the program works properly. I take the string but I can not search and display the result.
I also put the image I want from the output
Please help. I'm confused
m02 macro
mov ah,02
mov dl,al
int 21h
endm
m08 macro
mov ah,08
int 21h
endm
m09 macro str1
mov ah,09
mov dx,offset str1
int 21h
endm
m4c macro
mov ah,4ch
int 21h
endm
stk segment stack 'stack'
dw 32 dup(?)
stk ends
dts segment
p1 db 10,13,'Please enter you text:',10,13,'$'
p2 db 10,13,'Number of characters (L) in the your text: $'
string db 11 dup(?),'$'
newLine db 10,13,'$'
character db 0
dts ends
cds segment
assume cs:cds,ss:stk,ds:dts
main proc far
mov ax,seg dts
mov ds,ax
mov si,offset string
m09 p1
mov cx,11
tek: m08
mov byte ptr [si],al
inc si
m02
loop tek
mov cx,11
mov bx, 10
mov al,character
search: cmp byte ptr string[bx], 'l'
je skip
inc al
skip: dec bx
jns search
m09 p2
m09 al
m4c
main endp
cds ends
end main