CHAPTER 18. ARRAYS CHAPTER 18. ARRAYS
mov edx, DWORD PTR _i$[ebp]
mov DWORD PTR _a$[ebp+edx4], ecx
jmp SHORT $LN5@main
$LN4@main:
mov DWORD PTR _i$[ebp], 0
jmp SHORT $LN3@main
$LN2@main:
mov eax, DWORD PTR _i$[ebp]
add eax, 1
mov DWORD PTR _i$[ebp], eax
$LN3@main:
cmp DWORD PTR _i$[ebp], 20 ; 00000014H
jge SHORT $LN1@main
mov ecx, DWORD PTR _i$[ebp]
mov edx, DWORD PTR _a$[ebp+ecx4]
push edx
mov eax, DWORD PTR _i$[ebp]
push eax
push OFFSET $SG2463
call _printf
add esp, 12 ; 0000000cH
jmp SHORT $LN2@main
$LN1@main:
xor eax, eax
mov esp, ebp
pop ebp
ret 0
_main ENDP
Nothing very special, just two loops: the first is a filling loop and second is a printing loop. Theshl ecx, 1instruction is
used for value multiplication by 2 inECX, more about below16.2.1 on page 204.
80 bytes are allocated on the stack for the array, 20 elements of 4 bytes.