LOOKUP Index, Value0, {Value1, Value2, ...} Variable

Find the value at location Index and store it in ByteVar. If Index exceeds the highest index value of the items in the list ByteVar is left unaffected.

LOOKUP retrieves an item from a list based on the item's position, Index, in the list. For example:

  idx = 3
  LOOKUP idx, $00, $01, $02, $04, $08, $10, $20, $40, $80, LEDs

In this example, the variable called LEDs will be set to $04 as this value appears at index position three in the values list.

Related instructions: LOOKDOWN and READ