Solved programming problem

Find Min of an Array in Assembly.

Source code

org 100h

.model small

.stack 100h

.data

array dw 100,200,250,30,40,50,10,80

size dw 8

min dw ?

.code

main proc

mov dx,@data

mov ds,dx

lea si,array

mov dx,[si]

mov min,dx

mov cx,word ptr size ; convert size data as a value

L1:

   mov dx,[si]

   cmp min,dx

   jl  mindone  ;if min value greater than dx value

   jmp updatemin  ;if min value smaller than dx value

updatemin:

   mov min,dx ; update min value

mindone:

   add si,2  ; increment index

   loop L1

       

mov ah, 4ch

int 21h

endp

ret

Output

Output:
 

Join the discussion

Add your comment