flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > sizeof variables syntax

Author
Thread Post new topic Reply to topic
RedGhost



Joined: 18 May 2005
Posts: 443
Location: BC, Canada
RedGhost 30 Mar 2006, 12:06
sorry for the easy question but i don't generally use preprocessor for anything, but for defining the size of data i do:
Code:
macro sddata_start {
    struc db [data] \{
        \common
        . db data
        size.\#. = $-.
    \}

    struc dw [data] \{
        \common
        . dw data
        size.\#. = $-.
    \}

    struc rb size \{
        \common
        . rb size
        size.\#. = $-.
    \}

    struc rw size \{
        \common
        . rw size
        size.\#. = $-.
    \}
}
;---

macro sddata_end {
    restruc db
    restruc dw
    restruc rb
    restruc rw
}
;---
    


but because i use '_' in string name convention it looks a bit ugly imo
Code:
mov ecx, size._string
    


i would prefer
Code:
mov ecx, _string.size
    


but if i do:
Code:
.\#.size = $-.
    


'_name.size' doesnt get defined

solution?

_________________
redghost.ca
Post 30 Mar 2006, 12:06
View user's profile Send private message AIM Address MSN Messenger Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8351
Location: Kraków, Poland
Tomasz Grysztar 30 Mar 2006, 12:39
Use just:
Code:
.size=$-.    

instead.
Post 30 Mar 2006, 12:39
View user's profile Send private message Visit poster's website Reply with quote
RedGhost



Joined: 18 May 2005
Posts: 443
Location: BC, Canada
RedGhost 30 Mar 2006, 15:19
Tomasz Grysztar wrote:
Use just:
Code:
.size=$-.    

instead.


ah, i feel like a moron, i figured fasm would read the '.' as a period itself and define '.size' literally, Embarassed, perhaps i should have refered to the manual

_________________
redghost.ca
Post 30 Mar 2006, 15:19
View user's profile Send private message AIM Address 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-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.