flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > How to detect last repetition in forward?

Author
Thread Post new topic Reply to topic
shoorick



Joined: 25 Feb 2005
Posts: 1608
Location: Ukraine
shoorick
i have a macro to build a linked list:
Code:
macro PROSECT [_label,_name] {
;------------------------------
local ..next
;------------------------------
forward
            dd 0
            dd ..next ; "next" pointer
    #_label db _name,0 
    ..next:
;------------------------------
}
    

i would like to detect last iteration and place zero into "next pointer" field instead of ..next value - is there short correct way to do this?

thanks!

_________________
UNICODE forever!
Post 11 Apr 2006, 10:06
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 7802
Location: Kraków, Poland
Tomasz Grysztar
This one should work in your case:
Code:
macro PROSECT [_label,_name] {
;-- ----------------------------
forward
    @@:
            dd 0
            dd @f ; "next" pointer
    #_label db _name,0
common
    @@ = 0
}    
Post 11 Apr 2006, 11:24
View user's profile Send private message Visit poster's website Reply with quote
shoorick



Joined: 25 Feb 2005
Posts: 1608
Location: Ukraine
shoorick
thanks! i'll try!
Post 11 Apr 2006, 11:49
View user's profile Send private message Visit poster's website Reply with quote
comrade



Joined: 16 Jun 2003
Posts: 1137
Location: Russian Federation
comrade
Won't that redefine @@ where the macro is used?
I mean:
Code:
dd @F

PROSECT abc,abc,def,def

@@: db moredata
    
Post 15 Apr 2006, 07:30
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger 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 GitHub, YouTube, Twitter.

Website powered by rwasa.