questuk wrote: > Is there any way that the following code can be written using less > code? > > I have data I wish to store sequentially, the data to store is in > Read_Buffer, I have to increment a number, that then calls another to > store the data in the correct Store_Byte_X. > > Any ideas? Gary: Read the section of the datasheet that describes the FSR and INDF registers; this is exactly what they're for. The following bit of code copies the contents of Read_Buffer into Store_Byte_X, where Store_Byte_X = Store_Byte_0 + the contents of SM_Counter. MOVLW Store_Byte_0 ;W = address of the start of the ; Store_Byte array. ADDWF SM_Counter,W ;W = address of the SM_Counter'th ; element of the array. MOVWF FSR ;FSR points to that address. MOVF Read_Buffer,W ;Grab the data to be stored. MOVWF INDF ;Store it in the register to which ;the FSR is pointing. If you put a RETURN at the end of the above code, it's equivalent to your "Store_Data" routine. -Andy === Andrew Warren --- aiw@cypress.com === Principal Systems Engineer, IPDSD === Cypress Semiconductor Corporation === === Opinions expressed above do not === necessarily represent those of === Cypress Semiconductor Corporation -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu