flat assembler
Message board for the users of flat assembler.

Index > Compiler Internals > How to add new formatter directive?

Author
Thread Post new topic Reply to topic
Alex Bubnoff



Joined: 01 May 2005
Posts: 3
Location: Russia
Alex Bubnoff 01 May 2005, 12:43
Sorry for my bad english.

I tried to add "data tls" directive, to put TLS rva and size to PE header. First, I added new formatter symbol "tls":
Code:
formatter_symbols: 
...
 db 3,'tls',1Ah,5
 db 0  
    

But it does not work:
Code:
flat assembler  version 1.60
tls.ASM [11]:
data    tls
error: undefined symbol.
    

Can you tell me, how to add my own formatter directive?
Post 01 May 2005, 12:43
View user's profile Send private message ICQ Number Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8394
Location: Kraków, Poland
Tomasz Grysztar 01 May 2005, 13:41
The table of formatter symbols (do not mistake them with formatter directives, they actually reside in the instructions table) has to be sorted alphabetically, so you must put it into correct place into table.

However for this kind of modification is not necessary at all for your purpose, since "data" directive allows number as a parameter, too. You can do it this way:
Code:
TLS = 5

data TLS
; ...
end data    
Post 01 May 2005, 13:41
View user's profile Send private message Visit poster's website Reply with quote
Alex Bubnoff



Joined: 01 May 2005
Posts: 3
Location: Russia
Alex Bubnoff 01 May 2005, 13:45
Big thanks! But TLS = 9.
Post 01 May 2005, 13:45
View user's profile Send private message ICQ Number Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8394
Location: Kraków, Poland
Tomasz Grysztar 01 May 2005, 13:47
Oh, right. So you should have written:
Code:
db 3,'tls',1Ah,9    

if you really wanted to add it as a formatter symbol.
Post 01 May 2005, 13:47
View user's profile Send private message Visit poster's website Reply with quote
Alex Bubnoff



Joined: 01 May 2005
Posts: 3
Location: Russia
Alex Bubnoff 02 May 2005, 09:35
Thanks!
Post 02 May 2005, 09:35
View user's profile Send private message ICQ Number 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.