Find the largest element in a block of data. The length of block is 0A H. Store the maximum value in memory location result. Use an Assembly Language Program for Intel 8086.

0 80

Find the largest element in a block of data. The length of block is 0A H. Store the maximum value in memory location result. Use an Assembly Language Program for Intel 8086.

Read More

 

title largest element in a block of data

dosseg

.model small

.stack 100H

.code

main proc

mov ax, @data ; initialize ds register

mov ds, ax

 

mov cx, OA H ; counter = 10

mov al, 00H ; assume the largest number is 00H

mov SI, offset array ; SI initialization

BACK:    cmp al, [SI] ; is next number > maximum

jnc AHEAD ; NC = 0

mov al, [SI] ; yes, replace maximum

AHEAD: inc SI

loop BACK

mov result, al ; move final result to al

 

mov ax, 4C00H ; return to DOS

int 21H

main endp

.data

array db 12, 13, 80, 14, ….. ; total 0A h variables

result db ?

end main

 

You might also like More from author

Leave a Reply

Font Resize