0

I have a problem with assembly task.

Write a program that will write the numbers 7-15 in the data segment, starting from offset 200h, and then using a loop and compare them to read data from memory and the DX will insert the sum of numbers divisible by four

Here is my code, and isn't work. I'm begginer in assembly language. Could someone help me .Please

mov ax,data
mov ds,ax
mov cl,07d 
mov ch,015d
mov [bx],200h

ciklus:
mov [bx] ,cl
inc cl
inc bx
cmp cl,ch
jne ciklus

ciklus1:
mov cl,[bx]

AND ax, 3h
add dx, ax
inc cl
inc bx 
else
jmp ciklus1
end if
2
Contributors
2
Replies
3
Views
5 Years
Discussion Span
Last Post by kikiritce
1

This should work:

mov     cl,07d
        mov     ch,015d
        mov     ebx,200h

        mov     eax,0
ciklus:
        mov     [ebx],cl
        inc     cl
        inc     ebx
        inc     eax
        cmp     cl,ch
        jle     ciklus

        mov     ebx,200h
        mov     ecx,eax
        mov     dx,0
ciklus1:
        test    byte [ebx],3h
        jnz     msk
        mov     ax,0
        mov     al,[ebx]
        add     dx,ax
msk:
        inc     ebx
        loop    ciklus1

.

Votes + Comments
excelent
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.