Logo 
Search:

Assembly Language Articles

Submit Article
Home » Articles » Assembly Language » Homework HelpRSS Feeds

Appli which separates odd and even numbers from given 10 8-bit data stored in memory locations and store in different array and add them individually

Posted By: Raynor Fischer     Category: Assembly Language     Views: 4243

Write an alp which separates odd and even numbers from given 10 8-bit data stored in memory locations and store in different array and add them individually.

Code for Appli which separates odd and even numbers from given 10 8-bit data stored in memory locations and store in different array and add them individually in Assembly Language

data segment
    value db 11h, 12h, 13h, 14h, 15h, 16h, 17h, 18h, 19h, 20h
    odd db 10 dup (?)
    even1 db 10 dup (?)
        total_o dw ?
        total_e dw ?
data ends

code segment
    assume cs:code, ds:data
begin:
    mov ax, data
    mov ds, ax

    mov es, ax
    lea si, value
    lea di, odd
        lea bx, even1

    mov cx, 09h
    mov dh, 02h    
           mov dl, 01h

counter:
        mov ah,0000h
        mov al, [si]
        div dh
        cmp ah, dl
        je store

        mov ah, [si]
        mov [bx], ah
        inc si
        inc bx
        dec cx
        jnz counter
        jmp total

store:
        mov ah, [si]
        mov [di], ah
    inc si
    inc di
    dec cx
    jnz counter

total:
        lea di, odd
        lea bx, even1
        mov cx, 09h

final_total:
        mov al, [di]
        mov ah, 0000h
        add total_o, ax
        mov al, [bx]
        mov ah, 0000h
        add total_e, ax
        inc di
        inc bx
        loop final_total

    mov ax, total_o
    mov cx, total_e

exit:
        mov ax, 4c00h
        int 21h

code ends
end begin
  
Share: 



Raynor Fischer
Raynor Fischer author of Appli which separates odd and even numbers from given 10 8-bit data stored in memory locations and store in different array and add them individually is from Frankfurt, Germany.
 
View All Articles

Related Articles and Code:


 

Other Interesting Articles in Assembly Language:


 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!