i guess the main advantage is, it's easier to read :)
the cost is - you push/pop EBX (or ESI or EDI) at entry and exit
which is ok - it replaces a push/pop on ECX - so no cost, really
arralloc proc uses ebx mcnt:DWORD
; ----------------------------------------------------------------
; return values = handle of pointer array or 0 on allocation error
; ----------------------------------------------------------------
mov ebx, mcnt ; load the member count into EBX
lea eax, [ebx*4+4] ; correct for 1 based array, multiply it by 4 for memory size
invoke GlobalAlloc,GMEM_FIXED,eax
test eax, eax ; if allocation failure return zero
jz quit
mov DWORD PTR [eax], ebx ; write count to 1st member
@@:
mov [eax+ebx*4], OFFSET d_e_f_a_u_l_t__n_u_l_l_$
dec ebx
ja @B
; return pointer array handle
quit:
ret
arralloc endp