46 Program to find count of positive number from array in 8086 Microprocessor

Code:

; Program to find count of positive number from array
.MODEL SMALL
.STACK 100H
.DATA
   ARR   DW 10H , -12H , 1H , -5H , -4H
   COUNT DB 0
.CODE
   MOV AX , @DATA  ; Initializing Data Segment
   MOV DS , AX

   MOV CX , 5           ; Initializing loop counter
   MOV SI , OFFSET ARR  ; Initalizing array offset

 NEXT:
    MOV AX , [SI]
    ROL AX , 1          ; Rotate left by 1 bit
    JC DN               ; Jump if Carry i.e Negative
     INC COUNT          ; If positive Increment count
  DN:
     ADD SI , 2
     LOOP NEXT          ; Decrement CX if CX==0 then Stop

   MOV DL , COUNT

   MOV AH , 4CH    ; Service routine for exit
   INT 21H
END






Ouput:


Program to find count of positive number from array in 8086 Microprocessor

Previous
Next Post »