Ok, so far i have 2 strings inputed from keyboars into stringA and stringB, defined as db
now i need to count how many times is string B appearing in A and output that number.
Max lenght of strings is 29.
I think it should be done in 2 loop, to run throgh bouth string,
Can anyone help?

Recommended Answers

All 5 Replies

thats fine but now in need to print di which i uses as a counter, how to do it?

Is two loops even alot?

Well you use 'divide by 10' and 'modulo 10' to extract each digit from the number, then add '0' to the result to get a printable character.

123 / 10 = 12
123 % 10 = 3
Take the 3, add '0' to it to get '3'
The only minor problem being that it gives you the digits in reverse order, but that shouldn't be that hard to solve.

Jeah in other words pul it all on Stack:) I used somthing simmilar:
First it writes message, then prints counter. Hers the code hope it helps someone, cheers

Print|Count proc far
push si
push ax

mov dx,offset message1
mov ah,09
int 21h

mov bx,10

mov si,2
mov ah,0
mov al,counter

Base10:

mov dx,0 ; zero devide
div bx
add dx,48
mov rez1+[si],dl;
dec si
cmp ax,0
jne Base10

mov dx,offset rez1
mov ah,09
int 21h

pop ax
pop si
ret
ispisbrojaca endp

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.