flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > Declaring Structure Variables Problem ?

Author
Thread Post new topic Reply to topic
desert_punk



Joined: 04 Apr 2010
Posts: 3
desert_punk 04 Apr 2010, 21:49
I have this code in MASM

StructureName struc

x dw ?
y dw ?
life dw ?
color dw ?
direc dw ?

StructureName ends

PlayerShot TShot <0,0,0,1,-4>

I tried to write this in FASM but i failed HELP!
Post 04 Apr 2010, 21:49
View user's profile Send private message Reply with quote
Tyler



Joined: 19 Nov 2009
Posts: 1216
Location: NC, USA
Tyler 04 Apr 2010, 21:58
http://flatassembler.net/docs.php?article=manual#2.3.4
Code:
struc StructureName
{
.x dw ?
.y dw ?
.life dw ?
.color dw ?
.direc dw ?
}
    

I think the ?s are okay, I don't every use them. It assembles/compiles okay.
Post 04 Apr 2010, 21:58
View user's profile Send private message Reply with quote
desert_punk



Joined: 04 Apr 2010
Posts: 3
desert_punk 04 Apr 2010, 22:03
but i want to add the structure variables

PlayerShot structureName <0,0,0,1,-4> ; sorry now it good

how can i do that?
Post 04 Apr 2010, 22:03
View user's profile Send private message Reply with quote
Tyler



Joined: 19 Nov 2009
Posts: 1216
Location: NC, USA
Tyler 04 Apr 2010, 22:42
Code:
 struc StructureName x,y,life,color,direc ; You can rearrange the order if you want to pass the values in a different order
{
.x dw ?
.y dw ?
.life dw ?
.color dw ?
.direc dw ?
}

PlayerShot StructureName 0,0,0,1,-4    
    
Post 04 Apr 2010, 22:42
View user's profile Send private message Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4624
Location: Argentina
LocoDelAssembly 04 Apr 2010, 23:54
If you will program on Windows (but if not you could always copy the include files), you can also use the "struct" macro included in the package: http://flatassembler.net/docs.php?article=win32
Post 04 Apr 2010, 23:54
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20518
Location: In your JS exploiting you and your system
revolution 05 Apr 2010, 02:10
Tyler: You are almost there:
Code:
struc StructureName x,y,life,color,direc
{
.x dw x
.y dw y
.life dw life
.color dw color
.direc dw direc
}
PlayerShot StructureName 0,0,0,1,-4    
Post 05 Apr 2010, 02:10
View user's profile Send private message Visit poster's website Reply with quote
desert_punk



Joined: 04 Apr 2010
Posts: 3
desert_punk 05 Apr 2010, 08:30
Thanks guys it worked ! Very Happy I'M VERY HAPPY I TRIED TO DO IT BY MYSELF FOR DAYS
---------------------------------------------------------------------------
I got another question. How do i write this in FASM ?

MAXINVAD equ 4

InvadShot StructureName MAXINVAD dup(<0,0,0,4,4>) ; <------


Last edited by desert_punk on 05 Apr 2010, 08:43; edited 2 times in total
Post 05 Apr 2010, 08:30
View user's profile Send private message Reply with quote
baldr



Joined: 19 Mar 2008
Posts: 1651
baldr 09 Apr 2010, 19:40
desert_punk,

You may take a look at Array of structs in a struct topic.
Post 09 Apr 2010, 19:40
View user's profile Send private message 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.