A.D.A. Amiga Demoscene Archive

        Welcome guest!

  

  

  

log in with SceneID

  

Demos Amiga Demoscene Archive Forum / Coding / macros in asm-one

 

Author Message
dalton
Member
#1 - Posted: 22 Feb 2009 12:29
Reply Quote
I think I remember from somewhere that it's possible to use an arbitrary number of arguments in an asm-one macro.

Does anyone know how to do this?

I'm not thinking about using \1 \2 \3 etc together with NARG. There should be some \ code that gives the 'next' argument each time it's invoked...
ZEROblue
Member
#2 - Posted: 22 Feb 2009 20:15
Reply Quote
You're not thinking of the \@ command? It expands to unique but unpredictable symbols.

I remember trying several ways to get a symbol N to expand to a digit with \N but it seems that the \ command will only accept a 0-9 and @ following.
dalton
Member
#3 - Posted: 23 Feb 2009 06:25
Reply Quote
If \1 is the first argument, what's \0 then?
Todi
Member
#4 - Posted: 23 Feb 2009 14:05
Reply Quote
I know PhxAss has the \+ to get next arg, haven't tested it in Asm-one, but maybe...
ZEROblue
Member
#5 - Posted: 23 Feb 2009 16:57
Reply Quote
I think \0 used to be the number of arguments as well, but I could be remembering wrong.
dalton
Member
#6 - Posted: 23 Feb 2009 18:52
Reply Quote
\0 seems to be the dot after the macro name at invokation, like 'w' in move.w

\+ doesn't seem to work in asm-one

still no luck...
Blueberry
Member
#7 - Posted: 4 Mar 2009 20:23 - Edited
Reply Quote
I don't think AsmOne (or AsmPro) has such a mechanism. You can emulate it to some degree by using a recursive macro, like this:
M   macro
    ; Do something with \1
    if "\2"<>""
    M \2,\3,\4,\5,\6,\7,\8,\9,\10,\11,\12,\13,\14 
,\15,\16,\17,\18
    endc

(where the arguments should be on the same line, but something breaks it up).

As you can see, any argument not given simply becomes empty. I seem to recall that the maximum number of macro arguments is 19.
dalton
Member
#8 - Posted: 6 Mar 2009 07:45
Reply Quote
that's a good idea, but it's probably more useful in asm-pro because asm-one has a limit at 5 levels of macro recursion

 

  Please log in to comment

  

  

  

 

A.D.A. Amiga Demoscene Archive, Version 3.0