You can have one entry-point (Label) and multiple exit points (Returns) or multiple entry-points (Labels) and a signle return. Both are valid and very useful. For example, my SK6812 RGBW LED code uses the following to provide three different, very short, delays:GOSUB NoNops gives four instruction cycle delay (250ns @ 64MHz), FiveNops gives 9 and SevenNops 11 cycles delay. I'd happily trade that for proper function calls with arguments any day but the way it does work is neither strange or wrong :-)Code:SevenNops: @ NOP @ NOP FiveNops: @ NOP @ NOP @ NOP @ NOP @ NOP NoNops: RETURN
/Henrik.




Bookmarks