I use nasm. Say I want to have a loop and each loop add something to a buffer, here is the buffer:

buf: times 0ffh db 0

Here is the loop the loop:

xor al, al
mov edi, buf
theloop:
  cmp al, 0ffh
  je done
  inc al ; add 1 to al
  stosb ; put al into edi
  jmp theloop
done:
  ret

Between stosb and jmp theloop do I need to increment edi or not?

Yes, if your intention is to have 255 values spread out across the buffer.

Of course not. stosb increments EDI automatically.

commented: Good catch! +12

Good catch @nezachem. I was thinking too primitively.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.