
ML66517 Family User’s Manual
Chapter 2
CPU Architecture
2 – 5
(1) Accessing program memory space
Program memory space is accessed by the program counter (PC) and the code segment register (CSR) (CSR
is included only in the ML66517/ML66Q517) . However, when a ROM table reference instruction (such as
LC A, obj) or a ROM window function (refer to Section 4.3) is executed, program memory space is
accessed according to the contents of the table segment register (TSR) and the register specified by the
instruction (TSR is included only in the ML66517/ML66Q517).
Access of the internal ROM area and the external memory area of the program memory space is
automatically switched by internal device operation depending on the status of the
EA pin and the program
address.
In the case of the ML66517/ML66Q517 when a high level is input to the
EA pin, the internal ROM area is
accessed if the program address is between 0000H and 0FFFFH, and the external ROM area is accessed if
the address is between 10000H and 1FFFFH. When the external ROM area is accessed, the secondary
functions of the external memory control pins (port0, 1, 2 and 3) must be set.
When a low level is input to the
EA pin, the external ROM area is accessed for all program addresses. The
area from 0000H to FFFDH can be fetched by the internal program. Therefore, be careful that the final
address of instruction code does not exceed FFFDH. The final address of the table data is FFFFH.
If the external memory area of the program memory space is accessed, Port 0 (address output and data
input), Port 1 (addresses A8 to A15 outputs) and Port 2 (address A16 output) operate as bus ports, and the
P3_0/ALE pin and P3_1/
PSEN pin become active.
(2) Vector table area
The 74-byte area of addresses from 0000H to 0049H and the 10-byte area of addresses from 006AH to
0073H in segment 0 of program memory space are used as the vector table area that stores branch addresses
for all types of resets and interrupts (28 types) as shown in Table 2-1.
If a reset or interrupt occurs, the corresponding 2-byte branch address, stored in the vector table, is loaded
into the PC. (The even address contains the lower order data and the odd address contains the upper order
data.)
At the same time, “0” is loaded into the Code Segment Register (CSR) and program execution
starts from the loaded segment 0 address. Therefore if a reset or interrupt occurs during execution of an
instruction in segment 1 (or segment other than 0), program control will branch to an address in segment 0.
With reasons described above, reset routine and interrupt routines must be located in segment 0. This fact is
important for medium memory model programming. Proper alignment attribute must be applied to your
relocatable interrupt routines.
In medium memory model you specified by MEMSCON setting, CPU automatically provides extra stack
area for the CSR contents. When RTI instruction is executed, CSR contents in stack are re-stored into CSR
and program execution is continued in the same program segment.
If this area is not used as a vector table area, it can be used as a normal program area.
Table 2-1 lists the vector table addresses for each type of reset or interrupt.