flat assembler
Message board for the users of flat assembler.

Index > Main > Reserve memory for multiple variables in one line.

Author
Thread Post new topic Reply to topic
3D_FASM



Joined: 11 May 2023
Posts: 24
3D_FASM 12 May 2023, 13:02
For eaxmple write this to one string:

Code:
    r dd 0
    g dd 0
    b dd 0    


Is in FASM something like this?

Code:
r, g, b dd 0    


Or maybe there is another form for compact notation?
Post 12 May 2023, 13:02
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20179
Location: In your JS exploiting you and your system
revolution 12 May 2023, 13:06
Unless you write a macro then fasm only supports one label per definition.
Code:
macro multi_dd_define [var] { forward var dd ? }
multi_dd_define r, g, b    
Post 12 May 2023, 13:06
View user's profile Send private message Visit poster's website Reply with quote
macomics



Joined: 26 Jan 2021
Posts: 919
Location: Russia
macomics 12 May 2023, 13:20
or
Code:
macro multi_dd_define val,[var] { forward var dd val }
multi_dd_define 1.0, r, g, b    
Post 12 May 2023, 13:20
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8346
Location: Kraków, Poland
Tomasz Grysztar 12 May 2023, 13:38
Another option is IRP:
Code:
irp var, r,g,b { var dd 0 }    
Post 12 May 2023, 13:38
View user's profile Send private message Visit poster's website Reply with quote
AsmGuru62



Joined: 28 Jan 2004
Posts: 1590
Location: Toronto, Canada
AsmGuru62 12 May 2023, 16:53
These methods are good, but what to do if you develop an IDE with Intelli-Sense?
My IDE will parse a 'classic' definition from the post #1, but not these other weird macros.
So, any time anyone invents a macro -- the IDE developer must adjust?
I think it is too much to ask.
Post 12 May 2023, 16:53
View user's profile Send private message Send e-mail Reply with quote
3D_FASM



Joined: 11 May 2023
Posts: 24
3D_FASM 12 May 2023, 18:14
Macros will probably confuse the code too much.
Is in FASM a system character that replaces a line break?
For examle like this:

Code:
r dd 0  :  g dd 0  :  b dd 0    


There is a \ but it's probably not suitable for this.
Post 12 May 2023, 18:14
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8346
Location: Kraków, Poland
Tomasz Grysztar 12 May 2023, 18:33
There is a recent thread discussing this.
Post 12 May 2023, 18:33
View user's profile Send private message Visit poster's website Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 3962
Location: vpcmipstrm
bitRAKE 12 May 2023, 18:41
fasmg is over powered:
Code:
calminstruction(name) dd? line&
        local first
try:
        match first : line, line
        jno single
        arrange first, name =dd? first
        assemble first
more:
        match first : line, line
        jno last
        arrange first, first
        assemble first
        jump more
last:
        arrange line, line
        assemble line
        exit
single:
        arrange line,name =dd? line
        assemble line
end calminstruction ; dd?

r dd 1 : g dd 2 : b dd 3    
AsmGuru62 wrote:
So, any time anyone invents a macro -- the IDE developer must adjust?
I think it is too much to ask.
... the current flavor of solution is LSP - which just moves the problem outside the IDE, imho. We don't have an LSP for fasm/fasmg; but I feel it would be easy to break that it doesn't make much sense for the general case. Maybe A.I. is the answer?
Post 12 May 2023, 18:41
View user's profile Send private message Visit poster's website Reply with quote
3D_FASM



Joined: 11 May 2023
Posts: 24
3D_FASM 12 May 2023, 19:28
I think it's a intrest trick:
https://board.flatassembler.net/topic.php?t=1938

Or i think is possible to use the character " :" if it is preceded by a space.

But r,g,b dd 0 is the most understandable. But that probably can't be done.

As I understand it, did not come to a consensus...
Post 12 May 2023, 19:28
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8346
Location: Kraków, Poland
Tomasz Grysztar 12 May 2023, 20:01
3D_FASM wrote:
But r,g,b dd 0 is the most understandable. But that probably can't be done.
With fasmg it is quite possible:
Code:
calminstruction (name) ? tail&
        local next, statement
        match =,next tail, tail
        jyes multi
        arrange statement, name tail
        assemble statement
    done:
        exit
    multi:
        take name, next
        match =,next tail, tail
        jyes multi
    reverse:
        take next, name
        jyes reverse
    process:
        take name, next
        jno done
        arrange statement, name tail
        assemble statement
        jump process
end calminstruction

r,g,b dd 0    
Post 12 May 2023, 20:01
View user's profile Send private message Visit poster's website Reply with quote
3D_FASM



Joined: 11 May 2023
Posts: 24
3D_FASM 14 May 2023, 11:34
I got acquainted with FASMG, this is a really powerful tool, it can probably write a high-level language on it ) But for now I will not switch to it.

Thanks to all for interesting answers, I think these examples will be interesting for many users. I'll leave all as is or be use structs as a last resort.
Post 14 May 2023, 11:34
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-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.