Assembly Language Forum

Ask Question   UnAnswered
Home » Forum » Assembly Language       RSS Feeds

Issue with string comparison

  Asked By: Gadge    Date: Nov 28    Category: Assembly Language    Views: 5795

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:
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
LEA si, bufferwithstring1
LEA di, bufferwithstring2

CMP cx, 0
JE exit
JE Skaityk
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.



No Answers Found. Be the First, To Post Answer.

Didn't find what you were looking for? Find more on Issue with string comparison Or get search suggestion and latest updates.