The following will do it:
xor ch,ch ;clear ch
lea di, instring
mov cl, [ di + 1 ] ;cx = length of string
mov di,ds
mov es,di ;es -> data segment
lea di, outstring ;es:di -> output string
mov si, offset instring + 2 ;ds:si -> input string
repe cmpsb ;compare strings (abort as soon as two
;characters fail to match)
je ;jump to relevant code if strings are the same
For the CMPSB instruction, cx = number of bytes to compare, es:di -> one string, ds:si -> the other string, REPE means continue to compare bytes while they are equal; abort as soon as they are not. REPNE would mean continue to compare bytes while they are not equal, abort as soon as they are. There is a similar instruction CMPSW for comparing words, and also in similar vein are:
movsb/mosw
stosb/stosw
lodsb/lodsw ;always used to load single byte/word into al/ax