Macros ?

binary1248

Senior Member
I see several code writers using macros in their code. While I understand and will use macros myself, I can't find any descriptions of the use of macros in any of the manuals. Where in the manuals 1,2,3 are they referenced ?
Paul
 

hippy

Ex-Staff (retired)
Page 11 in Manual 2, but there's not a great deal of explanation as there is not a lot to them.

Once you define a macro, whenever you use its name as a Basic command the code in the macro is inserted in its place.

If you have parameters for the macro then you need to provide what those will be when you use the macro name, and the macro will replace the named parameter with the provided when expanded.

Code:
#Macro Set( argA, argB, argC )
  Let argA = argB + argC
#EndMacro

Set( b0, 100, 0 )
Set( b1, 100, 1 )
Is the equivalent of having written -
Code:
  Let b0 = 100 + 0
  Let b1 = 100 + 1
 

binary1248

Senior Member
Thanks hippy,
While I was familiar with using macros as conditional code (from other assemblers I've used), I kept looking at the manuals (1 & 2) index listings including assy directives. Just never saw that, many thanks.
 
Top