Hello, I've been searching for something similar to my program, but with no luck. My problem is that I cannot finish my code. In short i must compare 2 strings and write mismatched symbols and their number from start.
For example if strings are:
113712
121118
the result should be something similar:
(first number is position)
2 1 : 2 or 2 : 1
3 3 : 1 3 : 3
4 7 : 1 4 : 7
6 2 : 8 6 : 2
I've managed to write a code, with result printed as everything :
1 1 : 1
2 1 : 2
3 3 : 1
and so on...
this is my code please tell me what i should change or change the wrong code.
...
proc main2 near
CLD
LEA si, bufferwithstring1
LEA di, bufferwithstring2
COMPARE:
CMP cx, 0
JE exit
REPE CMPSB
JE Skaityk
PUSH cx
write:
MOV ax, howmanysymbols
SUB ax, cx
CALL tostring
DEC si
DEC di
MOV al, [si]
MOV mismachedbuf1, al
MOV al, [di]
MOV mismachedbuf2, al
INC si ;
INC di
MOV ah, 9
LEA dx, resultbuf
INT 21h
JMP compare
endp main2
I've tried to compare with LODSB too and i managed to get the mismached symbols, but i can't get the positions of the numbers, so if possible you can write only the code which finds the positions of mismached symbols.