PutMessage clrf count
MessLoop call Table
;write to LCD here
incf count,f
btfss count,4
goto MessLoop
return
Table movfw MessageNumber ;get message number
movwf temp ;store it
clrf PCLATH ;clr high byte of PC
bcf STATUS,C
rlf temp,f ;multiply by 16 to get
rlf PCLATH,f ;offset in table
rlf temp,f
rlf PCLATH,f
rlf temp,f
rlf PCLATH,f
rlf temp,f
rlf PCLATH,f
movlw high Mess1 ;add start of table
addwf PCLATH,f ;to high byte
movfw temp ;get low byte
addwf count,w ;and add count
btfsc STATUS,C
incf PCLATH,f
addlw low Mess1 ;and add start of table
btfsc STATUS,C
incf PCLATH,f
movwf PCL ;do jump
;each message must be 16 characters long
org 0x400
Mess1 dt "0123456789abcdef"
dt "Message 2 "
dt "Message 3 "