> From: Ray Gardiner > > [cut] > 3. I have found that it pays to ALWAYS inspect the *.LST output > from the assembler to check for page crossing on tables etc. > [cut] One can automate this inspection by using the 'error' directive e.g. my favourite technique goes like this: PAGESIZE equ 100h ; Page size for the processor PAGEMASK equ 10000h-PAGESIZE ; Mask for address bits which indicate page ; Define a few macros... table macro reg movlw high ($+4) movwf pclath movf reg,w addwf pcl,f first = $ endm endtab macro if (($-1) & PAGEMASK) != (first & PAGEMASK) error 'Table page boundary overflow' endif ; Now use the macros in open code... movlw 1 movwf jumpindex call foobar ... foobar table jumpindex ; jumpindex reg contains a value 0, 1, 2 etc. dt 4,2,77,4,5 ; The table entries (as retlw's etc) endtab The endtab macro ensures that the actual table does not cross a page boundary. If it does, your assembly fails and you can manually resolve the problem by shifting the table to another location. As shown, the above works for the 16CXX devices with which I am very familiar. The 16C5X parts may require additional restrictions which should be codified in the macros. Regards, SJH Canberra, Australia