forked from mohitarora3/assembly_programs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbubble_sort.asm
More file actions
53 lines (34 loc) · 1.04 KB
/
bubble_sort.asm
File metadata and controls
53 lines (34 loc) · 1.04 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
data segment
array db 5,4,3,2,1,9,100,78,0
size dw 9
data ends
code segment
assume ds:data, cs:code
start:
mov ax,data
mov ds,ax
mov cx,size
dec cx
l1:
push cx
mov si,0
mov di,1
dec word ptr size
cmp size,0
je end
mov cx,size
l2:
mov al,array[si]
cmp al,array[di]
jle next
mov al,array[si]
xchg al,array[di]
mov array[si],al
next: inc si
inc di
loop l2
pop cx
loop l1
end:hlt
code ends
end start