data segment
arr dw 1111h,2222h,3333h,4444h,5555h
data ends
code segment
assume cs:code,ds:data
start:
mov ax,data
mov ds,ax
mov cx,04h
lea si,arr
mov ax,[si]
up:
cmp ax,[si+2]
jc down
mov ax,[si+2]
down:
inc si
inc si
dec cx
jnz up
int 03h
code ends
end start
arr dw 1111h,2222h,3333h,4444h,5555h
data ends
code segment
assume cs:code,ds:data
start:
mov ax,data
mov ds,ax
mov cx,04h
lea si,arr
mov ax,[si]
up:
cmp ax,[si+2]
jc down
mov ax,[si+2]
down:
inc si
inc si
dec cx
jnz up
int 03h
code ends
end start
No comments:
Post a Comment