Ascending/Descending using 8086 Instructions


Arranging a given array in Ascending/Descending order

This program to arrange the given bytes in ascending/descending order using 8086 instructions.

Program:

NAME                   BYTESEARCH

TITLE                    8086 ALP FOR SEARCHING A BYTE IN AN ARRAY

DATA    SEGMENT

A DB 39H,78H,56H,47H

SIZ DB $-A

DATA    ENDS

CODE    SEGMENT

ASSUME CS:CODE, DS:DATA

START:  MOV AX,DATA

MOV DS,AX

MOV BX,SIZ

DEC BX

OUTLUP: MOV CX,BX

MOV SI,0H

INLOOP: MOV AL,A[SI]

INC SI

CMP AL,A[SI]

JB GO_ON                    (JA for Descending order)

XCHG AL,A[SI]

MOV A[SI-1],AL

GO_ON:  LOOP INLOOP

DEC BX

JNZ OUTLUP

INT 3

CODE    ENDS

END START

Advertisements

2 thoughts on “Ascending/Descending using 8086 Instructions

  1. I really appreciate Mr.Roy Antony Arnold.Welcome Sir,this is very helpful to me,today only i use this site but i am 100% satisfied.
    Good.
    Continue….

  2. i am taking this 8086 as 1 of my subject,,my lecturer ask me to solve this question,,can you help me by give the answers of this questions?
    calculate and displays the 3xN multiplication table for N = (0->12) using a loop structure .the output should show the results in both HEX and DECIMAL numbers and be formatted as follows:
    N 3xN(decimal) 3xN(hex)
    1 3 3
    2 6 6
    3 9 9
    .
    .
    .
    12 36 24

Comments are closed.