9.1.1.1 RETLW Instruction

The RETLW instruction can be used to provide access to tables of constants. The recommended way to create such a table is shown in the following example.

Accessing Table of Constants Using the RETLW Instruction

constants
	BRW                     ;Add Index in W to
	                        ;program counter to
	                        ;select data
	RETLW DATA0             ;Index0 data
	RETLW DATA1             ;Index1 data
	RETLW DATA2
	RETLW DATA3
my_function
	;… LOTS OF CODE…
	MOVLW		DATA_INDEX
	call constants
	;… THE CONSTANT IS IN W

The BRW instruction eases the implementation of this type of table.