NASM - The Netwide Assembler

NASM Forum => Programming with NASM => Topic started by: zenid on March 18, 2012, 12:41:06 PM

Title: array length and etc
Post by: zenid on March 18, 2012, 12:41:06 PM
Hi.

How can i get length(how many elements) and size of an array?
Title: Re: array length and etc
Post by: Frank Kotler on March 18, 2012, 08:24:44 PM
Code: [Select]
msg "Hello Zenid", 10
msg_len equ $ - msg

array dd 5, -1, 10, 42
array_count equ ($ - array) / 4

Something like that?

Best,
Frank

Title: Re: array length and etc
Post by: zenid on March 18, 2012, 09:37:13 PM
It was what I asked for thanks!!!

Another quick question: can they be used anywhere or only in global variables(arrays)?
Title: Re: array length and etc
Post by: Frank Kotler on March 18, 2012, 09:46:37 PM
Mmmm, as opposed to what? Local/stack variables? I don't see how it would work for stack variables. Maybe I don't understand the question. When in doubt, try it!

Best,
Frank