CHAPTER 2: ARCHITECTURE

2.3.2 Addressing for data memory

For addressing to access the data memory, the index registers X and Y, and stack pointers SP1 and SP2 are used. (The next section will explain the stack pointers.)

Index registers X and Y are both 16-bit registers and cover the entire 64K data memory space. The data memory is accessed by setting an address in the register.

Example:

 

 

LDB

%EXT,0x00

 

LDB

%XL,0x10

...Sets 0010H in the X register

LD

A,[%X]

...Loads the content of the memory address 0010H into the A register

The indirect addressing with the X or Y register permits use of the post-increment function and processing for continuous addresses can be done efficiently. This function can be used in the instruction with [%X]+ or [%Y]+ as an operand. [%X]+ indicates that the content of the X register is incremented after end of transfer or operation, therefore the next address can be accessed without the X register re-setting. It is the same in case of the Y register.

Example: To copy the 3-word data from the address specified with the X register to the area specified with the Y register

LD [%Y]+,[%X]+

LD [%Y]+,[%X]+

LD [%Y],[%X]

In addition, the S1C63000 has also provided instructions in order to efficiently access only the area which is accessed frequently such as the I/O memory and lower addresses.

One of that is the addressing using the EXT register explained in Section 2.1.5.

Accessing for addresses 0000H to 00FFH

For absolute addressing in this area, the EXT register and an indirect instruction with the X register ([%X]) are used. To access this area, first write an 8-bit low-order address (00H to FFH) in the EXT register, then execute an indirect addressing instruction with an operand [%X] (only the instruction that permits the extended addressing). In this case, the content of the X register does not affect the address to be accessed. Also the content of the X register is not changed.

Example:

LDB

%EXT,0x37

 

LD

%A,[%X]

...Works as "LD %A, [0x0037]"

Accessing for addresses FF00H to FFFFH (I/O memory area)

For absolute addressing in this area, the EXT register and an indirect instruction with the Y register ([%Y]) are used. To access this area, first write an 8-bit low-order address (00H to FFH) in the EXT register, then execute an indirect addressing instruction with an operand [%Y] (only the instruction that permits the extended addressing). In this case, the content of the Y register does not affect the address to be accessed. Also the content of the Y register is not changed.

Example:

LDB

%EXT,0x9C

 

ADD

[%Y],5

...Works as "ADD [0xFF9C], 5"

Note: The extended addressing function using the EXT register is effective only for the instruction following immediately after writing data to the EXT register or setting the E flag to "1". For that instruction, do not use instructions other than the instructions that permit the extended addressing. Operation cannot be guaranteed if used.

In addition to the above functions, some 6-bit addressing instructions are provided to directly access that area. These instructions have a [addr6] as the operand and can alone directly access the area 0000H to 003FH or FFC0H to FFFFH.

18

EPSON

S1C63000 CORE CPU MANUAL