-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathlinear_search.asm
More file actions
39 lines (35 loc) · 772 Bytes
/
linear_search.asm
File metadata and controls
39 lines (35 loc) · 772 Bytes
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
;###################################################################
;## Assembly program to perform linear search among 16-bit numbers
;## Author : euhidaman
;###################################################################
.model small
.data
ARR dw 1000h, 2500h, 8500h, 3000h, 9500h
LEN db ($-ARR)/2
MSG1 db "FOUND$"
MSG2 db "NOT FOUND$"
SE dw 2000h
PRINT MACRO MESSAGE
MOV AH,09h
LEA DX, MESSAGE
int 21h
ENDM
.code
MOV AX, @DATA
MOV DS,AX
MOV AX,SE
LEA SI, ARR
MOV CL,LEN
UP: MOV BX, [SI]
CMP AX, BX
JE FND
INC SI
INC SI
DEC CX
JNZ UP
PRINT MSG2
JMP exit
FND: PRINT MSG1
exit: MOV AH, 4CH
INT 21h
end