-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathsubstring.asm
More file actions
73 lines (64 loc) · 1.38 KB
/
substring.asm
File metadata and controls
73 lines (64 loc) · 1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
.model small
.stack
print macro p
lea dx,p
mov ah,09h
int 21h
endm
.data
m1 db 0ah,0dh,"Enter the String:$"
m2 db 0ah,0dh,"Enter the Substring:$"
m3 db 0ah,0dh,"String Found$"
m4 db 0ah,0dh,"String not Found$"
a db 20h dup("$");
b db 20h dup("$");
k dw 0
f db 0
.code
mov ax,@data
mov ds,ax
mov es,ax
mov si,0000h
mov di,0000h
print m1
loop1: mov ah,01h
int 21h
mov a[si],al
inc si
inc k
cmp al,0dh
jne loop1
print m2
loop2: mov ah,01h
int 21h
mov b[di],al
inc di
inc cl
cmp al,0dh
jne loop2
mov f,cl
mov si,0000h
mov di,0000h
mov ax,0000h
loop3: mov bh,a[si]
mov bl,b[di]
inc si
inc di
cmp bh,bl
jne l1
loop loop3
jmp l2
l1: inc ax
mov si,ax
mov cl,f
mov di,0000h
mov bx,k
cmp ax,bx
jl loop3
jmp l3
l2: print m3
jmp l4
l3: print m4
l4: mov ah,4ch
int 21h
end