Home arrow 8086 Assembly Programs arrow Sort 5 numbers in RAM Friday, 05 December 2008
Home
- - - - - - -
Contact me!
My Blog!
- - - - - - -
- - - - - - -
8086 Assembly Programs
Graphics
Java Servlets
Prolog
VHDL
- - - - - - -
Ubuntu Linux
- - - - - - -
Links
Statistics
Visitors: 43311

   
Sort 5 numbers in RAM
Written by Rohit   
Monday, 10 April 2006
  1. .model small
  2. .data
  3.     array db 0,2,5,3,1
  4. .code
  5. main proc far
  6.     mov ax, @data
  7.     mov ds, ax
  8.     mov cx, 0005h
  9. l1:    mov bx, cx
  10. l2:    mov al, array[bx]
  11.     cmp al, array[bx+1]
  12.     jb next
  13.     mov ah, array[bx+1]
  14.     mov array[bx+1], al
  15.     mov array[bx], ah
  16. next: dec bx
  17.     jnz l2
  18.     dec cx
  19.     jnz l1
  20.     mov ax, 4c00h
  21.     int 21h
  22. main endp
  23. end main
 
< Prev   Next >

 

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.