beautypg.com

Maxim Integrated MAXQ622 User Manual

Page 247

background image

A1-2

Maxim Integrated

MAXQ612/MAXQ622 User’s Guide

; execute function code here
;
move DPC, #4 ; restore the
pop DP[0] ; word mode version of DP[0]
move DPC, #0 ; restore the
pop DP[0] ; byte mode version of DP[0]
pop DPC ; restore DPC
ret ; or reti ;
;
HINT: If your application is written entirely in assembly code, you can
avoid the extra work required to save and restore all 17 bits of
each pointer by generating your own set of programming guidelines.
For example, if you dedicate DP[0] to always be used in byte mode
and dedicate DP[1] to always be used in word mode (you have to be
sure that the DPC.WBS bits corresponding to these registers are
*never* changed after they are initialized) then you can simply
push/pop these registers once for any function call. The above
code can be simplified to (DP[0] example)

foo2:
push DP[0]
;
; execute function code here
;
pop DP[0]
ret ; or reti
However, if you are mixing C code with assembly code you are not
free to setup such guideines and will be forced to use the
register usage rules dictated by your C compiler.
Pointer Activation
All MAXQ pointer reads require pointer activation before the correct
data can be read. Pointer writes do not require activation. There are
a number of way to activate a pointer.
1) Write the DPC.SDPS bits directly.
move DPC, #81h ; activate DP[1]
2) Write an address to the pointer.
move DP[1], #1234h
3) Recirculate the contents of a pointer.
move DP[1], DP[1]

This manual is related to the following products: