CPU Core (M8C)
CY8C24xxx Preliminary Data Sheet
40
Document No. 38-12011 Rev. *E
December 22, 2003
3.4
Instruction Format
The M8C has a total of seven instruction formats which use
instruction lengths of one, two, and three bytes. All instruc-
tion bytes are fetched from the program memory (Flash)
using an address and data bus that are independent from
the address and data buses used for register and RAM
access.
While examples of instructions will be given in this section,
refer to the PSoC Designer Assembly Language User Guide
for detailed information on individual instructions.
3.4.1
One-Byte Instructions
Many instructions, such as some of the
MOV
instructions,
have single-byte forms because they do not use an address
or data as an operand. As shown in
Table 3-3
, one-byte
instructions use an 8-bit opcode. The set of one-byte
instructions can be divided into four categories according to
where their results are stored.
The first category of one-byte instructions are those that do
not update any registers or RAM. Only the one-byte
NOP
and
SSC
instructions fit this category. While the Program
Counter is incremented as these instructions execute they
do not cause any other internal M8C registers to be updated
nor do these instructions directly affect the register space or
the RAM address space. The
SSC
instruction will cause
SROM code to run which will modify RAM and M8C internal
registers.
The second category has only the two
PUSH
instructions in
it. The
PUSH
instructions are unique because they are the
only one-byte instructions that cause a RAM address to be
modified. These instructions automatically increment the
SP
.
The third category has only the
HALT
instruction in it. The
HALT
instruction is unique because it is the only single-byte
instruction that causes a user register to be modified. The
HALT
instruction modifies user register space address
FFh
(
CPU_SCR
).
The final category for single-byte instructions are those that
cause internal M8C registers to be updated. This category
holds the largest number of instructions:
ASL
,
ASR
,
CPL
,
DEC
,
INC
,
MOV
,
POP
,
RET
,
RETI
,
RLC
,
ROMX
,
RRC
,
SWAP
. These instructions can cause the
A
,
X
, and
SP
regis-
ters or SRAM to be updated.
3.4.2
Two-Byte Instructions
The majority of M8C instructions are two bytes in length.
While these instructions can be divided into categories iden-
tical to the one-byte instructions this would not provide a
useful distinction between the three two-byte instruction for-
mats that the M8C uses.
The first two-byte instruction format shown in
Table 3-4
is
used by short jumps and calls:
CALL
,
JMP
,
JACC
,
INDEX
,
JC
,
JNC
,
JNZ
,
JZ
. This instruction format uses only 4-bits
for the instruction opcode leaving 12-bits to store the relative
destination address in a two’s-complement form.These
instructions can change program execution to an address
relative to the current address by -2048 or +2047.
The second two-byte instruction format (
Table 3-4
) is used
by instructions that employ the Source Immediate address-
ing mode (
“Source Immediate” on page 41
). The destination
for these instructions is an internal M8C register while the
source is a constant value. An example of this type of
instruction would be
ADD A, 7
.
The third two-byte instruction format is used by a wide range
of instructions and addressing modes. The following is a list
of the addressing modes that use this third two-byte instruc-
tion format:
Source Direct (
ADD A, [7]
)
Source Indexed (
ADD A, [X+7]
)
Destination Direct (
ADD [7], A
)
Destination Indexed (
ADD [X+7], A
)
Source Indirect Post Increment (
MVI A, [7]
)
Destination Indirect Post Increment (
MVI [7], A
)
I
I
I
I
I
I
For more information on addressing modes see
“Addressing
Modes” on page 41
.
Table 3-3. One-Byte Instruction Format
Byte 0
8-bit opcode
Table 3-4. Two-Byte Instruction Formats
Byte 0
Byte 1
4-bit opcode 12-bit relative address
8-bit opcode
8-bit data
8-bit opcode
8-bit address