flat assembler
Message board for the users of flat assembler.

Index > Main > Array

Author
Thread Post new topic Reply to topic
heizzpep



Joined: 03 Jul 2012
Posts: 4
heizzpep 30 Jul 2012, 19:03
How to declare some like this:
Code:
C#
char var[500];    

in fasm?
Post 30 Jul 2012, 19:03
View user's profile Send private message Reply with quote
AsmGuru62



Joined: 28 Jan 2004
Posts: 1694
Location: Toronto, Canada
AsmGuru62 30 Jul 2012, 19:14
Code:
var rb 500    
Post 30 Jul 2012, 19:14
View user's profile Send private message Send e-mail Reply with quote
heizzpep



Joined: 03 Jul 2012
Posts: 4
heizzpep 30 Jul 2012, 19:15
Thx!
Post 30 Jul 2012, 19:15
View user's profile Send private message Reply with quote
typedef



Joined: 25 Jul 2010
Posts: 2909
Location: 0x77760000
typedef 30 Jul 2012, 21:36
or if you want to initialize the array with 0 etc.

Code:
var db 500 dup(0)
    
Post 30 Jul 2012, 21:36
View user's profile Send private message Reply with quote
Mac2004



Joined: 15 Dec 2003
Posts: 314
Mac2004 02 Aug 2012, 14:39
You can also use times directive:

Code:
var: times 500 db 0
    


Regards
Mac2004
Post 02 Aug 2012, 14:39
View user's profile Send private message Reply with quote
heizzpep



Joined: 03 Jul 2012
Posts: 4
heizzpep 08 Aug 2012, 13:58
thx @Mac2004 & typedef.
Quote:
var: times 500 db 0


how i can use times with structs?
for example:

Code:
struct S
  a db 0
  b db 0
  c db 0
ends
S1 S
S2 S
S3 S
    


SS: times 50 S
give error
Code:
Error: illegal instruction.    
Post 08 Aug 2012, 13:58
View user's profile Send private message Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3499
Location: Bulgaria
JohnFound 08 Aug 2012, 16:09
Everything is byte:
Code:
        SS rb 50*sizeof.S    
Post 08 Aug 2012, 16:09
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
baldr



Joined: 19 Mar 2008
Posts: 1651
baldr 09 Aug 2012, 02:57
heizzpep,

You can redefine times as macro (it doesn't work in your case because it's assembler directive, and structs are macros indeed).

There was thread about similar problem.
Post 09 Aug 2012, 02:57
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8367
Location: Kraków, Poland
Tomasz Grysztar 09 Aug 2012, 07:55
baldr wrote:
There was thread about similar problem.
Also, even earlier there already was a question in primary fasm's FAQ about such problem. It really was one of the most frequently asked ones.
Post 09 Aug 2012, 07:55
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.