Searching \ for 'Case statement macro' 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/index.htm?key=case+statement+macro
Search entire site for: 'Case statement macro'.

Truncated match.
PICList Thread
'Case statement macro'
1997\03\17@145548 by mike

flavicon
picon face
Hi,

I need a case statement in my application and because it is
so repetetive am looking to implement it as a macro.

The basic blocks of the case look like:

 movlw  CmdA
 xorwf  RX_Cmd, w
 skpnz
 goto   doCmdA

 movlw  CmdB
 xorwf  RX_Cmd, w
 skpnz
 goto   doCmdB

 ...

CmdA and CmdB are constant values defined elsewhere. RX_Cmd is a
command which this PIC needs to execute received from another
processor. There may be a couple of dozen commands randomly
scattered across the 256 bit combinations (I have no control
over that) so a jump table is not an option.

I would like to code each section into a macro a bit like this:

_case macro cmd
 movlw  cmd
 xorwf  RX_Cmd, w
 skpnz
 goto   ***  this is where I get stuck
 endm

What I would like to do here is put a line like:

 goto  "do"+cmd

but this doesn't work.

Are there any string manipulation operators in the MPASM macro language
that I can use?

Regards,


Mike Watson

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