Sorry if this seems like a beginner question to some, but I want an easy way to compare a string in code space to a certain value without using extra segment registers. I'm doing this because I made my own DOS interrupt routine and I tacked on a string so a client program can identify it as the correct interrupt before calling it.
This is what I have so far:
;interrupt handler routine that's already loaded earlier in DOS as a .com file:
db 'INTERUPT' ;8 bytes
myinterrupt:
;Do interrupt function here....
iret
;And for the main routine that is loaded later and
interrupt_check:
mov CX,0h ;CX=interrupt status. 1=installed
mov AL,77h ;Assume int 77h points to our code above
mov AH,35h
int 21h ;ES:BX=handler
cmp BX,08h ;Make sure theres at least 8 characters in offset before entry point
jl notinstalled
push ES
pop DS
push BX
pop SI
sub SI,08h ;We make DS:SI = ES:BX minus 8 bytes
lodsd ;get first 4 letters of 8 in string
cmp EAX,'INTE'
jne notinstalled
lodsd ;get last 4 letters of 8 in string
cmp EAX,'RUPT'
jne notinstalled
mov CX,1h ;here all letters match
notinstalled:
ret
I'm not sure if the characters are incorrect because the byte-ordering messes me up. Maybe I need:
cmp EAX,'TEIN'
and
cmp EAX,'PTRU'
instead?
Please let me know which way the letters go when scanning for them. Thanks.