On Tue, Oct 13, 1998 at 07:57:31AM -0700, Dave Johnson wrote: > good, but what if they're not? In my case, I need to switch on various > non-consecutive ASCII characters. Currently I'm doing something like this: > movf savechar, w ; check for qu estion mark > sublw '?' > btfsc status, z > goto dosomething > movf savechar, w ; check for ex clamation point > sublw '!' > ...etc... > > Is this reasonable? Brain dead? Suggestions/comments are welcome. It's not unreasonable, but it can be improved, like so: movf savechar,w xorlw '?' btfsc status,z goto dosomething xorlw '!'^'?' btfsc status,z goto dosomethingelse xorlw 'A'^'!' btfsc status,z goto dosomeotherthing ...etc... This avoids having to reload the switched value each time. Of course you could j ust use a good C compiler and get this done automagically for you... Cheers, Clyde -- Clyde Smith-Stubbs | HI-TECH Software Email: clyde@htsoft.com | Phone Fax WWW: http://www.htsoft.com/ | USA: (408) 490 2885 (408) 490 2885 PGP: finger clyde@htsoft.com | AUS: +61 7 3354 2411 +61 7 3354 2422 --------------------------------------------------------------------------- HI-TECH C: compiling the real world.