answersLogoWhite

0

LXI H,C000H //the length of the string is in C000 memory location//

MOV C,M

MVI E,00H

LOOP1: LXI H,C001H // string starts from C001 H //

MOV B,C

INX H

CMP M

JNC LOOP3

JZ LOOP3

MOV D,M

INR E // THIS IS TO CHECK WHETHER THE STRING IS ALREADY

SORTED OR NOT //

MOV M,A

DCX H

MOV M,D

INX H

LOOP3: DCR B

JNZ LOOP2

MOV A,E

SUI 00H

JZ LOOP4

DCR C

JNZ LOOP1

LOOP4: HLT

User Avatar

Wiki User

13y ago

Still curious? Ask our experts.

Chat with our AI personalities

EzraEzra
Faith is not about having all the answers, but learning to ask the right questions.
Chat with Ezra
RossRoss
Every question is just a happy little opportunity.
Chat with Ross
JordanJordan
Looking for a career mentor? I've seen my fair share of shake-ups.
Chat with Jordan
More answers

Thatz it !!!!! Sorting 6 numbers in memory starting from 0060H hex address (Selection sort algo) -------------------------

LXI H, 0060H

MVI B, 05H

LOOP1: MOV C, B

MOV D, H

MOV E, L

INR E

LOOP2: LDAX D

CMP M

JNC NO_SWP

SWAP: MOV D, M

MOV M, A

MOV A, D

MOV D, H

STAX D

NO_SWP: INR E

DCR C

JNZ LOOP2

INX H

DCR B

JNZ LOOP1

HLT

User Avatar

Wiki User

15y ago
User Avatar

code segment assume cs:code,ds:data mov ax,data mov ds,ax mov cx,n mov si,0000 outer : mov ax,arr[si] mov di,si sub di,2 inner : cmp di,00h jb over cmp ax,arr[di] jae over mov bx,arr[di] mov arr[di+2],bx sub di,2 jmp inner over : mov arr[di+2],ax add si,2 loop outer mov ah,4ch int 21h code ends data segment arr dw 0007h,0002h,0003h,0100h,0001h n dw 5 data ends end

User Avatar

Wiki User

11y ago
User Avatar

This is not a question, it's a project

User Avatar

Wiki User

11y ago
User Avatar

Add your answer:

Earn +20 pts
Q: Write 8085 program on selection sort algorithm?
Write your answer...
Submit
Still have questions?
magnify glass
imp