Maxim Integrated MAXQ622 User Manual
Page 250

Maxim Integrated
A1-5
MAXQ612/MAXQ622 User’s Guide
move DP[1], DP[1] ; select DP[1] as the active source pointer by
; writing to the pointer register
move ACC, @DP[1] ; DP[1] is now properly configured properly to read
****************************************************************************
Example 4, Basic Single Pointer Configuration in a function call.
Assumptions: We DO NOT know the contents of DPC. DPC needs to be preserved
across the call. DP[1] can be destroyed.
****************************************************************************
foo4:
push DPC ; save the existing DPC value
move ACC, DPC ; get the current DPC value
and #DP1_BYTE_MODE_AND_MASK
; change DP[1] to byte mode by setting DPC.3 to 0
move DPC, ACC ; write the new mode value
move DP[1], DP[1] ; select DP[1] as the active source pointer by
; writing to the pointer register
move ACC, @DP[1] ; DP[1] is now properly configured properly to read
;
;... perform other operations here
;
pop DPC ; restore the existing DPC value.
ret ;
****************************************************************************
Example 5, Basic Single Pointer Configuration in a function call.
Assumptions: We DO NOT know the contents of DPC. DPC needs to be preserved
across the call. DP[1] must also be preserved.
****************************************************************************
foo5:
push DPC ; save the existing DPC value
;
; in this case we need to save DP[1] in word and byte modes to save all
; 17 bits
;
move DP[1], DP[1] ; activate DP[1] for push (read) operation
move ACC, DPC ; get the current DPC value
or #DP1_WORD_MODE_OR_MASK
; change DP[1] to word mode by setting DPC.3 to 1
move DPC, ACC ; write the new mode value
push DP[1] ; save word mode bits
and #DP1_BYTE_MODE_AND_MASK
; change DP[1] to byte mode by clearing DPC.3 to 0