DEBUG FUNCTION
7902 Group User’s Manual
18-11
18.4 Out-of-address-area detection mode
18.4.2 Operations in out-of-address-area detection mode
Setting the detect enable bit to “1” initiate to compare the contents of PG and PC with the contents of
the address compare registers 0 and 1.
When an address less than the contents of the address compare registers 0 or larger than the one of
the address compare register 1 is detected, an address matching detection interrupt request occurs, and
then, this request will be accepted.
Perform the necessary processing with an address matching detection interrupt routine.
The contents of PG, PC, and PS at acceptance of the address matching detection interrupt request are
saved onto the stack area. Therefore, be sure to rewrite the above contents of PG and PC to a certain
return address, and return there by using the RTI instruction.
When an address matching detection interrupt request has been accepted, the interrupt disable flag (I) is
set to “1”; the processor interrupt priority level (IPL) does not change.
By setting the start address of the programming area into the address compare register 0 and the last
address of the programming area into the address compare register 1, a program runaway (in other words,
fetching op codes from the area out of the programming area) can be detected. If any program runaway
is detected and reset of the microcomputer is required, be sure to write “1” into the software reset bit (bit
6 at address 5E16) within an address matching detection interrupt routine.
Figure 18.4.2 shows an example of program runaway detection using the out-of-address-area detection
mode.
Fig. 18.4.2 Example of program runaway detection using out-of-address-area detection mode
TOP_PRG : Start address of programming area
→ This address is to be set into the address compare register 0,
in advance.
END_PRG : Last address of programming area
→ This address is to be set into the address compare register 1,
in advance.
Note: A program runaway may affect the contents of the data bank register (DT), the direct page registers (DPRi) etc.
Therefore, the contents of these registers must be rewritten in order to write “1” to the software reset bit with an
addressing mode using DT, DPRi, etc.
Address matching detection
interrupt routine
RTI
Software reset bit
← 1
(bit 6 at address 5E16)
The microcomputer
is reset.
00000016
TOP_PRG
END_PRG
FFFFFF16
Access to the area
out of the progra-
mming area
Access to the
area out of the
programming
area
Programming area