Looking at this example.. maybe it is not self explanatory.
In this example the variable B11 is being looked up. B11 can have the value of 0 through 16.
The LOOKUP table has 17 characters in the string.
If B11 = 0 then the ASCii character 0 is given to the variable B10.
If B11 = 5 then the ASCii character 4 is given to the variable B10.
Code:
HexW:
Gosub HexB13 ' Print MSB
B13 = B12 ' Print LSB
HexB13:
B11 = B13 / 16 ' Print MSB
Gosub HexB11
B11 = B13 & 15
HexB11:
Lookup B11,["0123456789ABCDEF"],B10 ' B10 = HEX$(B11)
Serout SO,N2400,[B10]
Return
If you wanted to give a numeric value to B10 based on B11 then the LOOKUP table could be like this.
Code:
Lookup B11,[898,895,892,889,886,883,879,876,873,870,867,863,860,857,854,850,847],B10
In this case if B11 = 1 then B10 would equal 895.
B11 = 16 then B10 would equal 847.
Bookmarks