H.P. de Vries wrote: > I hope someone can help me with this, because I dont have any bright > ideas right now ;) Is there a nifty little piece of code out there > what does the same as the "case", e/g/ "switch" statement? > > I am creating a MIDI-controller board with a 16-button interface. > Depending on which button is pressed, I want to branch to another > pice of code. Who can help?? Hans: There are many ways to do this... Here's how I usually manage it: CASE: XORLW 1 BZ W_CONTAINED_1 XORLW 2^1 BZ W_CONTAINED_2 XORLW 3^2 BZ W_CONTAINED_3 etc... This method takes 3 words (and 3 cycles) per test. There are faster/shorter ways, but they generally require your "cases" to be consecutive numbers. The method shown above will work with ANY numbers; it could just as easily have been: CASE: XORLW 7 BZ W_CONTAINED_7 XORLW 51^7 BZ W_CONTAINED_51 XORLW 12^51 BZ W_CONTAINED_12 -Andy === Andrew Warren - fastfwd@ix.netcom.com === Fast Forward Engineering - Vista, California === http://www.geocities.com/SiliconValley/2499