flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > Version String Macro

Author
Thread Post new topic Reply to topic
Raedwulf



Joined: 13 Jul 2005
Posts: 375
Location: United Kingdom
Raedwulf 21 Nov 2006, 10:20
I was trying to make a version string macro like this:

Code:
; Some version information
VERSION_MAJOR     = 0
VERSION_MINOR     = 1
VERSION_REVISION  = 0
VERSION_BUILD     = 0     

section '.data' data readable writeable

        ; Version String
        version_string          db      `VERSION_MAJOR # "." # `VERSION_MINOR # "." # `VERSION_REVISION # " build " # `VERSION_BUILD, 0
    


I must be doing something wrong because it isn't working Wink

Could someone help me please Very Happy

Cheers Wink

_________________
Raedwulf
Post 21 Nov 2006, 10:20
View user's profile Send private message MSN Messenger Reply with quote
dead_body



Joined: 21 Sep 2005
Posts: 187
Location: Ukraine,Kharkov
dead_body 21 Nov 2006, 10:54
Code:
macro version_string [string*]
{
        common version_string string
}



VERSION_MAJOR     fix 0
VERSION_MINOR     fix 1
VERSION_REVISION  fix 0
VERSION_BUILD     fix 0

version_string db `VERSION_MAJOR # "." # `VERSION_MINOR # "." # `VERSION_REVISION # " build " # `VERSION_BUILD, 0    



` - works only in macroinstruction???
Post 21 Nov 2006, 10:54
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8267
Location: Kraków, Poland
Tomasz Grysztar 21 Nov 2006, 11:04
From Understanding fasm, section "Tokenization of source and line makers":
Quote:
(...)lines that are preprocessed, are actually the sequences of tokens, not the raw text of the source. And such sequences can be born in a two different ways - either created directly from the source text, or generated by macroinstruction. Thus we've got a two different "line makers" - one being "source reader" and one "macroinstruction processor".

As we have seen, there is a bunch of special commands, like concatenation operator or LOCAL directive, that may be issued while macroinstruction generates a new lines. In a similar way, there are special commands that are understood and obeyed only by the source reader.(...)
Post 21 Nov 2006, 11:04
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8267
Location: Kraków, Poland
Tomasz Grysztar 21 Nov 2006, 11:08
PS. I would recommend doing it this way:
Code:
VERSION_MAJOR     equ 0
VERSION_MINOR     equ 1
VERSION_REVISION  equ 0
VERSION_BUILD     equ 0

match major:minor:revision:build, VERSION_MAJOR:VERSION_MINOR:VERSION_REVISION:VERSION_BUILD
{ version_string db `major # "." # `minor # "." # `revision # " build " # `build, 0 }    
Post 21 Nov 2006, 11:08
View user's profile Send private message Visit poster's website Reply with quote
Raedwulf



Joined: 13 Jul 2005
Posts: 375
Location: United Kingdom
Raedwulf 21 Nov 2006, 13:56
Thank you, Tomasz & deadbody Very Happy
Post 21 Nov 2006, 13:56
View user's profile Send private message MSN Messenger 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-2023, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.