Searching \ for 'MPASM macros' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/language/index.htm?key=asm
Search entire site for: 'MPASM macros'.

Truncated match.
PICList Thread
'MPASM macros'
1999\02\26@132658 by Josef Hanzal

flavicon
face
I would like to have macro, which behaves differently when argument is
defined and when it is not. The manual says, that argument which is omitted
equals to an empty string, but I cannot find a way, how to test for string
lenght. Has someone already solved this? I tried the following way, but it
is not working, as there is no substitution for MENUITEM in the IFDEF
statement when macro is invoked. I tried several more complicated ways, but
no good results so far. Any suggestions? MPASM 2.15

STRING  MACRO   STR,MENUITEM
STR#V(STRNO):   DT STR,0
IFDEF  MENUTITEM
MENUITEM:       EQU STRNO
ENDIF
       ENDM

Josef

======================================================================
Electronical devices for chemical laboratory, custom electonics design
----------------------------------------------------------------------
Snail Instruments                     Josef Hanzal
Vojanova 615                          phone/fax: +420-311-24433
266 01 Beroun                         e-mail: spam_OUTsnailTakeThisOuTspamiol.cz
Czech Republic                        URL: http://www.vitrum.cz/snail/
======================================================================

1999\02\26@174741 by Gerhard Fiedler

picon face
At 19:25 02/26/99 +0100, Josef Hanzal wrote:
>I would like to have macro, which behaves differently when argument is
>defined and when it is not. The manual says, that argument which is omitted
>equals to an empty string, but I cannot find a way, how to test for string
>lenght. Has someone already solved this? I tried the following way, but it
>is not working, as there is no substitution for MENUITEM in the IFDEF
>statement when macro is invoked. I tried several more complicated ways, but
>no good results so far. Any suggestions? MPASM 2.15
>
>STRING  MACRO   STR,MENUITEM
>STR#V(STRNO):   DT STR,0
> IFDEF  MENUTITEM
>MENUITEM:       EQU STRNO
> ENDIF
>        ENDM

i'm not really familiar with mpasm, but a few things caught my eye:

>MENUITEM:       EQU STRNO

shouldn't that be without colon?


> IFDEF  MENUTITEM

if it says that the "argument which is omitted equals to an empty string"
you maybe could try something like

IF MENUITEM = ""

or

IF "MENUITEM" = ""

your version asks whether the item is defined, and if it is an empty
string, it may as well be =defined= as an empty string...

ge

1999\02\26@220000 by Mark Willis

flavicon
face
Josef Hanzal wrote:
>
> I would like to have macro, which behaves differently when argument is
> defined and when it is not. The manual says, that argument which is omitted
> equals to an empty string, but I cannot find a way, how to test for string
> lenght. Has someone already solved this? I tried the following way, but it
> is not working, as there is no substitution for MENUITEM in the IFDEF
> statement when macro is invoked. I tried several more complicated ways, but
> no good results so far. Any suggestions? MPASM 2.15
>
> STRING  MACRO   STR,MENUITEM
> STR#V(STRNO):   DT STR,0
>  IFDEF  MENUTITEM
> MENUITEM:       EQU STRNO
>  ENDIF
>         ENDM
>
> Josef

 Your IFDEF MENUTITEM there has an "extra" T in the middle there, I'm
hoping that's not the cause of the problem?

 I've used "Test Equ NullArg   555" before on other platforms (I'm not
where I can test it here, but it worked in CDC Cyber mainframe assembly
and has worked other places <G> - but NullArg has to be numberical for
that to work.)  Sets a default of 555 (here), for an omitted argument.
I should test that on MPAsm, huh?

 #IFNDEF looks like a candidate here as well.  If it's falling through
on an undefined string, then
 #IFNDEF MENUITEM
;    NOTE Fell through
 #ELSE
MENUITEM:       EQU STRNO
 #ENDIF

 "Programming is the art of thinking deviously enough to figure out how
to get what you want, while not violating the principle of least
astonishment" <G>

 Have you used #EXPAND?  (or is it EXPAND?  I forget.)  To expand the
macro invocation and see more info on what's going through MPASM's head.

 Worst case, add a 3rd arg in the middle:
 STRING  MACRO   STR,BOOL,MENUITEM

 Set Bool=1 when you'll have a MENUITEM.  Icky though.  I'm no MPAsm
expert, and too rusty on Parallax's Assembler now.

 Mark


'MPASM macros'
2000\01\05@105405 by rcia-Tobin
flavicon
face
part 0 3323 bytes

<META content="MSHTML 5.00.2614.3401" name=GENERATOR></HEAD>
<BODY bgColor=#ffffff>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2><SPAN class=340273915-05012000>&nbsp;&nbsp;&nbsp;
Hi there,</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=340273915-05012000></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2><SPAN class=340273915-05012000>&nbsp;&nbsp;&nbsp; I
was wondering if anyone knows any way of creating static macro variables. That
is, a variable whose state remain between macro expansions. What actually want
to do is count how many times a&nbsp;macro gets called, so that an error message
can be produced if this number is deemed incorrect.</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=340273915-05012000></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2><SPAN class=340273915-05012000>&nbsp;&nbsp;&nbsp;
Any help appretiated, cheers</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=340273915-05012000></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2><SPAN
class=340273915-05012000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Charles.</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=340273915-05012000></SPAN></FONT>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT
face=Arial>///////////////////////////////////////////////////////////////////////////////</FONT></DIV>
<DIV><FONT face=Arial>// Charles Garc’a-Tobin </FONT></DIV>
<DIV><FONT face=Arial>// Research Scientist </FONT></DIV>
<DIV><FONT face=Arial>// Cyberlife Technology Ltd</FONT></DIV>
<DIV>
<DIV><FONT face=Arial size=2><SPAN class=340273915-05012000>//&nbsp;&nbsp;&nbsp;
</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=340273915-05012000>//&nbsp;&nbsp;&nbsp;" 640Kb should be enough for
anyone"</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=340273915-05012000>//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Bill Gates
1981</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=340273915-05012000>//&nbsp;&nbsp;&nbsp;&nbsp;"Who needs
Kbs?"</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=340273915-05012000>//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Me
today.</SPAN></FONT></DIV>
<DIV><FONT
face=Arial>//////////////////////////////////////////////////////////////////////////////</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV></DIV>
<DIV>&nbsp;</DIV></BODY></HTML>

</x-html>

2000\01\05@115954 by Sinclair, Duncan

flavicon
face
part 0 4479 bytes

<META content="MSHTML 5.00.2314.1000" name=GENERATOR></HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN
class=180225616-05012000>Hi,</SPAN></FONT></DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN
class=180225616-05012000></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN class=180225616-05012000>You
could place a variable statement in your main program i.e. variable i=0 then
update this in the same way as you do with macro variables.</SPAN></FONT></DIV>
<BLOCKQUOTE style="MARGIN-RIGHT: 0px">
 <DIV align=left class=OutlookMessageHeader dir=ltr><FONT face=Tahoma
 size=2>{Original Message removed}

More... (looser matching)
- Last day of these posts
- In 2000 , 2001 only
- Today
- New search...