Write an ALP to separate odd and even numbers from an array of N numbers; arrange odd
numbers in address 2000h, even numbers in address 3000h using 8086

Respuesta :

Below is the program to separate odd and even numbers                                  

Explanation:

L1:

         mov ah,00

         mov al,[BX]

         mov dl,al

         div dh

         cmp ah,00

         je EVEN1

         mov [DI],dl

         add OddAdd,dl

         INC DI

         INC BX

         Loop L1

         jmp CAL

    EVEN1:

         mov [SI],dl

         add Even Add,dl

         INC SI

         INC BX

         Loop L1

    CAL:    

         mov ax,0000

         mov bx,0000

         mov al,OddAdd

         mov bl,EvenAdd

         MOV  ax,4C00h

         int 21h

end

The above program separates odd and even numbers from the array using 8086 microprocessor. It has odd numbers in 2000h and even numbers in 3000h.