John
John

Reputation: 11

Setting loop counter in Nasm assembly language

How do i tell the loop to loop x amount of times. For example loop 10 times. At the moment it loops only twice.

loop: 
    mov eax, 4
    mov ebx, 1
    mov ecx, ask
    mov edx, askLength
    int 0x80

    mov eax, 3
    mov ebx, 1
    mov ecx, edi
    mov edx, 3
    int 0x80

    add edi, 3; Loop change

    cmp edi, input+6 ;
    jl loop  ; Loop again

Upvotes: 1

Views: 2317

Answers (1)

ughoavgfhw
ughoavgfhw

Reputation: 39905

It compares edi to input+6 and adds 3 each time. 6/3=2. You need to change the cmp edi, input+X line appropriately, but it appears this is a buffer, so make sure it is big enough to hold the amount of data you are retrieving.

Upvotes: 2

Related Questions