flat assembler
Message board for the users of flat assembler.

Index > Main > Pre-defined strings in structures

Author
Thread Post new topic Reply to topic
Zetus



Joined: 03 Jun 2004
Posts: 37
Zetus
Hello,
sometimes usefull definition in TASM:

struc Key
Str db 20 dup (0)
ends

defined as

KeyChain:
Key <'Load'>
Key <'SaveAAA'>

and checked in cycle:
mov edi,offset KeyChain
mov ecx,KeyCount
u1:
call OutName,edi
add edi,20
loop u1

Result - the pre-defined "Name" is easely changeable in size of 20 bytes, and size of structure is constant, and equial 20.

In fasm, the same result:
struc Key [StrD]
{
.size dd .nEnd-.Str
.Str db StrD
.nEnd:
}

KeyChain:
k_Load Key 'Load'
k_Save Key 'SaveAAA'

Result - the size pre-defined "Name" is unexpandable (or need to reserve additional space), and size of structure is not a constant.

Sometimes the Tasm method is better. Is any way to made it in fasm?
Post 20 Aug 2004, 08:12
View user's profile Send private message ICQ Number Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 7725
Location: Kraków, Poland
Tomasz Grysztar
Something like
Code:
struc Key [StrD]
 { .Str db StrD
   times 20-($-.Str) db 0 }    
?
Post 20 Aug 2004, 08:46
View user's profile Send private message Visit poster's website Reply with quote
Zetus



Joined: 03 Jun 2004
Posts: 37
Zetus
Ya thanks, me brainless after 5 hours DSP programming ))
Post 20 Aug 2004, 11:50
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-2020, Tomasz Grysztar. Also on YouTube, Twitter.

Website powered by rwasa.