-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathBSORT.asm
More file actions
executable file
·54 lines (45 loc) · 924 Bytes
/
BSORT.asm
File metadata and controls
executable file
·54 lines (45 loc) · 924 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
;BSORT.asm
;Shoaib Ahmed
;11.9.15
;Implementing Bubble Sort
assume cs:code,ds:data
data segment
x db 5h,2h,3h,4h,1h
n dw (n-x)
data ends
code segment
start: MOV ax,data
MOV ds,ax
MOV bx,n
DEC bx
NEXT: MOV cx,bx
MOV ah,0
LEA si,x
NXTCMP: MOV al,[si]
CMP al,[si+1]
JBE DONOT
XCHG al,[si+1]
XCHG [si],al
MOV ah,1
DONOT: INC si
LOOP NXTCMP
CMP ah,0
JE FINISH
DEC bx
JNZ NEXT
DISP: LEA si,x
MOV cx,n
RPT: MOV bx,[si]
ADD bx,30h
MOV dx,bx
MOV ah,2h
INT 21h
MOV dx,','
MOV ah,2h
INT 21h
INC si
LOOP RPT
FINISH: MOV ah,4ch
INT 21h
code ends
end start