0% found this document useful (0 votes)
30 views2 pages

Assembly Language Sorting Debug

This program sorts an array of numbers in ascending order and displays the results in debug mode. It loads the data segment, initializes a counter, and uses a nested loop to compare and swap adjacent elements if out of order. After sorting, it displays the results by calling the debug interrupt and exiting the program.

Uploaded by

Rohan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views2 pages

Assembly Language Sorting Debug

This program sorts an array of numbers in ascending order and displays the results in debug mode. It loads the data segment, initializes a counter, and uses a nested loop to compare and swap adjacent elements if out of order. After sorting, it displays the results by calling the debug interrupt and exiting the program.

Uploaded by

Rohan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

PROGRAM TO SORT NUMBERS AND TO EXECUTE AND

DISPLAY THE RESULT IN DEBUG MODE

DATA SEGMENT
STRING1 DB 40H,10H, 50H, 20H, 99H,12H,56H,45H,36H
DATA ENDS

CODE S EGMENT
ASSUME CS:CODE,DS:DATA
START: MOV AX,DATA
MOV DS,AX

MOV CH,08H

UP2: MOV CL,08H


LEA SI,STRING1

UP1: MOV AL,[SI]


MOV BL,[SI+1]
CMP AL,BL
JC DOWN
MOV DL,[SI+1]
XCHG [SI],DL
MOV [SI+1],DL

DOWN: INC SI
DEC CL
JNZ UP1
DEC CH
JNZ UP2

QUIT: MOV AL,0


MOV AH,04CH
INT 21H
CODE ENDS
END START

\TASM>debug AMPE10.exe
-g

AX=1456 BX=0099 CX=0000


DX=0045 SP=0000 BP=0000
SI=0004 DI=0000
DS=14A4 ES=1494 SS=14A4
CS=14A5 IP=0027 NV UP EI PL
ZR NA PE CY
14A5:0027 CC
INT 3
-d 14A4:0000

You might also like