flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > nested structs/struct in macro

Author
Thread Post new topic Reply to topic
mindcooler



Joined: 01 Dec 2009
Posts: 423
Location: Västerås, Sweden
mindcooler
I would like to include this GUID member into my interface macro. Is this possible? Am I supposed to irp the guid or something? No luck with either struct or macro:

Code:
struc GUID d1*,d2*,d3*,[d4*]
{  common
      .d1   dd d1
      .d2   dw d2
      .d3   dw d3
      .d4:
   forward
      db d4
}

struc interface uid*,[methods]
{
   common
      virtual at 0
      name:
   forward
      .#methods: rd 1
   common
      end virtual
      .guid: GUID uid <----
}

macro interface name*,guide*,[methods]
{
   common
      virtual at 0
      name:
   forward
      .#methods: rd 1
   common
      end virtual
      .guid: GUID guide <----
}

IDirectSound8   interface <$96749377,$3391,$11D2,$9E,$E3,$00,$C0,$4F,$79,$73,$96>    


Quote:
Illegal instruction

IDirectSound8.guid:GUID $96749377,$3391,$11D2,$9E,$E3,$00,$C0,$4F,$79,$73,$96

_________________
This is a block of text that can be added to posts you make.
Post 26 Oct 2010, 21:07
View user's profile Send private message Visit poster's website MSN Messenger ICQ Number Reply with quote
mindcooler



Joined: 01 Dec 2009
Posts: 423
Location: Västerås, Sweden
mindcooler
I just noticed that those are actually strucs, how confusing. Structs give me invalid macro argument errors.
Post 26 Oct 2010, 21:09
View user's profile Send private message Visit poster's website MSN Messenger ICQ Number Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4633
Location: Argentina
LocoDelAssembly
In both the macro and struc interface replace ".guid:" with "guid".
Post 26 Oct 2010, 21:10
View user's profile Send private message Reply with quote
mindcooler



Joined: 01 Dec 2009
Posts: 423
Location: Västerås, Sweden
mindcooler
Ah, names are implicitly declared in struc(t)s, right?
Post 26 Oct 2010, 21:13
View user's profile Send private message Visit poster's website MSN Messenger ICQ Number Reply with quote
mindcooler



Joined: 01 Dec 2009
Posts: 423
Location: Västerås, Sweden
mindcooler
Anyway, that sems to be working, thanks.

Though I can't seem to get the methods right:

Code:
forward
      methods dd $    


doesn't seem to declare anything.

Code:
IDirectSound8   interface <$96749377,$3391,$11D2,$9E,$E3,$00,$C0,$4F,$79,$73,$96>,\
                          blap,blip,blup,blep,blop     


Edit:

nor can I access the guid member:

Code:
mov     eax,IDirectSound8.guid    

Quote:
Error: undefined symbol

_________________
This is a block of text that can be added to posts you make.


Last edited by mindcooler on 26 Oct 2010, 21:42; edited 1 time in total
Post 26 Oct 2010, 21:38
View user's profile Send private message Visit poster's website MSN Messenger ICQ Number Reply with quote
baldr



Joined: 19 Mar 2008
Posts: 1651
baldr
mindcooler,

struc-macro to be invoked has to be second token in the line, not third. Yes, colon is a token. Wink

----8<----
LocoDelAssembly,

Wouldn't that break locality? Wink
Post 26 Oct 2010, 21:42
View user's profile Send private message Reply with quote
mindcooler



Joined: 01 Dec 2009
Posts: 423
Location: Västerås, Sweden
mindcooler
baldr, yes guid: GUID uid works better Smile
Post 26 Oct 2010, 21:46
View user's profile Send private message Visit poster's website MSN Messenger ICQ Number Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4633
Location: Argentina
LocoDelAssembly
baldr, thanks for spotting that, I've actually tried to say "remove the colon", removing the dot was a typo.
Post 26 Oct 2010, 21:47
View user's profile Send private message Reply with quote
mindcooler



Joined: 01 Dec 2009
Posts: 423
Location: Västerås, Sweden
mindcooler
Code:
irp method,methods
      \{
         .method dd $
      \}    


doesn't help either, I can't concatenate . with .method

_________________
This is a block of text that can be added to posts you make.
Post 26 Oct 2010, 21:51
View user's profile Send private message Visit poster's website MSN Messenger ICQ Number Reply with quote
mindcooler



Joined: 01 Dec 2009
Posts: 423
Location: Västerås, Sweden
mindcooler
Gah, how can I make "method" NOT interpreted literally?

Code:
irp method,methods
      \{
         .#\.#method dd $
      \}    

_________________
This is a block of text that can be added to posts you make.
Post 26 Oct 2010, 22:58
View user's profile Send private message Visit poster's website MSN Messenger ICQ Number Reply with quote
mindcooler



Joined: 01 Dec 2009
Posts: 423
Location: Västerås, Sweden
mindcooler
By some reason this works:

Code:
   forward
      .#\.#methods dd $    


And I realized the GUID data were supposed to be in another section (doh).

_________________
This is a block of text that can be added to posts you make.
Post 26 Oct 2010, 23:21
View user's profile Send private message Visit poster's website MSN Messenger ICQ Number Reply with quote
mindcooler



Joined: 01 Dec 2009
Posts: 423
Location: Västerås, Sweden
mindcooler
It works as in the labels get declared, but I don't get any allocated space. Does it have something to do with the virtual address space?

Code:
struc interface [methods]
{
   common
      virtual at 0
   forward
      .#\.#methods dd $
   common
      end virtual
}    


I have to do this to get my doubles:

Code:
struc interface [methods]
{
   common
      virtual at 0
   forward
      .#\.#methods rd 1
   common
      end virtual
   forward
      dd $
}    

_________________
This is a block of text that can be added to posts you make.
Post 26 Oct 2010, 23:30
View user's profile Send private message Visit poster's website MSN Messenger ICQ Number Reply with quote
mindcooler



Joined: 01 Dec 2009
Posts: 423
Location: Västerås, Sweden
mindcooler
Everything works nicely now, except the master label doesn't exist:

Code:
struc interface [methods]
{
   common
      virtual at 0
   forward
      .#\.#methods rd 1
   common
      end virtual
   forward
      dd $
}

IDirectSound8   interface CreateSoundBuffer,GetCaps,DuplicateSoundBuffer,SetCooperativeLevel,\
                          Compact,GetSpeakerConfig,SetSpeakerConfig,Initialize,VerifyCertification

invoke  DirectSoundCreate8,DirectSound8,IDirectSound8 <------ undefined symbol IDirectSound8
    

_________________
This is a block of text that can be added to posts you make.
Post 26 Oct 2010, 23:51
View user's profile Send private message Visit poster's website MSN Messenger ICQ Number Reply with quote
mindcooler



Joined: 01 Dec 2009
Posts: 423
Location: Västerås, Sweden
mindcooler
I think

label .

did the trick.
Post 27 Oct 2010, 19:36
View user's profile Send private message Visit poster's website 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-2020, Tomasz Grysztar. Also on YouTube, Twitter.

Website powered by rwasa.