Talk:X86 Disassembly/Loop Examples

For the first example, is the 'add ebx, 4' line a mistake? ebx is multiplied by 4 in the offset and compared to 100 for a 100 element array, so it seems only the inc is needed.

push ebp mov ebp, esp mov esi, [ebp + 8] mov ebx, 0 mov eax, 0 mov ecx, 0 _Label_1: mov ecx, [esi + ebx * 4] add eax, ecx add ebx, 4               ; remove? inc ebx cmp ebx, 100 jne _Label_1 mov esp, ebp pop ebp ret 4