I would also like to suggest you make clear the term "variable". As Mathi and Frank assumed, a runtime variable can be declared more or less the same way as any other variable, by perpending %% to the label, you make the label local to the context of the macro. Another type of variable you might be referring to is a preprocessor variable. An example of that could be to use %assign or %define. The following example code might give you some info on preprocessor variables (designed for linux).
;; build with:
;; nasm -f elf intarray.asm
;; gcc -nostartfiles -o intarray intarray.o
%macro int_array 1
%push _int_array_
%assign %$index 0
%ifidni __SECT__,[SECTION .bss]
%define %$defint resd 1
%else
%define %$defint dd 0
%endif
%rep %1
.@%{$index}: %{$defint}
%assign %$index %{$index} + 1
%endrep
%pop
%endmacro
EXTERN printf
SECTION .data
strFormat: db "%d", 10, 0
myDataIntegers:
int_array 5
SECTION .bss
myBssIntegers:
int_array 11
SECTION .text
GLOBAL _start
_start:
xor eax, eax
mov [myDataIntegers.@0], eax
inc eax
mov [myDataIntegers.@1], eax
inc eax
mov [myDataIntegers.@2], eax
inc eax
mov [myDataIntegers.@3], eax
inc eax
mov [myDataIntegers.@4], eax
inc eax
mov [myBssIntegers.@0], eax
inc eax
mov [myBssIntegers.@1], eax
inc eax
mov [myBssIntegers.@2], eax
inc eax
mov [myBssIntegers.@3], eax
inc eax
mov [myBssIntegers.@4], eax
inc eax
mov [myBssIntegers.@5], eax
inc eax
mov [myBssIntegers.@6], eax
inc eax
mov [myBssIntegers.@7], eax
inc eax
mov [myBssIntegers.@8], eax
inc eax
mov [myBssIntegers.@9], eax
inc eax
mov [myBssIntegers.@10], eax
mov edi, myDataIntegers
mov ecx, 5
.@LoopFirst:
push ecx
push dword [edi]
push strFormat
call printf
add esp, 8
add edi, 4
pop ecx
dec ecx
or ecx, ecx
jnz .@LoopFirst
mov edi, myBssIntegers
mov ecx, 11
.@LoopSecond:
push ecx
push dword [edi]
push strFormat
call printf
add esp, 8
add edi, 4
pop ecx
dec ecx
or ecx, ecx
jnz .@LoopSecond
xor eax, eax
xor ebx, ebx
inc eax
int 0x80
Regards,
Bryant Keller