Page 1 of 1

What went wrong?

Posted: Fri Mar 19, 2010 8:37 am
by quanganht
I have a piece of code...

Code: Select all

	lea     si, [kernelname]
        lea     di, [name2]

        mov ecx, 10

CmpStrs:
        cld
        repe    cmpsb
        jne     StrsNotEqual

	lea  si,[msg2]
	CALL print
	
	jmp $

StrsNotEqual:
	lea  si,[msg3]
	CALL print
	jmp $

msg2 DB "equal!",10,13,0
msg3 DB "not equal!",10,13,0
kernelname DB "kernel.bin"
name2 DB "kernel.bin"
Althought it is supposed to print "equal!", it just keeps print "not equal!". Can anybody point out the wrong part?

EDIT: can someone move this thread to the correct place?

Re: What went wrong?

Posted: Fri Mar 19, 2010 12:05 pm
by Gigasoft
A possible reason could be that ES does not point to the correct segment.

Re: What went wrong?

Posted: Fri Mar 19, 2010 4:35 pm
by bitshifter
les
lds

Re: What went wrong?

Posted: Fri Mar 19, 2010 4:37 pm
by Gigasoft
No, LES and LDS don't work that way.

Re: What went wrong?

Posted: Fri Mar 19, 2010 6:52 pm
by quanganht
yeah. I'll try clearing both ES and DS

EDIT: Worked