Reputation: 41
I just started learning ASM, I have C experience but I guess it doesn't matter. Anyway how can I initialize a 12 elements array of DT to 0s, and how not to initialize it?
I use FASM.
Upvotes: 4
Views: 2933
Reputation:
Since arrays are just a contiguous chunk of memory with elements one after the other, you can do something like this in NASM (not sure if FASM supports the times
directive, but you could try):
my_array:
times 12 dt 0.0
That is expanded out when your source is assembled to:
my_array:
dt 0.0
dt 0.0
dt 0.0
dt 0.0
dt 0.0
dt 0.0
dt 0.0
dt 0.0
dt 0.0
dt 0.0
dt 0.0
dt 0.0
Upvotes: 1
Reputation: 5648
Just use the reserve data directive and reserve 12 tbytes:
array: rt 12
Upvotes: 0