Example: Find a substring in an NVEM0 table

This example is a subroutine that uses an NVEM0 table to translate an integer (in X) in the range 1 to 12 into a 3-letter calendar month name and display it on the onboard LCD at the current cursor position.

The program fragment uses the OBLCD_NVText instruction. This instruction transfers RecLen bytes from NVEM to the onboard LCD.

DispMonth:
          DecX                 ;Need the month index to be 0-11, not 1-12
          NVSetPage    0       ;Make sure NVEM0 is selected
NVPopRecNum ;Month number, 0-11 NVSetRecLen 3 ;3 letters per month name NVSetPtr Months ;Point to the month table OBLCD_NVText 0 Return NVEM0 ;End of code, start of NVEM0 memory Months: NV0Byte "JanFebMarAprMayJunJulAugSepOctNovDec"