assume cs:code,ds:data
data segment
org 2000h
series db 81h,82h,93h,95h,10h,56h,33h,99h,13h,44h
count dw 10d
data ends
code segment
start:mov ax,data
mov ds,ax
mov dx,count
dec dx
go:mov cx,dx
lea si,series
nxt_byte:mov al,[si]
cmp al,[si+1]
jl next
xchg al,[si+1]
xchg al,[si]
next:inc si
loop nxt_byte
dec dx
jnz go
mov ah,4ch
int 21h
code ends
end start
data segment
org 2000h
series db 81h,82h,93h,95h,10h,56h,33h,99h,13h,44h
count dw 10d
data ends
code segment
start:mov ax,data
mov ds,ax
mov dx,count
dec dx
go:mov cx,dx
lea si,series
nxt_byte:mov al,[si]
cmp al,[si+1]
jl next
xchg al,[si+1]
xchg al,[si]
next:inc si
loop nxt_byte
dec dx
jnz go
mov ah,4ch
int 21h
code ends
end start
Sort array of ten numbers without procedures..
ReplyDeleteRgrds
START:
MOV CX,9
LEA SI,ARRAY
LABEL2:
MOV AL,[SI]
CMP AL,[SI+1]
JLE LABEL1
MOV AH,[SI+1]
MOV B.[SI],AH
MOV B.[SI+1],AL
JMP START
LABEL1:
INC SI
LOOP LABEL2
RET
ARRAY DB 10,9,1,2,5,4,7,6,3,8