beautypg.com

10 urom_copybuffer, 4 utility rom examples, 10 urom_copybuffer -7 – Maxim Integrated MAXQ Family Users Guide: MAXQ8913 Supplement User Manual

Page 106: 4 utility rom examples -7, Maxq family user’s guide: maxq8913 supplement

background image

MAXQ Family User’s Guide:

MAXQ8913 Supplement

25-7

25.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 25-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.

25.4 Utility ROM Examples

25.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]

Maxim Integrated