Ask a Question

To sort n numbers in assending order..this is microprocessor programe..

on 2011-08-20 09:50:52   by Abhirup   on Computer Science & Engineering  1 answers

sanchayita

on 2011-08-20 09:30:00  

AIM: To write 8086 Assembly Language Program to sorting n-hexadecimal number in ascending order. MODEL SMALL .STACK 100 .DATA ; Data segment starts LIST DW 53H, 25H, 02H, 19H ; Array (list) containing 4 elements is initialized. COUNT EQU 04 ; Count is initialized to 4 .CODE ; Code segment starts START: MOV AX,@DATA ;Initialize the data segment MOV DS,AX MOV DX,COUNT-1 ;Move 03(count-1) to DX register LOOP0: MOV CX,DX ;Move the contents of DX to CX register MOV SI,OFFSET LIST ;Move the pointer variable of array(list) to SI LOOP1: MOV AX,[SI] ;Move the contents of array pointed by SI to AX register CMP AX,[SI+2] ;Compare the contents of array pointed by SI and SI+2 JL PR1 ; Transfers the control to PR1 if OF & SF are SET i.e. if 1st no