> what's the syntax (if any) for conditional assembly
> ....
> if x or y and not z
> stuff
> else
> if z and y
> other stuff
> else....
> many other stuffs....
> endif
Dave:
if (x || y && !z)
stuff
else
if (z && y)
other stuff
else
....
endif
endif
Generally speaking, it's best to put parentheses around each of your
arguments; I left them out for clarity.
Also, it's a lot easier to do this sort of thing if you can get rid
of the "elses". In your example, for instance, "x or y and not z"
and "z and y" are mutually exclusive, so you could rewrite the code
as:
if (x || y && !z)
stuff
endif
if (z && y)
other stuff
endif
>
>Also, it's a lot easier to do this sort of thing if you can get rid
>of the "elses". In your example, for instance, "x or y and not z"
>and "z and y" are mutually exclusive, so you could rewrite the code
>as:
That was just a quick hack to get the point across.
>This is all in the MPASM manual, by the way..
Is this a separate doc? I looked in the help file, but didn't find it.
> > Also, it's a lot easier to do this sort of thing if you can get
> > rid of the "elses". In your example, for instance, "x or y and
> > not z" and "z and y" are mutually exclusive....
>
> That was just a quick hack to get the point across.
Yeah, but it's STILL always better if you can get rid of the
"else" directives. Nested "ifs" are hard enough to debug; nested
"if/elses" are nearly impossible.
> > This is all in the MPASM manual, by the way..
>
> Is this a separate doc? I looked in the help file, but didn't find it.
Have you ever found ANYTHING useful in the MPASM help file?
The MPASM User's Guide is a 284-page document available in PDF
format from the Microchip web site; if you don't have it
already, it's at:
(You'll have to cut-and-paste that into one line for your
browser.)
-Andy
=== Andrew Warren --- EraseMEaiwspam_OUTTakeThisOuTcypress.com
=== Staff Systems Engineer, IPD
=== Cypress Semiconductor Corporation
===
=== Opinions expressed above do not
=== necessarily represent those of
=== Cypress Semiconductor Corporation.
-- http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads