prnstr macro msg
mov ah, 09h
lea dx, msg
int 21h
endm
data segment
buf1 db "Enter array elements : ", 0dh, 0ah, "Enter value as two
digit numbers. e.g. 03", 0dh, 0ah, '$'
array db 10
db 10 dup(0)
buf2 db 03
db 0
db 3 dup(' '), '$'
multiplier db 0ah
buf3 db 0ah, "Minimum value : $"
buf4 db 0ah, 2fh, " : $"
data ends
code segment
assume cs:code, ds:data
start :
mov ax, data
mov ds, ax
prnstr buf1
mov cx, 000ah
lea bx, array
mov di, 0001h
next :
mov si, offset buf4 + 1
inc byte ptr [si]
prnstr buf4
mov ah, 0ah
lea dx, buf2
int 21h
mov ax, 0000h
mov si, offset buf2 + 2
sub byte ptr [si], 30h
mov al, byte ptr [si]
inc si
sub byte ptr [si], 30h
mul multiplier
mov dx, 0000h
mov dl, byte ptr [si]
add al, byte ptr [si]
mov byte ptr [bx+di], al
inc di
loop next
mov ax, 0000h
mov cx, 0ah
mov di, 0001h
mov al, byte ptr [bx+di]
next1 :
cmp al, byte ptr [bx+di]
jb continue
mov al, byte ptr [bx+di]
continue :
inc di
loop next1
mov cx, 0000h
next2 :
cmp al, 0ah
jb outside
sub al, 0ah
inc cl
jmp next2
outside :
add al, 30h
add cl, 30h
mov byte ptr [si], al
mov byte ptr [si-1], cl
prnstr buf3
prnstr buf2+2
mov ax, 4c00h
int 21h
code ends
end start