Ds4830 user’s guide – Maxim Integrated DS4830 Optical Microcontroller User Manual
Page 191
DS4830 User’s Guide
191
bit that is utilized only for word mode data pointer access). Switching from byte to word access mode or vice versa does
not alter the data pointer contents. Therefore, it is important to maintain the consistency of data pointer address value
within the given access mode.
move WBS0, #0
; DP[0] in byte mode
move DP[0], #1
; DP[0]=0001h (byte mode, index 1)
move WBS0, #1
; DP[0] in word mode, byte mode lsbit not visible
move DP[0], #1
; DP[0]=0001h (word mode, index 1)
move WBS0, #0
; DP[0] in byte mode
move GR, DP[0]
; GR = 0003h (word index 1, byte index 1)
The three pointers share a single read/write port on the data memory and thus, the user must knowingly activate a desired
pointer before using it for data memory read operations. This can be done explicitly using the data pointer select bits
(SDPS1:0; DPC.1:0), or implicitly by writing to the DP[n], BP or OFFS registers. Any indirect memory write operation
using a data pointer will set the SDPS bits, thus activating the write pointer as the active source pointer.
move SDPS1, #1
; (explicit) selection of FP as the pointer
move DP[0], src
; (implicit) selection of DP[0]; set SDPS1:0=00b
move DP[1], DP[1]
; (implicit) selection of DP[1]; set SDPS1:0=01b
move OFFS, src
; (implicit) selection of FP; set SDPS1=1
move WBS1, #0
; (implicit) selection of byte access for DP[1]
Once the pointer selection has been made, it will remain in effect until:
the source data pointer select bits are changed via the explicit or implicit methods described above (i.e. another
data pointer is selected for use).
the memory to which the active source data pointer is addressing is enabled for code fetching using the
Instruction Pointer, or
a memory write operation is performed using a data pointer other than the current active source pointer.
move DP[1], DP[1]
; select DP[1] as the active pointer
move dst, @DP[1]
; read from pointer
move @DP[1], src
; write using a data pointer
; DP[0] is needed
move DP[0], DP[0]
; select DP[0] as the active pointer
To simplify data pointer increment / decrement operations without disturbing register data, a virtual NUL destination has
been assigned to system module 6, sub-index 7 to serve as a bit bucket. Data pointer increment / decrement operations
can be done as follows without altering the contents of any other register:
move NUL, @DP[0]++
; increment DP[0]
move NUL, @DP[0]--
; decrement DP[0]
The following data pointer related instructions are invalid:
move @++DP[0], @DP[0]++
move @++DP[1], @DP[1]++
move @BP[++Offs], @BP[Offs++]
move @--DP[0], @DP[0]--
move @--DP[1], @DP[1]--
move @BP[--Offs], @BP[Offs--]
move @++DP[0], @DP[0]--
move @++DP[1], @DP[1]--
move @BP[++Offs], @BP[Offs--]
move @--DP[0], @DP[0]++
move @--DP[1], @DP[1]++
move @BP[--Offs], @BP[Offs++]
move @DP[0], @DP[0]++
move @DP[1], @DP[1]++
move @BP[Offs], @BP[Offs++]
move @DP[0], @DP[0]--
move @DP[1], @DP[1]--
move @BP[Offs], @BP[Offs--]
move DP[0], @DP[0]++
move DP[0], @DP[0]--
move DP[1], @DP[1]++
move DP[1], @DP[1]--
move Offs, @BP[Offs--]
move Offs, @BP[Offs++]