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