4 – data memory mapping, Ds4830a user’s guide – Maxim Integrated DS4830A Optical Microcontroller User Manual
Page 18
DS4830A User’s Guide
18
pointer. If the data pointer is used as destination, the core performs a store operation that writes data to the memory
location addressed by the data pointer. Following are some examples of setting and using a data pointer.
move DP[0], #0100h
; set pointer DP[0] to address 100h
move Acc, @DP[0]
; read data from location 100h
move @DP[0], Acc
; write to location 100h
The address pointed to by the data pointers can be automatically incremented or decremented. If the data pointer is used
as a source, the pointer can be incremented or decremented after the data access. If the data pointer is used as a
destination, the increment or decrement can occur prior to the data access. Following are examples of using the data
pointers increment/decrement features.
move Acc, @DP[0]++
; increment DP[0] after read
move Acc, @DP[1]--
; decrement DP[1] after read
move @++DP[0], Acc
; increment DP[0] before write
move @--DP[1], Acc
; decrement DP[0] before write
2.4.3.2 – Frame Pointer
The frame pointer (BP[OFFS]) is formed by the 16-bit unsigned addition of the 16-bit Frame Pointer Base Register (BP)
and the 8-bit Frame Pointer Offset Register (OFFS). The method the DS4830A uses to access data using the frame
pointer is similar to the data pointers. When increments or decrements are used, only the value of OFFS is incremented
or decremented. The base pointer (BP) will remain unaffected by increments or decrements of the OFFS register,
including when the OFFS register rolls over from FFh to 00h or from 00h to FFh. Following are examples of how to use
the frame pointer.
move BP, #0100h
; set base pointer to address 100h
move OFFS, #10h
; set the offset to 10h,
move Acc, @BP[OFFS]
; read data from location 0110h
move @BP[OFFS], Acc
; write data to location 0110h
move Acc, @BP[OFFS++]
; increment OFFS after read
move Acc, @BP[OFFS++]
; decrement OFFS after read
move @BP[++OFFS], Acc
; increment OFFS before write
move @BP[--OFFS], Acc
; decrement OFFS before write
2.4.4 – Data Memory Mapping
The DS4830A’s pseudo-Von Neumann memory map allows the MMU to read data from each of the three memory
segments (flash, SRAM, utility ROM). The MMU can also write data directly to the SRAM memory segment. Data
memory can be written to the flash memory segment, but because writing to flash requires the use of the utility ROM
routines, this is not a direct access. The logical mapping of the three memory segments as data memory varies
depending upon:
• which memory segment instructions are currently being executed from
• if data memory is being accessed in word or byte mode
In all cases, whichever memory segment is currently being used, program memory cannot be accessed as data memory.
When the program is currently executing instructions from either the SRAM or utility ROM memory segments, the flash
memory will be mapped to half of the data memory space. If word access mode is selected, both pages (32KWords) can
be logically mapped to data memory space. If byte access mode is selected, only one page (32KBytes) can be logically
mapped to half of the data memory space. When operating in byte access mode, the selection of which flash page is
mapped into data memory space is determined by the Code Data Access bit (CDA0):
CDA0
Selected Page in Byte Mode
Selected Page in Word Mode
0
P0
P0 and P1
1
P1
P0 and P1
The next three sections detail the mapping of the different memory segments as data memory depending upon which
memory segment instructions are currently being executed from.