PDA

View Full Version : Basic Macro (create a macro with basic) similar to function



amgen
- 24th December 2011, 03:37
Like asm macro's but can be written in basic.
Would not save code size, but would make program shorter and more neat.
Put 1 line in basic code with passed values that inserts the full macro at assembly time.

........something like, not real code

B1 var byte.......
SomeMacro var macro var1,var2, etc
B2 var word
......................

...........creating the macro..................
VBmacro SomeMacro
local var1, var2
variable var1= port.pin, var2= count
some basic code...........
high var1
pause count
etc
endmacro
.................................................. ........

........using macro in some basic code...........................
start:
for a =1 to 50
serout (xxxxxxxx)
count = count +1
SomeMacro (portB.4, 50)
next a
etc....etc

Don

mackrackit
- 24th December 2011, 12:28
http://support.melabs.com/threads/89-USERCOMMAND-(Introduction-Start-Here)
Might be something of use. I have not tried it yet but looking forward to it.

amgen
- 24th December 2011, 14:08
Thanks !
Looks like about what I was thinking. Brings up some questions. Now I will get PBP3. Looks like each macro can only act on 1 value at a time ? ........write basic code, build it to get code for macro in asm ?..........
Definitely seems like advanced stuff for little basic.
Don

mohsinj677
- 5th September 2014, 07:20
Would not save code size, but would make program shorter and more neat.
Put 1 line in basic code with passed values that inserts the full macro at assembly time.