Skip to content

Instantly share code, notes, and snippets.

@Karl-Han
Created April 15, 2019 14:19
Show Gist options
  • Save Karl-Han/4e28f60d9d5a15eae5bfe9f7725cf38a to your computer and use it in GitHub Desktop.
Save Karl-Han/4e28f60d9d5a15eae5bfe9f7725cf38a to your computer and use it in GitHub Desktop.
data segment
array db 1,-2,8,-23,-24,76,-98,123,25,82
sizeArr db 10
bmax db ?
bmin db ?
data ends
stack1 segment para stack
dw 20h dup(0)
stack1 ends
code segment
assume cs:code,ds:data,ss:stack1
start:
mov ax, data
mov ds, ax
mov cl, sizeArr
xor ch, ch
mov si, offset array
mov bl, 80h ;bmax
mov bh, 7fh ;bmin
max:
cmp bl, [si]
jg min
mov bl, [si]
jmp next
min:
cmp bh, [si]
jl next ;bmin < array[]
mov bh, [si]
jmp next
next:
inc si
loop max
mov bmax, bl
mov bmin, bh
mov ah, 4ch
int 21h
code ends
end start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment