Logo 
Search:

Assembly Language Articles

Submit Article
Home » Articles » Assembly Language » Homework HelpRSS Feeds

Program to sort 8-bit numbers

Posted By: Adalfrid Fischer     Category: Assembly Language     Views: 5937

A Program to sort 8-bit numbers.

Code for Program to sort 8-bit numbers in Assembly Language

.MODEL  SMALL
    .DATA
            TABLE   DB      9,8,6,3,5,1
           VAL1    DB      5
            NL      DB     ' ','$'
    .CODE
    MAIN    PROC
         MOV AX,@DATA
            MOV DS,AX
            LEA BX,TABLE
                MOV DL,VAL1
    LBL1:
            LEA BX,TABLE
                      MOV CL,5
    LBL2:
            MOV AL,[BX]
           MOV DL,[BX+1]
          CMP AL,DL
          JB LBL3
          MOV [BX],DL
          MOV [BX+1],AL
    LBL3:
            INC BX
               LOOP LBL2
            MOV DL,VAL1
               DEC DL
            MOV VAL1,DL
              CMP DL,00
              JNE LBL1
                     MOV CL,6
            LEA BX,TABLE
    DISPLAY:
            LEA DX,NL
               MOV AH,09H
            INT 21H
            MOV DL,[BX]
              ADD DL,30H
              MOV AH,02H
            INT 21H
               INC BX
            LOOP DISPLAY
                        MOV AH,4CH
            INT 21H
    MAIN    ENDP
            END     MAIN

OUTPUT
***********
Z:\assembly\SYSTEM~1\AS2>ex07
 1 3 5 6 8 9
  
Share: 


Didn't find what you were looking for? Find more on Program to sort 8-bit numbers Or get search suggestion and latest updates.

Adalfrid Fischer
Adalfrid Fischer author of Program to sort 8-bit numbers is from Frankfurt, Germany.
 
View All Articles

 

Other Interesting Articles in Assembly Language:


 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
Siby Xavier from India Comment on: Apr 11
please check this link for sample programs
itsourtech.blogs...ot.in/.../...ith-8086_8654.html

View All Comments