hello, i need something... how can i create/use arrays in fasm?
Posted on 2003-09-18 07:05:49 by frk
to create an byte array:


method 1:
fooBar rb 100h
method 2:
fooBar times 100h db 0 ; refer to fasm.txt/pdf section 2.2.1 ("Repeating blocks of instructions").

accessing them:
where ecx is the index of the array item/vector:
mov al, [fooBar+ecx] ; get "fooBar[ecx]" and put it in al
mov [fooBar+ecx], ah ; mov ah to "fooBar[ecx]"
or (if you want to use registers)
mov ebx, fooBar
mov al, [ebx+ecx]
mov [ebx+ecx], ah
Posted on 2003-09-18 10:53:55 by scientica
Your method 2 won't work, as "times" is not a data directive, so it can't have label attached this way.
method 2a:
fooBar: times 100h db 0
method 2b:
label fooBar byte
times 100h db 0
Posted on 2003-09-18 15:30:36 by Tomasz Grysztar
:o one ":" here or there does it matter? ;)
:stupid:
maybe the fasm doc shoud contain a simple example on arrays?
Posted on 2003-09-18 23:45:13 by scientica
Thank you scientica, it works perfectly, but Privalov can you please fix the arrays in fasm like:
Ex. a[100] db ?

:alright:
Posted on 2003-09-19 12:13:28 by frk
Would it be really essential for you?
Posted on 2003-09-19 15:38:38 by Tomasz Grysztar