Memory Pointers
-
MP0, MP1
Two Memory Pointers, known as MP0 and MP1 are provided. These Memory Pointers are physically
implemented in the Data Memory and can be manipulated in the same way as normal registers
providing a convenient way with which to address and track data. When any operation to the relevant
Indirect Addressing Registers is carried out, the actual address that the microcontroller is directed to, is
the address specified by the related Memory Pointer. MP0, together with Indirect Addressing Register,
IAR0, are used to access data from Bank 0, while MP1 and IAR1 are used to access data from all banks
according to BP register. Direct Addressing can only be used with Bank 0, all other Banks must be
addressed indirectly using MP1 and IAR1. Note that for this series of devices, the Memory Pointers,
MP0 and MP1, are both 8-bit registers and used to access the Data Memory together with their
corresponding indirect addressing registers IAR0 and IAR1.
The following example shows how to clear a section of four Data Memory locations already defined as
locations adres1 to adres4.
Indirect Addressing Program Example
data .section
¢
data
¢
adres1
db ?
adres2
db ?
adres3
db ?
adres4
db ?
block
db ?
code .section at 0
¢
code
¢
org
00h
start:
mov a,04h
; setup size of block
mov block,a
mov a,offset adres1
; Accumulator loaded with first RAM address
mov mp0,a
; setup memory pointer with first RAM address
loop:
clr IAR0
; clear the data at address defined by MP0
inc mp0
; increment memory pointer
sdz block
; check if last memory location has been cleared
jmp loop
continue:
The important point to note here is that in the example shown above, no reference is made to specific
RAM addresses.
Bank Pointer
-
BP
For this series of devices, the Data Memory is divided into several banks. Selecting the required Data
Memory area is achieved using the Bank Pointer. In the BS83B08-3, BS83B12-3, BS83B16-3 and
BS83B16G-3, the data memory is divided into two banks .The Bit 0 is used to select Data Memory
Banks 0~1. In the BS83C24-3, the data memory is divided into four banks. The Bit 0 and Bit 1 are used
to select Data Memory Banks 0~3.
The Data Memory is initialised to Bank 0 after a reset, except for a WDT time-out reset in the Power
Down Mode, in which case, the Data Memory bank remains unaffected. It should be noted that the
Special Function Data Memory is not affected by the bank selection, which means that the Special
Function Registers can be accessed from within any bank. Directly addressing the Data Memory will
always result in Bank 0 being accessed irrespective of the value of the Bank Pointer. Accessing data
from banks other than Bank 0 must be implemented using indirect addressing.
Rev. 1.50
28
April 28, 2020
BS83B08-3/B12-3/B16-3/B16G-3/C24-3
8-Bit Touch Key Flash MCU