Users Guide: MAXQ2010 Supplement User Manual

MAXQ Family Users Guide:
MAXQ2010 Supplement
24-7
24.3.10 UROM_copyBuffer
Notes:
This function can be used to copy from program flash to data RAM, or from one part of data RAM to another. It cannot
be used to copy data into flash memory, however; the UROM_writeFlash function should be used for this purpose.
Before calling this function, DPC should be set appropriately to configure DP[0] and BP[OFFS] for byte or word
mode. Both DP[0] and BP[OFFS] should be configured to the same mode (byte or word) for correct buffer copying.
The addresses passed to this function should be based on the data memory mapping for the utility ROM, as shown
in Figure 24-1. When a byte mode address is used, CDA0 must be set appropriately to access either the upper or
lower half of program flash/ROM memory.
This function automatically refreshes the data pointers before reading the byte/word values.
24.4 Utility ROM Examples
24.4.1 Utility ROM Example 1: Reading Constant Word Data from Flash
move DPC, #1Ch ; Set all pointers to word mode
move DP[0], #(table + 8000h) ; Point to address of data as viewed
; in the Utility ROM memory map
lcall #UROM_moveDP0inc
move A[0], GR ; A[0] = 1111h
lcall #UROM_moveDP0inc
move A[1], GR ; A[1] = 2222h
lcall #UROM_moveDP0inc
move A[2], GR ; A[2] = 3333h
lcall #UROM_moveDP0inc
move A[3], GR ; A[3] = 4444h
sjump $
org 0100h
table:
dw 1111h, 2222h, 3333h, 4444h
Function:
UROM_copyBuffer
Summary:
Copies LC[0] bytes/words (up to 256) from DP[0] to BP[OFFS].
Inputs:
DP[0]: Address to copy from.
BP[OFFS]: Address to copy to.
LC[0]: Number of bytes or words to copy.
Outputs:
OFFS is incremented by LC[0].
DP[0] is incremented by LC[0].
Destroys:
LC[0]