Professional Documents
Culture Documents
BC210210161 - CS401 - 1
BC210210161 - CS401 - 1
[org 0x0100]
jmp start
id: db 2,1,0,2,1,0,1,6,1
greater: db 0
subtractResult: db 0,0,0,0,0,0,0,0,0
sortResult: db 0,0,0,0,0,0,0,0,0
swap: db 0
start:
mov cx,9
mov bl,0
mov si,id
up:
cmp al, bl
jl next
mov bl, al
next:
inc si
dec cx
jnz up
mov [greater], bl
mov si, id
mov di, 0
mov cx, 9
subroutine:
sub bl, al
inc si
inc di
loop subroutine
sort:
mov cx, 9
outer_loop:
mov si, bx
inner_loop:
jbe no_swap
mov [si], dl
inc si
loop inner_loop
jne sorted
dec cx
jnz outer_loop
sorted:
mov dx, 9
print_sorted:
int 21h
inc si
loop print_sorted
exit:
int 21h