Strong electric field, when exposed to a MOS device, can cause destruction of the gate oxide and
ultimately degrade the device operation. Steps must be taken to stop generation of static electricity
as much as possible, and quickly dissipate it once, when it has occurred. Environmental control
must be adequate. When it is dry, humidifier should be used. It is recommended to avoid using
insulators that easily build static electricity. Semiconductor devices must be stored and transported
in an anti-static container, static shielding bag or conductive material. All test and measurement
tools including work bench and floor should be grounded. The operator should be grounded using
wrist strap. Semiconductor devices must not be touched with bare hands. Similar precautions need
to be taken for PW boards with semiconductor devices on it.
2HANDLING OF UNUSED INPUT PINS FOR CMOS
Note:
No connection for CMOS device inputs can be cause of malfunction. If no connection is provided
to the input pins, it is possible that an internal input level may be generated due to noise, etc., hence
causing malfunction. CMOS devices behave differently than Bipolar or NMOS devices. Input levels
of CMOS devices must be fixed high or low by using a pull-up or pull-down circuitry. Each unused
pin should be connected to V
DD
or GND with a resistor, if it is considered to have a possibility of
being an output pin. All handling related to the unused pins must be judged device by device and
related specifications governing the devices.
3STATUS BEFORE INITIALIZATION OF MOS DEVICES
Note:
Power-on does not necessarily define initial status of MOS device. Production process of MOS
does not define the initial operation status of the device. Immediately after the power source is
turned ON, the devices with reset function have not yet been initialized. Hence, power-on does
not guarantee out-pin levels, I/O settings or contents of registers. Device is not initialized until the
reset signal is received. Reset operation must be executed immediately after power-on for devices
having reset function.
Caution: Purchase of NEC I2C components conveys a license under the Philips I2C Patent Rights to use these
components in an I
defined by Philips.
IEBus is a trademark of NEC Corporation.
2
C system, provided that the system conforms to the I2C Standard Specification as
User's Manual U12326EJ4V0UM
3
The export of these products from Japan is regulated by the Japanese government. The export of some or all of these
products may be prohibited without governmental license. To export or re-export some or all of these products from a
country other than Japan may also be prohibited without a license from that country. Please call an NEC sales
representative.
•
The information in this document is current as of August, 2001. The information is subject to
change without notice. For actual design-in, refer to the latest publications of NEC's data sheets or
data books, etc., for the most up-to-date specifications of NEC semiconductor products. Not all
products and/or types are available in every country. Please check with an NEC sales representative
for availability and additional information.
•
No part of this document may be copied or reproduced in any form or by any means without prior
written consent of NEC. NEC assumes no responsibility for any errors that may appear in this document.
•
NEC does not assume any liability for infringement of patents, copyrights or other intellectual property rights of
third parties by or arising from the use of NEC semiconductor products listed in this document or any other
liability arising from the use of such products. No license, express, implied or otherwise, is granted under any
patents, copyrights or other intellectual property rights of NEC or others.
•
Descriptions of circuits, software and other related information in this document are provided for illustrative
purposes in semiconductor product operation and application examples. The incorporation of these
circuits, software and information in the design of customer's equipment shall be done under the full
responsibility of customer. NEC assumes no responsibility for any losses incurred by customers or third
parties arising from the use of these circuits, software and information.
•
While NEC endeavours to enhance the quality, reliability and safety of NEC semiconductor products, customers
agree and acknowledge that the possibility of defects thereof cannot be eliminated entirely. To minimize
risks of damage to property or injury (including death) to persons arising from defects in NEC
semiconductor products, customers must incorporate sufficient safety measures in their design, such as
redundancy, fire-containment, and anti-failure features.
•
NEC semiconductor products are classified into the following three quality grades:
"Standard", "Special" and "Specific". The "Specific" quality grade applies only to semiconductor products
developed based on a customer-designated "quality assurance program" for a specific application. The
recommended applications of a semiconductor product depend on its quality grade, as indicated below.
Customers must check the quality grade of each semiconductor product before using it in a particular
application.
"Standard": Computers, office equipment, communications equipment, test and measurement equipment, audio
and visual equipment, home electronic appliances, machine tools, personal electronic equipment
and industrial robots
systems, anti-crime systems, safety equipment and medical equipment (not specifically designed
for life support)
"Specific": Aircraft, aerospace equipment, submersible repeaters, nuclear reactor control systems, life
support systems and medical equipment for life support, etc.
The quality grade of NEC semiconductor products is "Standard" unless otherwise expressly specified in NEC's
data sheets or data books, etc. If customers wish to use NEC semiconductor products in applications not
intended by NEC, they must contact an NEC sales representative in advance to determine NEC's willingness
to support a given application.
(Note)
(1) "NEC" as used in this statement means NEC Corporation and also includes its majority-owned subsidiaries.
(2) "NEC semiconductor products" means any semiconductor product developed or manufactured by or for
NEC (as defined above).
M8E 00. 4
4
User's Manual U12326EJ4V0UM
Regional Information
Some information contained in this document may vary from country to country. Before using any NEC
product in your application, pIease contact the NEC office in your country to obtain a list of authorized
representatives and distributors. They will verify:
•
Device availability
•
Ordering information
•
Product release schedule
•
Availability of related technical literature
•
Development environment specifications (for example, specifications for third-party tools and
components, host computers, power plugs, AC supply voltages, and so forth)
•
Network requirements
In addition, trademarks, registered trademarks, export restrictions, and other legal issues may also vary
from country to country.
NEC Electronics Inc. (U.S.)
Santa Clara, California
Tel: 408-588-6000
800-366-9782
Fax: 408-588-6130
800-729-9288
Unlike a general-purpose register, each special-function register has a special function.
Special function registers are allocated in the 256-byte area FF00H to FFFFH.
Special function registers can be manipulated, like general-purpose registers, by operation, transfer and bit
manipulation instructions. The manipulatable bit units (1, 8, and 16) differ depending on the special function
register type.
Each manipulation bit unit can be specified as follows.
• 1-bit manipulation
Describes a symbol reserved by the assembler for the 1-bit manipulation instruction operand (sfr.bit). This
manipulation can also be specified by an address.
• 8-bit manipulation
Describes a symbol reserved by the assembler for the 8-bit manipulation instruction operand (sfr). This
manipulation can also be specified by an address.
• 16-bit manipulation
Describes a symbol reserved by the assembler for the 16-bit manipulation instruction operand (sfrp). When
addressing an address, describe an even address.
For details of the special function registers, refer to the user’s manual of each product.
Caution Do not access addresses to which SFRs are not allocated. If an address is erroneously
accessed, the CPU may become deadlocked.
User's Manual U12326EJ4V0UM
19
CHAPTER 3 ADDRESSING
3.1 Instruction Address Addressing
An instruction address is determined by program counter (PC) contents. The PC contents are normally
incremented (+1 for each byte) automatically according to the number of bytes of an instruction to be fetched each
time another instruction is executed. When a branch instruction is executed, the branch destination information
is set to the PC and branched by the following addressing (for details of each instruction, refer to CHAPTER 5
EXPLANATION OF INSTRUCTIONS).
3.1.1 Relative addressing
[Function]
The value obtained by adding 8-bit immediate data (displacement value: jdisp8) of an instruction code to
the start address of the following instruction is transferred to the program counter (PC) and branched. The
displacement value is treated as signed two’s complement data (–128 to +127) and bit 7 becomes a sign
bit. In other words, in relative addressing, the value is relatively transferred to the range between –128 and
+127 from the start address of the following instruction.
This function is carried out when the “BR $addr16” instruction or a conditional branch instruction is executed.
[Illustration]
PC
150
PC
+
150
α
150
When S = 0, α indicates all bits "0".
When S = 1, α indicates all bits "1".
87 6
S
jdisp8
...
PC is the start address of
the next instruction of
a BR instruction.
20
User's Manual U12326EJ4V0UM
CHAPTER 3 ADDRESSING
3.1.2 Immediate addressing
[Function]
Immediate data in the instruction word is transferred to the program counter (PC) and branched.
This function is carried out when the “CALL !addr16” or “BR !addr16” or “CALLF !addr11” instruction is
executed. The CALL !addr16 and BR !addr16 instructions can be branched to all memory spaces. The
CALLF !addr11 instruction is branched to the area of 0800H to 0FFFH.
[Illustration]
CALL !addr16, BR !addr16 instruction
70
CALL or BR
Low Addr.
High Addr.
PC
CALLF !addr11 instruction
PC
150
70
643
fa
10
to fa
8
CALLF
7
to fa
0
fa
150
11 10
87
87
00001
User's Manual U12326EJ4V0UM
21
CHAPTER 3 ADDRESSING
3.1.3 Table indirect addressing
[Function]
Table contents (branch destination address) of the particular location to be addressed by the lower-5-bit
immediate data of an instruction code from bit 1 to bit 5 are transferred to the program counter (PC) and
branched.
When the “CALLT [addr5]” instruction is executed, table indirect addressing is performed. Executing this
instruction enables the value to be branched to all memory spaces referencing the address stored in the
memory table of 40H to 7FH.
[Illustration]
76510
Instruction code
ta
4–0
111
Effective address
Effective address+1
151
00000000
01
70
Memory (Table)
Low addr.
High addr.
150
PC
87
650
87
0
22
User's Manual U12326EJ4V0UM
CHAPTER 3 ADDRESSING
3.1.4 Register addressing
[Function]
The register pair (AX) contents to be specified by an instruction word are transferred to the program counter
(PC) and branched.
This function is carried out when the “BR AX” instruction is executed.
[Illustration]
70
rp
150
PC
AX
07
87
User's Manual U12326EJ4V0UM
23
CHAPTER 3 ADDRESSING
3.2 Operand Address Addressing
The following methods are available to specify the register and memory (addressing) to undergo manipulation
during instruction execution.
3.2.1 Implied addressing
[Function]
This addressing automatically specifies the address of the registers that function as an accumulator (A and
AX) in the general-purpose register area.
Of the 78K/0 Series instruction words, the following instructions employ implied addressing.
InstructionRegister to Be Specified by Implied Addressing
MULUA register for multiplicand and AX register for product storage
DIVUWAX register for dividend and quotient storage
ADJBA/ADJBSA register for storage of numeric values targeted for decimal correction
ROR4/ROL4A register for storage of digit data that undergoes digit rotation
[Operand format]
Because implied addressing can be automatically employed with an instruction, no particular operand format
is necessary.
[Description example]
In the case of MULU X
With an 8-bit x 8-bit multiply instruction, the product of the A register and X register is stored in AX. In this
example, the A and AX registers are specified by implied addressing.
24
User's Manual U12326EJ4V0UM
CHAPTER 3 ADDRESSING
3.2.2 Register addressing
[Function]
Register addressing accesses a general-purpose register as an operand. The general-purpose register to
be accessed is specified by the register bank selection flags (RBS0 and RBS1) and the register specification
codes (Rn and RPn) in the instruction codes.
Register addressing is carried out when an instruction with the following operand format is executed. When
an 8-bit register is specified, one of the eight registers is specified by 3 bits in the instruction code.
[Operand format]
IdentifierDescription
rX, A, C, B, E, D, L, H
rpAX, BC, DE, HL
‘r’ and ‘rp’ can be described with absolute names (R0 to R7 and RP0 to RP3) as well as function names
(X, A, C, B, E, D, L, H, AX, BC, DE and HL).
[Description example]
MOV A, C; When selecting the C register for r
Instruction code01100010
INCW DE; When selecting the DE register pair for rp
Instruction code10000100
Register specification code
Register specification code
User's Manual U12326EJ4V0UM
25
CHAPTER 3 ADDRESSING
3.2.3 Direct addressing
[Function]
Direct addressing directly addresses the memory indicated by the immediate data in the instruction word.
[Operand format]
IdentifierDescription
addr16Label or 16-bit immediate data
[Description example]
MOV A, !FE00H; When setting !addr16 to FE00H
Instruction code1 0001110OP code
0000000000H
11111110FEH
[Illustration]
07
OP code
addr16 (lower)
addr16 (upper)
Memory
26
User's Manual U12326EJ4V0UM
CHAPTER 3 ADDRESSING
3.2.4 Short direct addressing
[Function]
The memory to be manipulated in the fixed space is directly addressed with 8-bit data in an instruction word.
This addressing is applied to the 256-byte fixed space FE20H to FF1FH. An internal high-speed RAM and
special function registers (SFRs) are mapped at FE20H to FEFFH and FF00H to FF1FH, respectively.
The SFR area (FF00H to FF1FH) where short direct addressing is applied is a part of the entire SFR area.
Ports that are frequently accessed in a program, a compare register of the timer/event counter and a capture
register of the timer/event counter are mapped in the area FF00H through FF1FH, and these SFRs can be
manipulated with a small number of bytes and clocks.
When 8-bit immediate data is at 20H to FFH, bit 8 of an effective address is set to 0. When it is at 00H to
1FH, bit 8 is set to 1. See [Illustration] below.
[Operand format]
IdentifierDescription
saddrLabel or FE20H to FF1FH immediate data
saddrpLabel or FE20H to FF1FH immediate data (even address only)
[Description example]
MOV FE30H, #50H; When setting saddr to FE30H and the immediate data to 50H
Instruction code00010001OP code
0011000030H (saddr-offset)
0101000050H (immediate data)
[Illustration]
07
OP code
saddr-offset
Short direct memory
Effective
address
15
1
111111
When 8-bit immediate data is 20H to FFH, α = 0.
When 8-bit immediate data is 00H to 1FH, α = 1.
87
α
0
User's Manual U12326EJ4V0UM
27
CHAPTER 3 ADDRESSING
3.2.5 Special-function register (SFR) addressing
[Function]
A memory-mapped special function register (SFR) is addressed with 8-bit immediate data in an instruction
word.
This addressing is applied to the 240-byte spaces FF00H to FFCFH and FFE0H to FFFFH. However, the
SFRs mapped at FF00H to FF1FH can be accessed with short direct addressing.
[Operand format]
IdentifierDescription
sfrSpecial function register name
sfrp16-bit-manipulatable special function register name (even address only)
[Description example]
MOV PM0, A; When selecting PM0 for sfr
Instruction code11110110OP code
[Illustration]
15
Effective
address
OP code
sfr-offset
1
111111
0010000020H (sfr-offset)
07
87
1
0
SFR
28
User's Manual U12326EJ4V0UM
CHAPTER 3 ADDRESSING
3.2.6 Register indirect addressing
[Function]
Register indirect addressing addresses memory with register pair contents specified as an operand. The
register pair to be accessed is specified by the register bank selection flags (RBS0 and RBS1) and the
register pair specification in instruction codes.
[Operand format]
IdentifierDescription
—
[DE], [HL]
[Description example]
MOV A, [DE]; When selecting register pair [DE]
Instruction code10000101
[Illustration]
1508D7
DE
Contents of memory to be
addressed are transferred
7 0
A
E
Memory
07
Memory address specified
by register pair DE
User's Manual U12326EJ4V0UM
29
CHAPTER 3 ADDRESSING
3.2.7 Based addressing
[Function]
8-bit immediate data is added to the contents of the HL register pair as a base register and the sum is used
to address the memory. The HL register pair to be accessed is in the register bank specified by the register
bank select flag (RBS0 and RBS1). Addition is performed by expanding the offset data as a positive number
to 16 bits. A carry from the 16th bit is ignored. This addressing can be carried out for all the memory spaces.
[Operand format]
IdentifierDescription
—
[HL+byte]
[Description example]
MOV A, [HL+10H]; When setting byte to 10H
Instruction code10101110
00010000
3.2.8 Based indexed addressing
[Function]
The B or C register contents specified in an instruction word are added to the contents of the HL register
pair as a base register and the sum is used to address the memory. The HL, B, and C registers to be accessed
are registers in the register bank specified by the register bank select flag (RBS0 to RBS1). Addition is
performed by expanding the B or C register as a positive number to 16 bits. A carry from the 16th bit is
ignored. This addressing can be carried out for all the memory spaces.
[Operand format]
IdentifierDescription
—
[HL+B], [HL+C]
[Description example]
In the case of MOV A, [HL+B]
Instruction code10101011
30
User's Manual U12326EJ4V0UM
CHAPTER 3 ADDRESSING
3.2.9 Stack addressing
[Function]
The stack area is indirectly addressed with the stack pointer (SP) contents.
This addressing method is automatically employed when the PUSH, POP, subroutine call and RETURN
instructions are executed or the register is saved/reset upon generation of an interrupt request.
Stack addressing enables addressing of the internal high-speed RAM area only.
[Description example]
In the case of PUSH DE
Instruction code10110101
User's Manual U12326EJ4V0UM
31
CHAPTER 4 INSTRUCTION SET
This chapter lists the instructions in the 78K/0 Series instruction set. The instructions are common to all
78K/0 Series products.
4.1 Operation
For the operation list for each product, refer to the user’s manual of each product.
4.1.1 Operand identifiers and description methods
Operands are described in the “Operand” column of each instruction in accordance with the description method
of the instruction operand identifier (refer to the assembler specifications for details). When there are two or more
description methods, select one of them. Alphabetic letters in capitals and the symbols, #, !, $ and [ ] are key
words and are described as they are. Each symbol has the following meaning.
• #: Immediate data specification
• !: Absolute address specification
• $: Relative address specification
• [ ]: Indirect address specification
In the case of immediate data, describe an appropriate numeric value or a label. When using a label, be sure
to describe the #, !, $ and [ ] symbols.
For operand register identifiers, r and rp, either function names (X, A, C, etc.) or absolute names (names in
parentheses in the table below, R0, R1, R2, etc.) can be used for description.
Table 4-1. Operand Identifiers and Description Methods
IdentifierDescription Method
rX (R0), A (R1), C (R2), B (R3), E (R4), D (R5), L (R6), H (R7)
rpAX (RP0), BC (RP1), DE (RP2), HL (RP3)
sfrSpecial-function register symbol
sfrpSpecial-function register symbols (16-bit manipulatable register even addresses only)
saddrFE20H to FF1FH Immediate data or labels
saddrpFE20H to FF1FH Immediate data or labels (even addresses only)
addr160000H to FFFFH Immediate data or labels (Only even addresses for 16-bit data transfer instructions)
addr110800H to 0FFFH Immediate data or labels
addr50040H to 007FH Immediate data or labels (even addresses only)
word16-bit immediate data or label
byte8-bit immediate data or label
bit3-bit immediate data or label
RBnRB0 to RB3
Note
Note
Note FFD0H to FFDFH are not addressable.
Remark Refer to the user’s manual of each product for the symbols of special function registers.
This chapter explains the instructions of 78K/0 Series products. Each instruction is described with a mnemonic,
including description of multiple operands.
The basic configuration of instruction description is shown on the next page.
For the number of instruction bytes and the instruction codes, refer to the user’s manual of each product and
CHAPTER 4 INSTRUCTION SET, respectively.
All the instructions are common to 78K/0 Series products.
46
User's Manual U12326EJ4V0UM
CHAPTER 5 EXPLANATION OF INSTRUCTIONS
DESCRIPTION EXAMPLE
MnemonicFull name
MOV
Meaning of instruction
[Instruction format]MOV dst, src: Indicates the basic description format of the instruction.
[Operation]dst ← src: Indicates instruction operation using symbols.
[Operand]Indicates operands that can be specified by this instruction. Refer to 4.1 Operation for
the description of each operand symbol.
MnemonicOperand(dst,src)MnemonicOperand(dst,src)
Byte Data Transfer
Move
MOVr, #byteMOVA, PSW
~
A, saddr[HL], A
~
saddr, AA, [HL+byte]
~
PSW, #byte[HL+C], A
~
[Flag]Indicates the flag operation that changes by instruction execution.
Each flag operation symbol is shown in the conventions.
~
~
~
~
~
~
~
~
~
~
~
~
ZACCY
Conventions
SymbolDescription
BlankUnchanged
0Cleared to 0
1Set to 1
XSet or cleared according to the result
RPreviously saved value is restored
[Description]: Describes the instruction operation in detail.
• The contents of the source operand (src) specified by the 2nd operand are transferred to the destination
operand (dst) specified by the 1st operand.
[Description example]
MOV A, #4DH; 4DH is transferred to the A register.
User's Manual U12326EJ4V0UM
47
CHAPTER 5 EXPLANATION OF INSTRUCTIONS
5.1 8-Bit Data Transfer Instructions
The following instructions are 8-bit data transfer instructions.
MOV ... 49
XCH ... 50
48
User's Manual U12326EJ4V0UM
CHAPTER 5 EXPLANATION OF INSTRUCTIONS
MOV
[Instruction format]MOV dst, src
[Operation]dst ← src
[Operand]
MnemonicOperand(dst,src)MnemonicOperand(dst,src)
MOVr, #byteMOVA, PSW
saddr, #bytePSW, A
sfr, #byteA, [DE]
A, r
r, A
A, saddr[HL], A
saddr, AA, [HL+byte]
A, sfr[HL+byte], A
Note
Note
Move
Byte Data Transfer
[DE], A
A, [HL]
sfr, AA, [HL+B]
A, !addr16[HL+B], A
!addr16, AA, [HL+C]
PSW, #byte[HL+C], A
Note Except r = A
[Flag]
PSW, #byte and PSW,All other operand
A operandscombinations
ZACCYZACCY
×××
[Description]
• The contents of the source operand (src) specified by the 2nd operand are transferred to the destination
operand (dst) specified by the 1st operand.
• No interrupts are acknowledged between the MOV PSW, #byte instruction/MOV PSW, A instruction and the
next instruction.
[Description example]
MOV A, #4DH; 4DH is transferred to the A register.
User's Manual U12326EJ4V0UM
49
CHAPTER 5 EXPLANATION OF INSTRUCTIONS
XCH
[Instruction format]XCH dst, src
[Operation]dst ↔ src
[Operand]
MnemonicOperand(dst,src)MnemonicOperand(dst,src)
XCHA, r
A, saddrA, [HL+byte]
A, sfrA, [HL+B]
A, !addr16A, [HL+C]
A, [DE]
Note Except r = A
[Flag]
Note
Exchange
Byte Data Exchange
XCHA, [HL]
ZACCY
[Description]
• The 1st and 2nd operand contents are exchanged.
[Description example]
XCH A, FEBCH; The A register contents and address FEBCH contents are exchanged.
50
User's Manual U12326EJ4V0UM
CHAPTER 5 EXPLANATION OF INSTRUCTIONS
5.2 16-Bit Data Transfer Instructions
The following instructions are 16-bit data transfer instructions.
MOVW ... 52
XCHW ... 53
User's Manual U12326EJ4V0UM
51
CHAPTER 5 EXPLANATION OF INSTRUCTIONS
MOVW
[Instruction format]MOVW dst, src
[Operation]dst ← src
[Operand]
MnemonicOperand(dst,src)MnemonicOperand(dst,src)
MOVWrp, #wordMOVWsfrp, AX
saddrp, #wordAX, rp
sfrp, #wordrp, AX
AX, saddrpAX, !addr16
saddrp, AX!addr16, AX
AX, sfrp
Note Only when rp = BC, DE or HL
Move Word
Word Data Transfer
Note
Note
[Flag]
ZACCY
[Description]
• The contents of the source operand (src) specified by the 2nd operand are transferred to the destination
operand (dst) specified by the 1st operand.
[Description example]
MOVW AX, HL; The HL register contents are transferred to the AX register.
[Caution]
Only an even address can be specified. An odd address cannot be specified.
52
User's Manual U12326EJ4V0UM
CHAPTER 5 EXPLANATION OF INSTRUCTIONS
XCHW
[Instruction format]XCHW dst, src
[Operation]dst ↔ src
[Operand]
MnemonicOperand(dst,src)
XCHWAX, rp
Note Only when rp = BC, DE or HL
[Flag]
ZACCY
[Description]
• The 1st and 2nd operand contents are exchanged.
Note
Exchange Word
Word Data Exchange
[Description example]
XCHW AX, BC; The memory contents of the AX register are exchanged with those of the BC register.
User's Manual U12326EJ4V0UM
53
CHAPTER 5 EXPLANATION OF INSTRUCTIONS
5.3 8-Bit Operation Instructions
The following are 8-bit operation instructions.
ADD ... 55
ADDC ... 56
SUB ... 57
SUBC ... 58
AND ... 59
OR ... 60
XOR ... 61
CMP ... 62
54
User's Manual U12326EJ4V0UM
CHAPTER 5 EXPLANATION OF INSTRUCTIONS
ADD
[Instruction format]ADD dst, src
[Operation]dst, CY ← dst + src
[Operand]
MnemonicOperand(dst,src)MnemonicOperand(dst,src)
ADDA, #byteADDA, !addr16
saddr, #byteA, [HL]
A, r
r, AA, [HL+B]
A, saddrA, [HL+C]
Note Except r = A
[Flag]
Note
Add
Byte Data Addition
A, [HL+byte]
ZACCY
×××
[Description]
• The destination operand (dst) specified by the 1st operand is added to the source operand (src) specified
by the 2nd operand and the result is stored in the CY flag and the destination operand (dst).
• If the addition result shows that dst is 0, the Z flag is set (1). In all other cases, the Z flag is cleared (0).
• If the addition generates a carry out of bit 7, the CY flag is set (1). In all other cases, the CY flag is cleared
(0).
• If the addition generates a carry for bit 4 out of bit 3, the AC flag is set (1). In all other cases, the AC flag
is cleared (0).
[Description example]
ADD CR10, #56H; 56H is added to the CR10 register and the result is stored in the CR10 register.
User's Manual U12326EJ4V0UM
55
CHAPTER 5 EXPLANATION OF INSTRUCTIONS
ADDC
[Instruction format]ADDC dst, src
[Operation]dst, CY ← dst + src + CY
[Operand]
MnemonicOperand(dst,src)MnemonicOperand(dst,src)
ADDCA, #byteADDCA, !addr16
saddr, #byteA, [HL]
A, r
r, AA, [HL+B]
A, saddrA, [HL+C]
Note Except r = A
[Flag]
Note
Add with Carry
Addition of Byte Data with Carry
A, [HL+byte]
ZACCY
×××
[Description]
• The destination operand (dst) specified by the 1st operand, the source operand (src) specified by the 2nd
operand and the CY flag are added and the result is stored in the destination operand (dst) and the CY flag.
The CY flag is added to the least significant bit. This instruction is mainly used to add two or more bytes.
• If the addition result shows that dst is 0, the Z flag is set (1). In all other cases, the Z flag is cleared (0).
• If the addition generates a carry out of bit 7, the CY flag is set (1). In all other cases, the CY flag is cleared
(0).
• If the addition generates a carry for bit 4 out of bit 3, the AC flag is set (1). In all other cases, the AC flag
is cleared (0).
[Description example]
ADDC A, [HL+B]; The A register contents and the contents at address (HL register + (B register)) and the
CY flag are added and the result is stored in the A register.
56
User's Manual U12326EJ4V0UM
CHAPTER 5 EXPLANATION OF INSTRUCTIONS
SUB
[Instruction format]SUB dst, src
[Operation]dst, CY ← dst – src
[Operand]
MnemonicOperand(dst,src)MnemonicOperand(dst,src)
SUBA, #byteSUBA, !addr16
saddr, #byteA, [HL]
A, r
r, AA, [HL+B]
A, saddrA, [HL+C]
Note Except r = A
[Flag]
Note
Subtract
Byte Data Subtraction
A, [HL+byte]
ZACCY
×××
[Description]
• The source operand (src) specified by the 2nd operand is subtracted from the destination operand (dst)
specified by the 1st operand and the result is stored in the destination operand (dst) and the CY flag.
The destination operand can be cleared to 0 by equalizing the source operand (src) and the destination
operand (dst).
• If the subtraction shows that dst is 0, the Z flag is set (1). In all other cases, the Z flag is cleared (0).
• If the subtraction generates a borrow out of bit 7, the CY flag is set (1). In all other cases, the CY flag is
cleared (0).
• If the subtraction generates a borrow for bit 3 out of bit 4, the AC flag is set (1). In all other cases, the AC
flag is cleared (0).
[Description example]
SUB D, A; The A register is subtracted from the D register and the result is stored in the D register.
User's Manual U12326EJ4V0UM
57
CHAPTER 5 EXPLANATION OF INSTRUCTIONS
SUBC
[Instruction format]SUBC dst, src
[Operation]dst, CY ← dst – src – CY
[Operand]
MnemonicOperand(dst,src)MnemonicOperand(dst,src)
SUBCA, #byteSUBCA, !addr16
saddr, #byteA, [HL]
A, r
r, AA, [HL+B]
A, saddrA, [HL+C]
Note Except r = A
[Flag]
Note
Subtract with Carry
Subtraction of Byte Data with Carry
A, [HL+byte]
ZACCY
×××
[Description]
• The source operand (src) specified by the 2nd operand and the CY flag are subtracted from the destination
operand (dst) specified by the 1st operand and the result is stored in the destination operand (dst).
The CY flag is subtracted from the least significant bit. This instruction is mainly used for subtraction of two
or more bytes.
• If the subtraction shows that dst is 0, the Z flag is set (1). In all other cases, the Z flag is cleared (0).
• If the subtraction generates a borrow out of bit 7, the CY flag is set (1). In all other cases, the CY flag is
cleared (0).
• If the subtraction generates a borrow for bit 3 out of bit 4, the AC flag is set (1). In all other cases, the AC
flag is cleared (0).
[Description example]
SUBC A, [HL]; The (HL register) address contents and the CY flag are subtracted from the A register and
the result is stored in the A register.
58
User's Manual U12326EJ4V0UM
CHAPTER 5 EXPLANATION OF INSTRUCTIONS
AND
[Instruction format]AND dst, src
[Operation]dst ← dst ∧ src
[Operand]
MnemonicOperand(dst,src)MnemonicOperand(dst,src)
ANDA, #byteANDA, !addr16
saddr, #byteA, [HL]
A, r
r, AA, [HL+B]
A, saddrA, [HL+C]
Note Except r = A
[Flag]
Note
And
Logical Product of Byte Data
A, [HL+byte]
ZACCY
×
[Description]
• Bit-wise logical product is obtained from the destination operand (dst) specified by the 1st operand and the
source operand (src) specified by the 2nd operand and the result is stored in the destination operand (dst).
• If the logical product shows that all bits are 0, the Z flag is set (1). In all other cases, the Z flag is cleared
(0).
[Description example]
AND FEBAH, #11011100B; Bit-wise logical product of FEBAH contents and 11011100B is obtained and the
result is stored at FEBAH.
User's Manual U12326EJ4V0UM
59
CHAPTER 5 EXPLANATION OF INSTRUCTIONS
OR
[Instruction format]OR dst, src
[Operation]dst ← dst ∨ src
[Operand]
MnemonicOperand(dst,src)MnemonicOperand(dst,src)
ORA, #byteORA, !addr16
saddr, #byteA, [HL]
A, r
r, AA, [HL+B]
A, saddrA, [HL+C]
Note Except r = A
[Flag]
Note
Or
Logical Sum of Byte Data
A, [HL+byte]
ZACCY
×
[Description]
• The bit-wise logical sum is obtained from the destination operand (dst) specified by the 1st operand and the
source operand (src) specified by the 2nd operand and the result is stored in the destination operand (dst).
• If the logical sum shows that all bits are 0, the Z flag is set (1). In all other cases, the Z flag is cleared (0).
[Description example]
OR A, FE98H; The bit-wise logical sum of the A register and FE98H is obtained and the result is stored in
the A register.
60
User's Manual U12326EJ4V0UM
CHAPTER 5 EXPLANATION OF INSTRUCTIONS
XOR
[Instruction format]XOR dst, src
[Operation]dst ← dst ∨
[Operand]
MnemonicOperand(dst,src)MnemonicOperand(dst,src)
XORA, #byteXORA, !addr16
saddr, #byteA, [HL]
A, r
r, AA, [HL+B]
A, saddrA, [HL+C]
Note Except r = A
[Flag]
src
Note
Exclusive Or
Exclusive Logical Sum of Byte Data
A, [HL+byte]
ZACCY
×
[Description]
• The bit-wise exclusive logical sum is obtained from the destination operand (dst) specified by the 1st operand
and the source operand (src) specified by the 2nd operand and the result is stored in the destination operand
(dst).
Logical negation of all bits of the destination operand (dst) is possible by selecting #0FFH for the source
operand (src) with this instruction.
• If the exclusive logical sum shows that all bits are 0, the Z flag is set (1). In all other cases, the Z flag is
cleared (0).
[Description example]
XOR A, L; The bit-wise exclusive logical sum of the A and L registers is obtained and the result is stored in
the A register.
User's Manual U12326EJ4V0UM
61
CHAPTER 5 EXPLANATION OF INSTRUCTIONS
CMP
[Instruction format]CMP dst, src
[Operation]dst – src
[Operand]
MnemonicOperand(dst,src)MnemonicOperand(dst,src)
CMPA, #byteCMPA, !addr16
saddr, #byteA, [HL]
A, r
r, AA, [HL+B]
A, saddrA, [HL+C]
Note Except r = A
[Flag]
Note
Compare
Byte Data Comparison
A, [HL+byte]
ZACCY
×××
[Description]
• The source operand (src) specified by the 2nd operand is subtracted from the destination operand (dst)
specified by the 1st operand.
The subtraction result is not stored anywhere and only the Z, AC and CY flags are changed.
• If the subtraction result is 0, the Z flag is set (1). In all other cases, the Z flag is cleared (0).
• If the subtraction generates a borrow out of bit 7, the CY flag is set (1). In all other cases, the CY flag is
cleared (0).
• If the subtraction generates a borrow for bit 3 out of bit 4, the AC flag is set (1). In all other cases, the AC
flag is cleared (0).
[Description example]
CMP FE38H, #38H;38H is subtracted from the contents at address FE38H and only the flags are changed
(comparison of contents at address FE38H and the immediate data).
62
User's Manual U12326EJ4V0UM
CHAPTER 5 EXPLANATION OF INSTRUCTIONS
5.4 16-Bit Operation Instructions
The following are 16-bit operation instructions.
ADDW ... 64
SUBW ... 65
CMPW ... 66
User's Manual U12326EJ4V0UM
63
CHAPTER 5 EXPLANATION OF INSTRUCTIONS
ADDW
Add Word
Word Data Addition
[Instruction format]ADDW dst, src
[Operation]dst, CY ← dst + src
[Operand]
MnemonicOperand(dst,src)
ADDWAX, #word
[Flag]
ZACCY
×××
[Description]
• The destination operand (dst) specified by the 1st operand is added to the source operand (src) specified
by the 2nd operand and the result is stored in the destination operand (dst).
• If the addition result shows that dst is 0, the Z flag is set (1). In all other cases, the Z flag is cleared (0).
• If the addition generates a carry out of bit 15, the CY flag is set (1). In all other cases, the CY flag is cleared
(0).
• As a result of addition, the AC flag becomes undefined.
[Description example]
ADDW AX, #ABCDH; ABCDH is added to the AX register and the result is stored in the AX register.
64
User's Manual U12326EJ4V0UM
CHAPTER 5 EXPLANATION OF INSTRUCTIONS
SUBW
[Instruction format]SUBW dst, src
[Operation]dst, CY ← dst – src
[Operand]
MnemonicOperand(dst,src)
SUBWAX, #word
[Flag]
ZACCY
×××
[Description]
• The source operand (src) specified by the 2nd operand is subtracted from the destination operand (dst)
specified by the 1st operand and the result is stored in the destination operand (dst) and the CY flag.
The destination operand can be cleared to 0 by equalizing the source operand (src) and the destination
operand (dst).
• If the subtraction shows that dst is 0, the Z flag is set (1). In all other cases, the Z flag is cleared (0).
• If the subtraction generates a borrow out of bit 15, the CY flag is set (1). In all other cases, the CY flag is
cleared (0).
• As a result of subtraction, the AC flag becomes undefined.
Word Data Subtraction
Subtract Word
[Description example]
SUBW AX, #ABCDH; ABCDH is subtracted from the AX register contents and the result is stored in the AX
register.
User's Manual U12326EJ4V0UM
65
CHAPTER 5 EXPLANATION OF INSTRUCTIONS
CMPW
Compare Word
Word Data Comparison
[Instruction format]CMPW dst, src
[Operation]dst – src
[Operand]
MnemonicOperand(dst,src)
CMPW AX, #word
[Flag]
ZACCY
×××
[Description]
• The source operand (src) specified by the 2nd operand is subtracted from the destination operand (dst)
specified by the 1st operand.
The subtraction result is not stored anywhere and only the Z, AC and CY flags are changed.
• If the subtraction result is 0, the Z flag is set (1). In all other cases, the Z flag is cleared (0).
• If the subtraction generates a borrow out of bit 15, the CY flag is set (1). In all other cases, the CY flag is
cleared (0).
• As a result of subtraction, the AC flag becomes undefined.
[Description example]
CMPW AX, #ABCDH; ABCDH is subtracted from the AX register and only the flags are changed (comparison
of the AX register and the immediate data).
66
User's Manual U12326EJ4V0UM
CHAPTER 5 EXPLANATION OF INSTRUCTIONS
5.5 Multiply/Divide Instructions
The following are multiply/divide instructions.
MULU ... 68
DIVUW ... 69
User's Manual U12326EJ4V0UM
67
CHAPTER 5 EXPLANATION OF INSTRUCTIONS
MULU
[Instruction format]MULU src
[Operation]AX ← A × src
[Operand]
MnemonicOperand(src)
MULUX
[Flag]
ZACCY
[Description]
• The A register contents and the source operand (src) data are multiplied as unsigned data and the result
is stored in the AX register.
Unsigned Multiplication of Data
Multiply Unsigned
[Description example]
MULU X; The A register contents and the X register contents are multiplied and the result is stored in the AX
ROR4 [HL]; Rightward digit rotation is executed with the memory contents specified by the A and HL registers.
A(HL)
7430 7430
Before Execution1010001111000101
After Execution1010010100111100
80
User's Manual U12326EJ4V0UM
CHAPTER 5 EXPLANATION OF INSTRUCTIONS
ROL4
Digit Rotation to the Left
[Instruction format]ROL4 dst
Rotate Left Digit
[Operation]A
3-0← (dst)7-4, (dst)3-0← A3-0, (dst)7-4← (dst)3-0
[Operand]
MnemonicOperand(dst)
ROL4 [HL]
Note Specify an area other than the SFR area as operand [HL].
Note
[Flag]
ZACCY
[Description]
• The lower 4 bits of the A register and the 2-digit data (4-bit data) of the destination operand (dst) are rotated
to the left.
The higher 4 bits of the A register remain unchanged.
347
A
dst
00347
[Description example]
ROL4 [HL]; Leftward digit rotation is executed with the memory contents specified by the A and HL registers.
A(HL)
7430 7430
Before Execution0001001001001000
After Execution0001010010000010
User's Manual U12326EJ4V0UM
81
CHAPTER 5 EXPLANATION OF INSTRUCTIONS
5.8 BCD Adjust Instructions
The following are BCD adjust instructions.
ADJBA ... 83
ADJBS ... 84
82
User's Manual U12326EJ4V0UM
CHAPTER 5 EXPLANATION OF INSTRUCTIONS
ADJBA
Decimal Adjustment of Addition Result
[Instruction format]ADJBA
[Operation]Decimal Adjust Accumulator for Addition
[Operand]
None
[Flag]
Decimal Adjust Register for Addition
ZACCY
×××
[Description]
• The A register, CY flag and AC flag are decimally adjusted from their contents. This instruction carries out
an operation having meaning only when the BCD (binary coded decimal) data is added and the addition result
is stored in the A register (in all other cases, the instruction carries out an operation having no meaning).
See the table below for the adjustment method.
• If the adjustment result shows that the A register contents are 0, the Z flag is set (1). In all other cases,
the Z flag is cleared (0).
ConditionOperation
A3 to A0≤ 9A7 to A4≤ 9 and CY = 0A ← A, CY ← 0, AC ← 0
AC = 0A7 to A4≥ 10 or CY = 1A ← A+01100000B, CY ← 1, AC ← 0
A3 to A0≥ 10A7 to A4 < 9 and CY = 0A ← A+00000110B, CY ← 0, AC ← 1
AC = 0A7 to A4≥ 9 or CY = 1A ← A+01100110B, CY ← 1, AC ← 1
AC = 1A7 to A4≤ 9 and CY = 0A ← A+00000110B, CY ← 0, AC ← 0
A7 to A4≥ 10 or CY = 1A ← A+01100110B, CY ← 1, AC ← 0
User's Manual U12326EJ4V0UM
83
CHAPTER 5 EXPLANATION OF INSTRUCTIONS
ADJBS
Decimal Adjustment of Subtraction Result
[Instruction format]ADJBS
[Operation]Decimal Adjust Accumulator for Subtraction
[Operand]
None
[Flag]
Decimal Adjust Register for Subtraction
ZACCY
×××
[Description]
• The A register, CY flag and AC flag are decimally adjusted from their contents. This instruction carries out
an operation having meaning only when the BCD (binary coded decimal) data is subtracted and the
subtraction result is stored in the A register (in all other cases, the instruction carries out an operation having
no meaning).
See the table below for the adjustment method.
• If the adjustment result shows that the A register contents are 0, the Z flag is set (1). In all other cases,
the Z flag is cleared (0).
ConditionOperation
AC = 0CY = 0A ← A, CY ← 0, AC ← 0
CY = 1A ← A–01100000B, CY ← 1, AC ← 0
AC = 1CY = 0A ← A–00000110B, CY ← 0, AC ← 0
CY = 1A ← A–01100110B, CY ← 1, AC ← 0
84
User's Manual U12326EJ4V0UM
CHAPTER 5 EXPLANATION OF INSTRUCTIONS
5.9 Bit Manipulation Instructions
The following are bit manipulation instructions.
MOV1 ... 86
AND1 ... 87
OR1 ... 88
XOR1 ... 89
SET1 ... 90
CLR1 ... 91
NOT1 ... 92
User's Manual U12326EJ4V0UM
85
CHAPTER 5 EXPLANATION OF INSTRUCTIONS
MOV1
[Instruction format]MOV1 dst, src
[Operation]dst ← src
[Operand]
MnemonicOperand(dst,src)MnemonicOperand(dst,src)
MOV1CY, saddr.bitMOV1saddr.bit, CY
CY, sfr.bitsfr.bit, CY
CY, A.bitA.bit, CY
CY, PSW.bitPSW.bit, CY
CY, [HL].bit[HL].bit, CY
[Flag]
dst = CYPSW.bitIn all other cases
Move Single Bit
1 Bit Data Transfer
ZACCYZACCYZACCY
×××
[Description]
• Bit data of the source operand (src) specified by the 2nd operand is transferred to the destination operand
(dst) specified by the 1st operand.
• When the destination operand (dst) is CY or PSW.bit, only the corresponding flag is changed.
[Description example]
MOV1 P3.4, CY; The CY flag contents are transferred to bit 4 of port 3.
86
User's Manual U12326EJ4V0UM
CHAPTER 5 EXPLANATION OF INSTRUCTIONS
AND1
[Instruction format]AND1 dst, src
[Operation]dst ← dst ∧ src
[Operand]
MnemonicOperand(dst,src)
AND1CY, saddr.bit
CY, sfr.bit
CY, A.bit
CY, PSW.bit
CY, [HL].bit
[Flag]
ZACCY
And Single Bit
1 Bit Data Logical Product
×
[Description]
• Logical product of bit data of the destination operand (dst) specified by the 1st operand and the source
operand (src) specified by the 2nd operand is obtained and the result is stored in the destination operand
(dst).
• The operation result is stored in the CY flag (because of the destination operand (dst)).
[Description example]
AND1 CY, FE7FH.3; Logical product of FE7FH bit 3 and the CY flag is obtained and the result is stored in
the CY flag.
User's Manual U12326EJ4V0UM
87
CHAPTER 5 EXPLANATION OF INSTRUCTIONS
OR1
[Instruction format]OR1 dst, src
[Operation]dst ← dst ∨ src
[Operand]
MnemonicOperand(dst,src)
OR1CY, saddr.bit
CY, sfr.bit
CY, A.bit
CY, PSW.bit
CY, [HL].bit
[Flag]
ZACCY
Or Single Bit
1 Bit Data Logical Sum
×
[Description]
• The logical sum of bit data of the destination operand (dst) specified by the 1st operand and the source
operand (src) specified by the 2nd operand is obtained and the result is stored in the destination operand
(dst).
• The operation result is stored in the CY flag (because of the destination operand (dst)).
[Description example]
OR1 CY, P2.5; The logical sum of port 2 bit 5 and the CY flag is obtained and the result is stored in the CY
flag.
88
User's Manual U12326EJ4V0UM
CHAPTER 5 EXPLANATION OF INSTRUCTIONS
XOR1
[Instruction format]XOR1 dst, src
[Operation]dst ← dst ∨
[Operand]
MnemonicOperand(dst,src)
XOR1CY, saddr.bit
CY, sfr.bit
CY, A.bit
CY, PSW.bit
CY, [HL].bit
[Flag]
ZACCY
×
src
Exclusive Or Single Bit
1 Bit Data Exclusive Logical Sum
[Description]
• The exclusive logical sum of bit data of the destination operand (dst) specified by the 1st operand and the
source operand (src) specified by the 2nd operand is obtained and the result is stored in the destination
operand (dst).
• The operation result is stored in the CY flag (because of the destination operand (dst)).
[Description example]
XOR1 CY, A.7; The exclusive logical sum of the A register bit 7 and the CY flag is obtained and the result
is stored in the CY flag.
User's Manual U12326EJ4V0UM
89
CHAPTER 5 EXPLANATION OF INSTRUCTIONS
SET1
[Instruction format]SET1 dst
[Operation]dst ←1
[Operand]
MnemonicOperand(dst)
SET1saddr.bit
sfr.bit
A.bit
PSW.bit
[HL].bit
CY
[Flag]
Set Single Bit (Carry Flag)
1 Bit Data Set
dst = PSW.bitdst = CYIn all other cases
ZACCYZACCYZACCY
×××1
[Description]
• The destination operand (dst) is set (1).
• When the destination operand (dst) is CY or PSW.bit, only the corresponding flag is set (1).
[Description example]
SET1 FE55H.1; Bit 1 of FE55H is set (1).
90
User's Manual U12326EJ4V0UM
CHAPTER 5 EXPLANATION OF INSTRUCTIONS
CLR1
[Instruction format]CLR1 dst
[Operation]dst ← 0
[Operand]
MnemonicOperand(dst)
CLR1saddr.bit
sfr.bit
A.bit
PSW.bit
[HL].bit
CY
[Flag]
Clear Single Bit (Carry Flag)
1 Bit Data Clear
dst = PSW.bitdst = CYIn all other cases
ZACCYZACCYZACCY
×××0
[Description]
• The destination operand (dst) is cleared (0).
• When the destination operand (dst) is CY or PSW.bit, only the corresponding flag is cleared (0).
[Description example]
CLR1 P3.7; Bit 7 of port 3 is cleared (0).
User's Manual U12326EJ4V0UM
91
CHAPTER 5 EXPLANATION OF INSTRUCTIONS
NOT1
[Instruction format]NOT1 dst
[Operation]dst ← dst
[Operand]
MnemonicOperand(dst)
NOT1CY
[Flag]
ZACCY
×
[Description]
• The CY flag is inverted.
Not Single Bit (Carry Flag)
1 Bit Data Logical Negation
[Description example]
NOT1 CY; The CY flag is inverted.
92
User's Manual U12326EJ4V0UM
CHAPTER 5 EXPLANATION OF INSTRUCTIONS
5.10 Call Return Instructions
The following are call return instructions.
CALL ... 94
CALLF ... 95
CALLT ... 96
BRK ... 97
RET ... 98
RETI ... 99
RETB ... 100
User's Manual U12326EJ4V0UM
93
CHAPTER 5 EXPLANATION OF INSTRUCTIONS
CALL
[Instruction format]CALL target
[Operation](SP–1) ← (PC+3)
(SP–2) ← (PC+3)
SP← SP–2,
PC← target
[Operand]
MnemonicOperand(target)
CALL!addr16
[Flag]
ZACCY
Call
Subroutine Call (16 Bit Direct)
H,
L,
[Description]
• This is a subroutine call with a 16-bit absolute address or a register indirect address.
• The start address (PC+3) of the next instruction is saved in the stack and is branched to the address specified
by the target operand (target).
[Description example]
CALL !3059H; Subroutine call to 3059H
94
User's Manual U12326EJ4V0UM
CHAPTER 5 EXPLANATION OF INSTRUCTIONS
CALLF
[Instruction format]CALLF Target
[Operation](SP–1) ← (PC+2)H,
(SP–2) ← (PC+2)
SP← SP–2,
PC← target
[Operand]
MnemonicOperand(target)
CALLF!addr11
[Flag]
ZACCY
L,
Call Flag
Subroutine Call (11 Bit Direct Specification)
[Description]
• This is a subroutine call which can only be branched to addresses 0800H to 0FFFH.
• The start address (PC+2) of the next instruction is saved in the stack and is branched in the range of
addresses 0800H to 0FFFH.
• Only the lower 11 bits of an address are specified (with the higher 5 bits fixed to 00001B).
• The program size can be compressed by locating the subroutine at 0800H to 0FFFH and using this
instruction. If the program is in the external memory, the execution time can be decreased.
[Description example]
CALLF !0C2AH; Subroutine call to 0C2AH
User's Manual U12326EJ4V0UM
95
CHAPTER 5 EXPLANATION OF INSTRUCTIONS
CALLT
[Instruction format]CALLT [addr5]
[Operation](SP–1) ← (PC+1)
(SP–2) ← (PC+1)
SP← SP–2,
H← (00000000, addr5+1)
PC
PC
L← (00000000, addr5)
[Operand]
MnemonicOperand([addr5])
CALLT[addr5]
[Flag]
ZACCY
Call Table
Subroutine Call (Refer to the Call Table)
H,
L,
[Description]
• This is a subroutine call for call table reference.
• The start address (PC+1) of the next instruction is saved in the stack and is branched to the address indicated
with the word data of a call table (the higher 8 bits of address are fixed to 00000000B and the next 5 bits
are specified by addr5).
[Description example]
CALLT [40H]; Subroutine call to the word data addresses 0040H and 0041H.
96
User's Manual U12326EJ4V0UM
CHAPTER 5 EXPLANATION OF INSTRUCTIONS
BRK
[Instruction format]BRK
[Operation](SP–1) ← PSW,
(SP–2) ← (PC+1)
(SP–3) ← (PC+1)L,
IE← 0,
SP← SP–3,
H← (3FH),
PC
L← (3EH)
PC
[Operand]
None
[Flag]
ZACCY
Break
Software Vectored Interrupt
H,
[Description]
• This is a software interrupt instruction.
• PSW and the next instruction address (PC+1) are saved to the stack. After that, the IE flag is cleared (0)
and the saved data is branched to the address indicated with the word data at the vector address (003EH).
Because the IE flag is cleared (0), the subsequent maskable vectored interrupts are disabled.
• The RETB instruction is used to return from the software vectored interrupt generated with this instruction.
User's Manual U12326EJ4V0UM
97
CHAPTER 5 EXPLANATION OF INSTRUCTIONS
RET
[Instruction format]RET
[Operation]PC
[Operand]
None
[Flag]
ZACCY
[Description]
• This is a return instruction from the subroutine call made with the CALL, CALLF and CALLT instructions.
• The word data saved to the stack returns to the PC, and the program returns from the subroutine.
L ← (SP),
PCH ← (SP+1),
SP ← SP+2
Return from Subroutine
Return
98
User's Manual U12326EJ4V0UM
CHAPTER 5 EXPLANATION OF INSTRUCTIONS
RETI
Return from Hardware Vectored Interrupt
[Instruction format]RETI
Return from Interrupt
[Operation]PC
L← (SP),
PCH← (SP+1),
PSW ← (SP+2),
SP ← SP+3,
NMIS ← 0
[Operand]
None
[Flag]
ZACCY
RRR
[Description]
• This is a return instruction from the vectored interrupt.
• The data saved to the stack returns to the PC and the PSW, and the program returns from the interrupt service
routine.
• This instruction cannot be used for return from the software interrupt with the BRK instruction.
• None of interrupts are acknowledged between this instruction and the next instruction to be executed.
• The NMIS flag is set to 1 by acknowledgment of a non-maskable interrupt, and cleared to 0 by the RETI
instruction.
[Caution]
When the return from non-maskable interrupt servicing is performed by an instruction other than the RETI
instruction, the NMIS flag is not cleared to 0, and therefore no interrupts (including non-maskable interrupts)
except software interrupts can be acknowledged.
User's Manual U12326EJ4V0UM
99
CHAPTER 5 EXPLANATION OF INSTRUCTIONS
RETB
Return from Break
Return from Software Vectored Interrupt
[Instruction format]RETB
[Operation]PC
[Operand]
None
[Flag]
ZACCY
RRR
[Description]
• This is a return instruction from the software interrupt generated with the BRK instruction.
• The data saved in the stack returns to the PC and the PSW, and the program returns from the interrupt service
routine.
• None of interrupts are acknowledged between this instruction and the next instruction to be executed.
L ← (SP),
PC
H ← (SP+1),
PSW ← (SP+2),
SP← SP+3
100
User's Manual U12326EJ4V0UM
Loading...
+ hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.