flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > Nested idata

Author
Thread Post new topic Reply to topic
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 22 Mar 2007, 01:47
Hi, I found interesting problem: You can't use idata inside another idata. In my case i am creating string table with multiple usage of macro (not one with multiple argument).

Problem can be reduced to following.
Code:
macro idata arg
{
  __IData equ __IData,   ;add one ',' to __IData, initial "__IData" before ','s will be used to call macro
  macro __IDataBlock     ;begin macro (or overload old one) which holds data inside "idata" block
  arg
}

;include all "idata"-defined blocks
macro IncludeIData
{
  macro __IData dummy,[n]  ;create macro which will be invoked, [n] makes sure macro's forward will
  \{                       ;be preprocessed for each ',' added to __IData
    \forward
       align 4
       __IDataBlock        ;use the macro with data
       purge __IDataBlock  ;and remove it so previous macro becomes avilable
  \}
  match I, __IData \{ I \} ;and now unroll __IData macro (just "__IData" wouldn't do, replaced equate isn't
                           ;preprocessed anymore and so it wouldn't beheave as macro usage)
  purge __IData            ;__Idata macro is not needed anymore
}


idata{
  dd _name
  idata \{
    _name db 'jerry lee lewis',0
  \}
  dd _name2
  idata \{
    _name2 db 'freddie fingers lee',0
  \}
}
IncludeIData    


I want to get something like this:
Code:
dd _name
dd _name2
_name db "jerry lee lewis"
_name2 db "freddie fingers lee"    
Post 22 Mar 2007, 01:47
View user's profile Send private message Visit poster's website AIM Address MSN Messenger 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.