36 Program to find largest number from array in 8086 MicroProcessor

Code:

; PROGRAM TO FIND LARGEST FROM ARRAY
.MODEL SMALL
.STACK 100H
.DATA
  ARR DB 04H,05H,09H,02H,06H
  LAR DB ?

.CODE
  MOV AX , @DATA ; INITIALIZING DATA SEGMENT
  MOV DS , AX

  MOV CX , 5   ; INITIALIZING LOOP COUNTER

  MOV SI , OFFSET ARR ;LOADING BASE ADDRESS OF ARR

  MOV AL , [SI]

UP:
  INC SI     
  CMP AL , [SI]

  JNC NEXT
    MOV AL , [SI]
    LOOP UP
NEXT:
   LOOP UP

  MOV LAR , AL

  MOV DL , AL
  ADD DL , 48
  MOV AH ,2
  INT 21H

  MOV AH , 4CH  ; INTRUPT FOR EXIT
  INT 21H
END
         


Ouput:


Previous
Next Post »