[org 0x0100]
02
03 jmp start
04
05 message1: dw 'abcdefg',0
06
07 message2: dw 'def',0
08
09 strlength:
10
11 push bp
12 push bp,sp
13 push ax
14 push di
15 push es
16 push ds
17 xor al,al
18
19
20 les di,[bp+4]
21 mov cx, 0xffff
22 xor al,al
23 repne SCAS
24 mov ax, 0xffff
25 sub ax, cx
26 dec ax
27 mov cx, ax
28
29 pop ds
30 pop es
31 pop di
32 pop ax
33 pop bp
34
35
36
37 start:
38
39 mov ax, message1
40 push ax
41 mov ax, message2
42 push ax
43 call strlength
44
45 CompareString:
46
47 push cx
48
49 lds si, [bp+2]
50 les di, [bp+4]
51 repne CMPS
52 dec di
53 dec si
54 cmp si,0
55 je exit
56 mov ax,1
57
58 pop cx
59
60 SubstringCompare:
61
62 repe CMPS
63 cmp cx,0
64 jne exit
65 mov ax,1
66
67 exit:
68 mov ax,0
69 mov ax, 0x4c00
70 int 0x21