P. 1
Bubble Sort 1

Bubble Sort 1

|Views: 13|Likes:

More info:

Published by: Muhammad Rana Farhan on Dec 26, 2009
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less

12/26/2009

pdf

text

original

Bubble Sort 1

============================================
.MODEL SMALL DATA_SEG SEGMENT 'DATA' ST1 DB 10,13,"Enter yr string.... ",'$' ST2 DB 100 DUP (?) ST3 DB 10,13,"String after sorting",10,13,'$' I DB (0) J DB (0) DATA_SEG ENDS CODE_SEG SEGMENT 'CODE' ASSUME CS:CODE_SEG,DS:DATA_SEG MAIN PROC FAR MOV AX,DATA_SEG MOV DS,AX MOV AH,09 MOV DX,OFFSET ST1 INT 21H MOV AH,0AH MOV ST2[0],97 MOV DX,OFFSET ST2 INT 21H MOV BL,ST2[1] MOV BH,0 MOV ST2[BX+2],'$' MOV AH,ST2[1] ADD AH,1 MOV AL,AH MOV MOV MOV MOV SI,2 DI,2 I,2 J,2

OUTER: MOV SI,2 MOV J,2 CMP I,AH JGE END_LOOP INC I INNER:

CMP J,AL JGE OUTER MOV BL,ST2[SI+1] CMP ST2[SI],BL JLE NEXT MOV BH,ST2[SI+1] MOV BL,ST2[SI] MOV ST2[SI],BH MOV ST2[SI+1],BL INC J INC SI JMP INNER NEXT: INC J INC SI JMP INNER END_LOOP:

MOV AH,09 MOV DX,OFFSET ST3 INT 21H MOV AH,09 MOV DX,OFFSET ST2[2] INT 21H MOV AH,4CH INT 21H MAIN ENDP CODE_SEG ENDS END MAIN

http://www.ravianeducation.blogspot.com
FARHAN: 03008855006

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->