flat assembler
Message board for the users of flat assembler.

Index > Windows > Macro Help!

Author
Thread Post new topic Reply to topic
windwakr



Joined: 30 Jun 2004
Posts: 827
windwakr 14 Aug 2004, 19:04
In dev-c++ theres a function RGB(0,0,0). And it goes like
Code:
RGB(r,g,b)
{
return r+(g<<8)+(b<<16);
}
    

I thought hmm thats gotta be easy to convert to asm.....I was wrong. I keep getting error after error. Can anyone help?

_________________
----> * <---- My star, won HERE
Post 14 Aug 2004, 19:04
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8351
Location: Kraków, Poland
Tomasz Grysztar 14 Aug 2004, 19:11
Code:
macro RGB target,r,g,b
 { mov target,r+g shl 8+b shl 16 }

RGB eax,0,0,0    
Post 14 Aug 2004, 19:11
View user's profile Send private message Visit poster's website Reply with quote
windwakr



Joined: 30 Jun 2004
Posts: 827
windwakr 14 Aug 2004, 19:13
havent tested yet but thanks!
Post 14 Aug 2004, 19:13
View user's profile Send private message Reply with quote
HarryTuttle



Joined: 26 Sep 2003
Posts: 211
Location: Poland
HarryTuttle 16 Aug 2004, 08:54
there is nothing to testing, it is raw and right Very Happy thx Privalov! every time when I see your solutions I start to believe in simplicity in fasm programming.

_________________
Microsoft: brings power of yesterday to computers of today.
Post 16 Aug 2004, 08:54
View user's profile Send private message Reply with quote
IceStudent



Joined: 19 Dec 2003
Posts: 60
Location: Ukraine
IceStudent 17 Aug 2004, 17:24
Why not implemented return operator?
I mean operator like EXITM at the MASM.

I think, it's very useful macro...
Post 17 Aug 2004, 17:24
View user's profile Send private message Reply with quote
mike.dld



Joined: 03 Oct 2003
Posts: 235
Location: Belarus, Minsk
mike.dld 17 Aug 2004, 19:08
Agree with you, IceStudent.
Maybe it won't require to rewrite many parts of compiler to allow use of macroses in instructions e.g. mov eax,RGB(0,0,0)?
Post 17 Aug 2004, 19:08
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8351
Location: Kraków, Poland
Tomasz Grysztar 17 Aug 2004, 19:23
It wouldn't require rewriting any parts of compiler, it would require to write a new one.

(I might suggest some HLL->FASM compiler aswell...)
Post 17 Aug 2004, 19:23
View user's profile Send private message Visit poster's website Reply with quote
Madis731



Joined: 25 Sep 2003
Posts: 2139
Location: Estonia
Madis731 18 Aug 2004, 09:58
Was that small or what Smile I did 150% scale on my font so I could finally see the writing, but also Ctrl+C -> Ctrl+V to the addressbar or Notepad helped Wink
Post 18 Aug 2004, 09:58
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger Reply with quote
Joshua



Joined: 12 Jul 2003
Posts: 56
Location: Belgium
Joshua 18 Aug 2004, 21:41
that's what they call the fine print Wink
Post 18 Aug 2004, 21:41
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 20 Aug 2004, 19:59
Quote:
It wouldn't require rewriting any parts of compiler, it would require to write a new one


Would it be such hard to make equates take arguments. It would solve such problems and make preprocesor more powerful. I don't see a big problem here...
Post 20 Aug 2004, 19:59
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8351
Location: Kraków, Poland
Tomasz Grysztar 20 Aug 2004, 20:17
The problem I see is the time needed to implement it. And it's anyway a bit out of the fasm's syntax image. For such purposes I would really recommend some alternative preprocessor, like HLA.
Post 20 Aug 2004, 20:17
View user's profile Send private message Visit poster's website Reply with quote
S.T.A.S.



Joined: 09 Jan 2004
Posts: 173
Location: Ru#27
S.T.A.S. 22 Aug 2004, 10:39
Hmm.. actually return can be implemented with the help of macros. I posted some set of macro which is based on such things: http://board.flatassembler.net/topic.php?t=1889
Post 22 Aug 2004, 10:39
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.