Hi,

i need to compare 2 strings in ASM... one of the string has been input in the buffer using DOS function codes..AH = 0Ah and Int 21h...

the following code asks the user to input a string and displays the entered string back to the user. Then, i need to compare the input string to a predefined string and jump to certain labels accordingly... ie if the input string is "HI", then print label should be executed else the program should terminate.

the problem is that even when the input string is HI, tthe print label is not getting executed.
i m using an emulator 8086 to run the code....


Kindly assist me...

org 100h

.data

OurBuff db 00h, 00h
FirstS db 13, 10, "Please Enter a String: $"
SecondS db 13, 10, "Entered String was: $"
Success db 13, 10, "Success!!$"

.code

mov ax, @DATA
mov ds, ax

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

mov bx, offset OurBuff
mov dx, bx
mov byte , 33

mov ah, 0Ah
int 21h

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

;mov bx, offset OurBuff
mov al,
add al, 02h
xor ah, ah

mov si, ax
mov byte , '$'

mov dx, offset OurBuff
add dx, 02h
mov ah, 09h
int 21h

mov ax, dx
cmp ax, "HI"
jne exit

print:
mov dx, offset Success
mov ah, 09h
int 21h
jmp exit

exit:
ret





thank you...
Posted on 2008-06-05 15:35:11 by ChipDale
First: Your parameters for the call to INT 21-0A are wrong. Read the DOS manual.
Second: In the last part of your code you are trying to compare a pointer with a string. That can't be done.
Posted on 2008-06-08 19:43:53 by TasmDev
I wish Spook would make it impossible to use the word "urgent" in a topic title.
Posted on 2008-06-08 19:56:47 by JimmyClif

I wish Spook would make it impossible to use the word "urgent" in a topic title.


Would be nice. However, post editing does the job as well ;)
Posted on 2008-06-08 20:49:35 by SpooK