5 – utility rom examples, 1 – reading constant word data from flash – Maxim Integrated DS4830A Optical Microcontroller User Manual

Page 238

Advertising
background image

DS4830A User’s Guide

238

25.5 – Utility ROM Examples

25.5.1 – Reading Constant Word Data from Flash

UROM_moveDP0inc equ 08487h

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[0] = 3333h
lcall #UROM_moveDP0inc

move A[3], GR ; A[1] = 4444h
sjump $

org 0100h
table:
dw 1111h, 2222h, 3333h, 4444h

25.5.2 – Reading Constant Byte Data from Flash (Indirect Function Call)

INDX_moveDP0inc equ 4

move DPC, #1Ch

; Set all pointers to word mode

move DP[0], #800Dh

; Fetch location of function table from Utility ROM

move BP, @DP[0]

; Set base pointer to function table location

move Offs, #INDX_moveDP0inc

; Set offset to moveDP0inc entry in table

move A[7], @BP[Offs]

; Get address of moveDP0inc function

move DPC, #00h

; Set all pointers to byte mode

move DP[0], #((table * 2) + 8000h)

; Point to address of data as viewed in the Utility ROM memory map and

convert

; to byte mode pointer

lcall A[7]

; moveDP0inc

move A[0], GR

; A[0] = 34h

lcall A[7]

; moveDP0inc

move A[1], GR

; A[1] = 12h

lcall A[7]

; moveDP0inc

move A[2], GR

; A[2] = 78h

lcall A[7]

; moveDP0inc

move A[3], GR

; A[3] = 56h

sjump $

org 0100h
table:
dw 1234h, 5678h






Advertising