If you'll satisfy with an example for Windows, see the following program in EuroAssembler. It creates 3128 bytes long AllocArray.exe which will reserve and initialize the requested size in BSS section.
AllocArray PROGRAM Format=PE, IconFile=, Entry=Main: INCLUDE winapi.htm, cpuext32.htm %MaxPossibleLength %SETA 1_000_000 ; Specify the maximal acceptable allocation here. [.text] Main: StdOutput ="Enter the size of the array (1..%MaxPossibleLength): " StdInput EnterredLength ; Let the user to set array length. LodD EnterredLength ; Convert the enterred decimal number to integer in EAX. CMP EAX,%MaxPossibleLength JA Main: MOV [LengthOfTheArray],EAX StoD AllocatedLength ; Convert the integer EAX to decimal. XOR EAX,EAX STOSB ; Zero-terminate the decimal number. MOV EDI,TheArray: MOV ECX,[LengthOfTheArray] MOV EAX,0x5A5A5A5A REP STOSD ; Initialize the array with 5A. StdOutput ="The array of ", AllocatedLength, =" DWORDs is now allocated statically." TerminateProgram [.bss] EnterredLength: DB 16 * BYTE AllocatedLength: DB 16 * BYTE LengthOfTheArray: DD DWORD TheArray: DD %MaxPossibleLength * DWORD ENDPROGRAM AllocArray