78k Series Micro User Manual
78k Series Micro User Manual
78k Series Micro User Manual
78K/0S Series
8-Bit Single-Chip Microcontroller
Instructions
© 1996
Printed in Japan
[MEMO]
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 following products are manufactured and sold based on a license contract with CP8 Transac
regarding the EEPROM microcontroller patent.
These products cannot be used for an IC card (SMART CARD).
Applicable products: µPD789146, 789156, 789197AY, 789217AY Subseries
$SSOLFDEOHýSURGXFWVãýµ3'æåäìäæ$<ñýæåäëìæ$<ý6XEVHULHV
• The information in this document is current as of March, 1999. 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
"Special": Transportation equipment (automobiles, trains, ships, etc.), traffic control systems, anti-disaster
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
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
• 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.) NEC Electronics (Germany) GmbH NEC Electronics Hong Kong Ltd.
Santa Clara, California Benelux Office Hong Kong
Tel: 408-588-6000 Eindhoven, The Netherlands Tel: 2886-9318
800-366-9782 Tel: 040-2445845 Fax: 2886-9022/9044
Fax: 408-588-6130 Fax: 040-2444580
800-729-9288 NEC Electronics Hong Kong Ltd.
NEC Electronics (France) S.A. Seoul Branch
NEC Electronics (Germany) GmbH Velizy-Villacoublay, France Seoul, Korea
Duesseldorf, Germany Tel: 01-30-67 58 00 Tel: 02-528-0303
Tel: 0211-65 03 02 Fax: 01-30-67 58 99 Fax: 02-528-4411
Fax: 0211-65 03 490
NEC Electronics (France) S.A. NEC Electronics Singapore Pte. Ltd.
NEC Electronics (UK) Ltd. Madrid Office United Square, Singapore
Milton Keynes, UK Madrid, Spain Tel: 65-253-8311
Tel: 01908-691-133 Tel: 91-504-2787 Fax: 65-250-3583
Fax: 01908-670-290 Fax: 91-504-2860
NEC Electronics Taiwan Ltd.
NEC Electronics Italiana s.r.l. NEC Electronics (Germany) GmbH Taipei, Taiwan
Milano, Italy Scandinavia Office Tel: 02-2719-2377
Tel: 02-66 75 41 Taeby, Sweden Fax: 02-2719-5951
Fax: 02-66 75 42 99 Tel: 08-63 80 820
Fax: 08-63 80 388 NEC do Brasil S.A.
Electron Devices Division
Guarulhos-SP Brasil
Tel: 55-11-6462-6810
Fax: 55-11-6462-6829
J00.7
Page Contents
Readers This manual is intended for users who wish to understand the functions of 78K/0S
Series products and to design and develop its application systems and programs.
Purpose This manual is intended for users to understand the instruction functions of 78K/0S
Series products.
Organization The contents of this manual are broadly divided into the following.
• CPU functions
• Instruction set
• Explanation of instructions
How to read this manual It is assumed that the reader of this manual has general knowledge in the fields of
electrical engineering, logic circuits, and microcontrollers.
Conventions Data significance: Higher digits on the left and lower digits on the right
Note: Footnote for item marked with Note in the text
Caution: Information requiring particular attention
Remark: Supplementary information
Numeral representation: Binary...............×××× or ××××B
Decimal ............××××
Hexadecimal ....××××H
Related Documents
The related documents indicated in this publication may include preliminary versions. However, preliminary
versions are not marked as such.
English Japanese
Individual documents
• µPD789014 Subseries
English Japanese
• µPD789026 Subseries
English Japanese
• µPD789046 Subseries
English Japanese
English Japanese
• µPD789114 Subseries
English Japanese
• µPD789124 Subseries
English Japanese
• µPD789134 Subseries
English Japanese
English Japanese
English Japanese
English Japanese
• µPD789217AY Subseries
English Japanese
English Japanese
µPD789405A, 789406A, 789407A, 789415A, 789416A, 789417A Data Sheet To be prepared U14024J
• µPD789800 Subseries
English Japanese
• µPD789842 Subseries
English Japanese
Caution The above documents are subject to change without prior notice. Be sure to use the latest
version document when starting design.
LIST OF TABLES
The 78K/0S Series product program memory map varies depending on the internal memory capacity. For details
of the memory mapped address area, refer to the User's Manual of each product.
The 78K/0S Series product has internal ROM in the address space shown below. Program and table data, etc.
are stored in ROM. This memory space is usually addressed by the program counter (PC).
µPD789046 µPD789046
Subseries µPD78F9046
The vector table area stores program start addresses to which execution branches when the RESET signal is
input or when an interrupt request is generated. Of the 16-bit address, the lower 8 bits are stored in an even
address, and the higher 8 bits are stored in an odd address.
Vector Table Address Interrupt Request Vector Table Address Interrupt Request
000AH INTP2
Vector Table Address Interrupt Request Vector Table Address Interrupt Request
Vector Table Address Interrupt Request Vector Table Address Interrupt Request
Table 1-5. Vector Table (0000H to 0015H) (µPD789104, 789114, 789124, 789134 Subseries)
Vector Table Address Interrupt Request Vector Table Address Interrupt Request
Vector Table Address Interrupt Request Vector Table Address Interrupt Request
Vector Table Address Interrupt Request Vector Table Address Interrupt Request
0010H INTST20
Vector Table Address Interrupt Request Vector Table Address Interrupt Request
0014H INTWTI
Table 1-9. Vector Table (0000H to 0023H) (µPD789407A and µPD789417A Subseries)
Vector Table Address Interrupt Request Vector Table Address Interrupt Request
0012H INTWT
Vector Table Address Interrupt Request Vector Table Address Interrupt Request
Vector Table Address Interrupt Request Vector Table Address Interrupt Request
In a 64-byte address area 0040H to 007FH, the subroutine entry address of a 1-byte call instruction (CALLT) can
be stored.
Table 1-12. Internal Data Memory Space of 78K/0S Series Products (1/2)
Subseries Name Product Name High-Speed RAM LCD Display RAM EEPROM
µPD78F9026
µPD789104
µPD789114
µPD78F9116
Table 1-12. Internal Data Memory Space of 78K/0S Series Products (2/2)
Subseries Name Product Name High-Speed RAM LCD Display RAM EEPROM
µPD789124
µPD789134
µPD78F9136
µPD78F9156
µPD78F9177
µPD78F9197AY
µPD78F9217AY
µPD789407A
µPD789417A
µPD78F9418A
µPD78F9842
Special-function registers (SFRs) of on-chip peripheral hardware are allocated to the area FF00H to FFFFH
(refer to the User's Manual of each product).
The control registers have dedicated functions such as controlling the program sequence, statuses, and stack
memory. The control registers include a program counter, program status word, and stack pointer.
When the RESET signal is input, the program counter is set to the value of the reset vector table, which are
located at addresses 0000H and 0001H.
15 0
PC PC15 PC14 PC13 PC12 PC11 PC10 PC9 PC8 PC7 PC6 PC5 PC4 PC3 PC2 PC1 PC0
7 0
IE Z 0 AC 0 0 1 CY
15 0
SP SP15 SP14 SP13 SP12 SP11 SP10 SP9 SP8 SP7 SP6 SP5 SP4 SP3 SP2 SP1 SP0
The SP is decremented ahead of write (save) to the stack memory, and is incremented after read (reset) from the
stack memory.
The data saved/restored as a result of each stack operation are as shown in Figures 2-4 and 2-5.
______
Caution Since RESET input makes the SP contents undefined, be sure to initialize the SP before
executing an instruction.
SP SP − 2 SP SP − 2 SP − 3 PC7 to PC0
Lower byte in
SP − 2 SP − 2 PC7 to PC0 SP − 2 PC15 to PC8
register pair
Upper byte in
SP − 1 SP − 1 PC15 to PC8 SP − 1 PSW
register pair
SP SP SP
Lower byte in
SP SP PC7 to PC0 SP PC7 to PC0
register pair
Upper byte in
SP + 1 SP + 1 PC15 to PC8 SP + 1 PC15 to PC8
register pair
SP SP + 2 SP SP + 2 SP + 2 PSW
SP SP + 3
The general-purpose register consists of eight 8-bit registers (X, A, C, B, E, D, L, and H).
Each register can be used as an 8-bit register, or two 8-bit registers in pairs can be used as a 16-bit register (AX,
BC, DE, and HL).
Registers can be described in terms of functional names (X, A, C, B, E, D, L, H, AX, BC, DE, and HL) and
absolute names (R0 to R7 and RP0 to RP3).
R7
RP3
R6
R5
RP2
R4
R3
RP1
R2
R1
RP0
R0
15 0 7 0
H
HL
L
D
DE
E
B
BC
C
A
AX
X
15 0 7 0
Unlike general-purpose registers, special function registers have their own functions and are allocated to the 256-
byte area FF00H to FFFFH.
A special function register can be manipulated, like a general-purpose register, by using operation, transfer, and
bit manipulation instructions. The bit units in which one register is to be manipulated (1, 8, and 16) differ depending
on the special function register type.
The bit unit for manipulation is 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 with 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 with an address.
• 16-bit manipulation
Describes a symbol reserved by the assembler for the 16-bit manipulation instruction operand. When
addressing an address, describe an even address.
For details of the special function registers, refer to the User's Manual of each product.
An instruction address is determined by the program counter (PC) contents. The PC contents are normally
incremented (+1 per 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 in
the PC and branched by the following addressing (For details of each instruction, see CHAPTER 5 EXPLANATION
OF INSTRUCTIONS).
[Function]
The value obtained by adding the 8-bit immediate data (displacement value: jdisp8) of an instruction code to
the first address of the following instruction is transferred to the program counter (PC) and program branches.
The displacement value is treated as signed two’s complement data (–128 to +127) and bit 7 becomes a sign bit.
Thus, relative addressing causes a branch to an address within the range of –128 to +127, relative to the first
address of the next instruction.
This function is carried out when the BR $addr16 instruction or a conditional branch instruction is executed.
[Illustration]
15 0
... PC holds the first address
PC
of instruction next to
BR instruction.
+
15 8 7 6 0
α S
jdisp8
15 0
PC
[Function]
Immediate data in the instruction word is transferred to the program counter (PC) and program branches.
This function is carried out when the CALL !addr16 or BR !addr16 instruction is executed.
The CALL !addr16 and BR !addr16 instructions can be used to branch to any address within the memory
spaces.
[Illustration]
In case of CALL !addr16 or BR !addr16 instruction
7 0
CALL or BR
Low addr.
High addr.
15 8 7 0
PC
[Function]
Table contents (branch destination address) of a particular location, addressed by the immediate data of bits 1
to 5 of an instruction code are transferred to the program counter (PC), and program branches.
Table indirect addressing is performed when the CALLT [addr5] instruction is executed. This instruction
references the address stored in the memory table from 40H to 7FH, and allows branching to the entire memory
space.
[Illustration]
7 6 5 1 0
15 8 7 6 5 1 0
Effective address 0 0 0 0 0 0 0 0 0 1 0
7 Memory (table) 0
Low addr.
15 8 7 0
PC
[Function]
Register pair (AX) contents specified with an instruction word are transferred to the program counter (PC) and
program branches.
This function is carried out when the BR AX instruction is executed.
[Illustration]
7 0 7 0
rp A X
15 8 7 0
PC
The following methods are available to specify the register and memory (addressing) which undergo manipulation
during instruction execution.
[Function]
This addressing directly addresses a memory to be manipulated with immediate data in an instruction word.
[Operand format]
Operand Description
[Description example]
MOV A, !FE00H; When setting !addr16 to FE00H
0 0 0 0 0 0 0 0 00H
1 1 1 1 1 1 1 0 FEH
[Illustration]
7 0
OP code
addr16 (lower)
addr16 (higher)
Memory
[Function]
This addressing directly addresses memory to be manipulated in the fixed space with the 8-bit data in an
instruction word.
This addressing is applied to the 256-byte fixed space of 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-FF1FH) to which short direct addressing is applied constitutes only part of the overall
SFR area. In this area, ports that are frequently accessed in a program and a compare register of the timer/event
counter are mapped, and these SFRs can be manipulated with a small number of bytes and clocks.
When 8-bit immediate data is 20H to FFH, bit 8 of an effective address is set to 0. When it is 00H to 1FH, bit 8
is set to 1. See Illustration below.
[Operand format]
Operand Description
[Description example]
MOV FE30H, #50H; When setting saddr to FE30H and the immediate data to 50H
0 0 1 1 0 0 0 0 30H (saddr-offset)
[Illustration]
7 0
OP code
saddr-offset
[Function]
This addressing is to address special function registers (SFRs) mapped to the memory with the 8-bit immediate
data in an instruction word.
This addressing is applied to the 240-byte spaces of FF00H to FFCFH and FFE0H to FFFFH. However, the
SFRs mapped at FF00H to FF1FH can also be accessed by means of short direct addressing.
[Operand format]
Operand Description
[Description example]
MOV PM0, A; When selecting PM0 for sfr
Instruction code 1 1 1 0 0 1 1 1
0 0 1 0 0 0 0 0
[Illustration]
7 0
OP code
sfr-offset
SFR
15 8 7 0
Effective
1 1 1 1 1 1 1 1
address
[Function]
This addressing is to access a general-purpose register by specifying it as an operand. The general-purpose
register to be accessed is specified with a register specification code in an instruction code or function name.
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 with 3 bits (register specification code) in the
instruction code.
[Operand format]
Operand Description
r X, A, C, B, E, D, L, H
'r' and 'rp' can be described with absolute names (R0 to R7 and RP0 to RP3) as well as functional 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 code 0 0 0 0 1 0 1 0
0 0 1 0 0 1 0 1
Instruction code 1 0 0 0 1 0 0 0
[Function]
This addressing is to address memory using the contents of the special register pair as an operand. The
register pair to be accessed is specified with the register pair specification code in an instruction code. This
addressing can be carried out for the entire memory space.
[Operand format]
Operand Description
[DE], [HL]
[Description example]
MOV A, [DE]; When selecting register pair [DE]
Instruction code 0 0 1 0 1 0 1 1
[Illustration]
15 8 7 0
DE D E
Memory address
specified with
7 0 register pair DE
The contents of
the specified memory
address are transferred.
7 0
[Function]
This addressing is to address the memory by using the result of adding 8-bit immediate data to the contents of
the base register, i.e., the HL register pair. The 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 the entire memory
space.
[Operand format]
Operand Description
[HL + byte]
[Description example]
MOV A, [HL+10H]; When setting “byte” to 10H
Instruction code 0 0 1 0 1 1 0 1
0 0 0 1 0 0 0 0
[Function]
This addressing is to indirectly address the stack area with the stack pointer (SP) contents.
This addressing method is automatically employed when the PUSH, POP, subroutine call, or RETURN
instructions is executed or when the register is saved/restored upon generation of an interrupt request.
Stack addressing can address the internal high-speed RAM area only.
[Description example]
In the case of PUSH DE
Instruction code 1 0 1 0 1 0 1 0
This chapter lists the instruction set of the 78K/0S Series. The instructions are common to all 78K/0S Series
products.
4.1 Operation
In the case of immediate data, describe an appropriate numeric value or a label. When using a label, be sure to
describe #, !, $, or [ ].
For operand register description formats, r and rp, either functional names (X, A, C, etc.) or absolute names
(names in parentheses in the table below, R0, R1, R2, etc.) can be described.
addr16 0000H to FFFFH Immediate data or labels (only even addresses for 16-bit data transfer instructions)
addr5 0040H to 007FH Immediate data or labels (even addresses only)
Remark Refer to the User's Manual of each product for symbols of special function registers.
Z AC CY
A←r
Note 1
A, r 2 4
r←A
Note 1
r, A 2 4
A, saddr 2 4 A ← (saddr)
saddr, A 2 4 (saddr) ← A
A, sfr 2 4 A ← sfr
sfr, A 2 4 sfr ← A
A, !addr16 3 8 A ← (addr16)
!addr16, A 3 8 (addr16) ← A
A, PSW 2 4 A ← PSW
PSW, A 2 4 PSW ← A × × ×
A, [DE] 1 6 A ← (DE)
[DE], A 1 6 (DE) ← A
A, [HL] 1 6 A ← (HL)
[HL], A 1 6 (HL) ← A
XCH A, X 1 4 A↔X
A↔r
Note 2
A, r 2 6
A, saddr 2 6 A ↔ (saddr)
A, sfr 2 6 A ↔ sfr
A, [DE] 1 8 A ↔ (DE)
A, [HL] 1 8 A ↔ (HL)
Notes 1. Except r = A.
2. Except r = A, X.
Remark One instruction clock cycle is equal to one CPU clock (fCPU) cycle selected by the processor clock control
register (PCC).
Z AC CY
saddrp, AX 2 8 (saddrp) ← AX
AX ← rp
Note
AX, rp 1 4
rp ← AX
Note
rp, AX 1 4
AX ↔ rp
Note
XCHW AX, rp 1 8
A, r 2 4 A, CY ← A + r × × ×
A, saddr 2 4 A, CY ← A + (saddr) × × ×
A, !addr16 3 8 A, CY ← A + (addr16) × × ×
A, [HL] 1 6 A, CY ← A + (HL) × × ×
A, r 2 4 A, CY ← A + r + CY × × ×
A, saddr 2 4 A, CY ← A + (saddr) + CY × × ×
A, !addr16 3 8 A, CY ← A + (addr16) + CY × × ×
A, [HL] 1 6 A, CY ← A + (HL) + CY × × ×
A, r 2 4 A, CY ← A – r × × ×
A, saddr 2 4 A, CY ← A – (saddr) × × ×
A, !addr16 3 8 A, CY ← A – (addr16) × × ×
A, [HL] 1 6 A, CY ← A – (HL) × × ×
Remark One instruction clock cycle is equal to one CPU clock (fCPU) cycle selected by the processor clock control
register (PCC).
Z AC CY
A, r 2 4 A, CY ← A – r – CY × × ×
A, saddr 2 4 A, CY ← A – (saddr) – CY × × ×
A, !addr16 3 8 A, CY ← A – (addr16) – CY × × ×
A, [HL] 1 6 A, CY ← A – (HL) – CY × × ×
A, r 2 4 A ← A∧r ×
A, saddr 2 4 A ← A∧(saddr) ×
A, !addr16 3 8 A ← A∧(addr16) ×
A, [HL] 1 6 A ← A∧(HL) ×
OR A, #byte 2 4 A ← A∨byte ×
A, r 2 4 A ← A∨r ×
A, saddr 2 4 A ← A∨(saddr) ×
A, !addr16 3 8 A ← A∨(addr16) ×
A, [HL] 1 6 A ← A∨(HL) ×
A, r 2 4 A ← A∨r ×
A, saddr 2 4 A ← A∨(saddr) ×
A, !addr16 3 8 A ← A∨(addr16) ×
A, [HL] 1 6 A ← A∨(HL) ×
A, r 2 4 A–r × × ×
A, saddr 2 4 A – (saddr) × × ×
A, !addr16 3 8 A – (addr16) × × ×
A, [HL] 1 6 A – (HL) × × ×
Remark One instruction clock cycle is equal to one CPU clock (fCPU) cycle selected by the processor clock control
register (PCC).
Z AC CY
INC r 2 4 r←r+1 × ×
DEC r 2 4 r←r–1 × ×
INCW rp 1 4 rp ← rp + 1
DECW rp 1 4 rp ← rp – 1
sfr.bit 3 6 sfr.bit ← 1
A.bit 2 4 A.bit ← 1
PSW.bit 3 6 PSW.bit ← 1 × × ×
[HL].bit 2 10 (HL).bit ← 1
sfr.bit 3 6 sfr.bit ← 0
A.bit 2 4 A.bit ← 0
PSW.bit 3 6 PSW.bit ← 0 × × ×
[HL].bit 2 10 (HL).bit ← 0
SET1 CY 1 2 CY ← 1 1
CLR1 CY 1 2 CY ← 0 0
×
_____
NOT1 CY 1 2 CY ← CY
Remark One instruction clock cycle is equal to one CPU clock (fCPU) cycle selected by the processor clock control
register (PCC).
Z AC CY
MOVW SP,AX 2 8 SP ← AX
AX,SP 2 6 AX ← SP
BR !addr16 3 6 PC ← addr16
$addr16 2 6 PC ← PC + 2 + jdisp8
AX 1 6 PCH ← A, PCL ← X
BC $addr16 2 6 PC ← PC + 2 + jdisp8 if CY = 1
BZ $addr16 2 6 PC ← PC + 2 + jdisp8 if Z = 1
NOP 1 2 No Operation
EI 3 6 IE ← 1 (Enable Interrupt)
DI 3 6 IE ← 0 (Disable Interrupt)
Remark One instruction clock cycle is equal to one CPU clock (fCPU) cycle selected by the processor clock control
register (PCC).
2nd operand #byte A r sfr saddr !addr16 PSW [DE] [HL] [HL + byte] $addr16 1 None
1st operand
Note
A ADD MOV MOV MOV MOV MOV MOV MOV MOV ROR
Note
ADDC XCH XCH XCH XCH XCH XCH ROL
SUB ADD ADD ADD ADD ADD RORC
SUBC ADDC ADDC ADDC ADDC ADDC ROLC
AND SUB SUB SUB SUB SUB
OR SUBC SUBC SUBC SUBC SUBC
XOR AND AND AND AND AND
CMP OR OR OR OR OR
XOR XOR XOR XOR XOR
CMP CMP CMP CMP CMP
Note
r MOV MOV INC
DEC
B, C DBNZ
!addr16 MOV
[DE] MOV
[HL] MOV
Note Except r = A.
Note
2nd operand #word AX rp saddrp SP None
1st operand
saddrp MOVW
SP MOVW
A.bit BT SET1
BF CLR1
sfr.bit BT SET1
BF CLR1
saddr.bit BT SET1
BF CLR1
PSW.bit BT SET1
BF CLR1
[HL].bit SET1
CLR1
CY SET1
CLR1
NOT1
r rp
R2 R1 R0 reg P1 P0 reg-pair
0 0 0 R0 X 0 0 RP0 AX
0 0 1 R1 A 0 1 RP1 BC
0 1 0 R2 C 1 0 RP2 DE
0 1 1 R3 B 1 1 RP3 HL
1 0 0 R4 E
1 0 1 R5 D
1 1 0 R6 L
1 1 1 R7 H
B1 B2 B3 B4
A, saddr 0 0 1 0 0 1 0 1 Saddr-offset
saddr, A 1 1 1 0 0 1 0 1 Saddr-offset
A, sfr 0 0 1 0 0 1 1 1 Sfr-offset
sfr, A 1 1 1 0 0 1 1 1 Sfr-offset
A, PSW 0 0 1 0 0 1 0 1 0 0 0 1 1 1 1 0
PSW, A 1 1 1 0 0 1 0 1 0 0 0 1 1 1 1 0
A, [DE] 0 0 1 0 1 0 1 1
[DE], A 1 1 1 0 1 0 1 1
A, [HL] 0 0 1 0 1 1 1 1
[HL], A 1 1 1 0 1 1 1 1
XCH A, X 1 1 0 0 0 0 0 0
Note 2
A, r 0 0 0 0 1 0 1 0 0 0 0 0 R2 R1 R0 1
A, saddr 0 0 0 0 0 1 0 1 Saddr-offset
A, sfr 0 0 0 0 0 1 1 1 Sfr-offset
A, [DE] 0 0 0 0 1 0 1 1
A, [HL] 0 0 0 0 1 1 1 1
saddrp, AX 1 1 1 0 0 1 1 0 Saddr-offset
Note 3
AX, rp 1 1 0 1 P1 P0 0 0
Note 3
rp, AX 1 1 1 0 P1 P0 0 0
Note 3
XCHW AX, rp 1 1 0 0 P1 P0 0 0
Notes 1. Except r = A.
2. Except r = A, X.
3. Only when rp = BC, DE, or HL.
B1 B2 B3 B4
A, r 0 0 0 0 1 0 1 0 1 0 0 0 R2 R1 R0 1
A, saddr 1 0 0 0 0 1 0 1 Saddr-offset
A, [HL] 1 0 0 0 1 1 1 1
A, r 0 0 0 0 1 0 1 0 1 0 1 0 R2 R1 R0 1
A, saddr 1 0 1 0 0 1 0 1 Saddr-offset
A, [HL] 1 0 1 0 1 1 1 1
A, r 0 0 0 0 1 0 1 0 1 0 0 1 R2 R1 R0 1
A, saddr 1 0 0 1 0 1 0 1 Saddr-offset
A, [HL] 1 0 0 1 1 1 1 1
A, r 0 0 0 0 1 0 1 0 1 0 1 1 R2 R1 R0 1
A, saddr 1 0 1 1 0 1 0 1 Saddr-offset
A, [HL] 1 0 1 1 1 1 1 1
A, r 0 0 0 0 1 0 1 0 0 1 1 0 R2 R1 R0 1
A, saddr 0 1 1 0 0 1 0 1 Saddr-offset
A, [HL] 0 1 1 0 1 1 1 1
B1 B2 B3 B4
OR A, #byte 0 1 1 1 0 0 1 1 Data
A, r 0 0 0 0 1 0 1 0 0 1 1 1 R2 R1 R0 1
A, saddr 0 1 1 1 0 1 0 1 Saddr-offset
A, [HL] 0 1 1 1 1 1 1 1
A, r 0 0 0 0 1 0 1 0 0 1 0 0 R2 R1 R0 1
A, saddr 0 1 0 0 0 1 0 1 Saddr-offset
A, [HL] 0 1 0 0 1 1 1 1
A, r 0 0 0 0 1 0 1 0 0 0 0 1 R2 R1 R0 1
A, saddr 0 0 0 1 0 1 0 1 Saddr-offset
A, [HL] 0 0 0 1 1 1 1 1
INC r 0 0 0 0 1 0 1 0 1 1 0 0 R2 R1 R0 1
saddr 1 1 0 0 0 1 0 1 Saddr-offset
DEC r 0 0 0 0 1 0 1 0 1 1 0 1 R2 R1 R0 1
saddr 1 1 0 1 0 1 0 1 Saddr-offset
INCW rp 1 0 0 0 P 1 P0 0 0
DECW rp 1 0 0 1 P 1 P0 0 0
ROR A, 1 0 0 0 0 0 0 0 0
ROL A, 1 0 0 0 1 0 0 0 0
RORC A, 1 0 0 0 0 0 0 1 0
ROLC A, 1 0 0 0 1 0 0 1 0
B1 B2 B3 B4
sfr.bit 0 0 0 0 1 0 1 0 0 B2 B 1 B 0 0 1 1 0 Sfr-offset
A.bit 0 0 0 0 1 0 1 0 0 B2 B 1 B 0 0 0 1 0
PSW.bit 0 0 0 0 1 0 1 0 0 B2 B 1 B 0 1 0 1 0 0 0 0 1 1 1 1 0
[HL].bit 0 0 0 0 1 0 1 0 0 B2 B 1 B 0 1 1 1 0
sfr.bit 0 0 0 0 1 0 1 0 1 B2 B 1 B 0 0 1 1 0 Sfr-offset
A.bit 0 0 0 0 1 0 1 0 1 B2 B 1 B 0 0 0 1 0
PSW.bit 0 0 0 0 1 0 1 0 1 B2 B 1 B 0 1 0 1 0 0 0 0 1 1 1 1 0
[HL].bit 0 0 0 0 1 0 1 0 1 B2 B 1 B 0 1 1 1 0
SET1 CY 0 0 0 1 0 1 0 0
CLR1 CY 0 0 0 0 0 1 0 0
NOT1 CY 0 0 0 0 0 1 1 0
RET 0 0 1 0 0 0 0 0
RETI 0 0 1 0 0 1 0 0
PUSH PSW 0 0 1 0 1 1 1 0
rp 1 0 1 0 P1 P0 1 0
POP PSW 0 0 1 0 1 1 0 0
rp 1 0 1 0 P1 P0 0 0
MOVW SP, AX 1 1 1 0 0 1 1 0 0 0 0 1 1 1 0 0
AX, SP 1 1 0 1 0 1 1 0 0 0 0 1 1 1 0 0
$addr16 0 0 1 1 0 0 0 0 jdisp
AX 1 0 1 1 0 0 0 0
BC $addr16 0 0 1 1 1 0 0 0 jdisp
BZ $addr16 0 0 1 1 1 1 0 0 jdisp
B1 B2 B3 B4
C, $addr16 0 0 1 1 0 1 0 0 jdisp
NOP 0 0 0 0 1 0 0 0
EI 0 0 0 0 1 0 1 0 0 1 1 1 1 0 1 0 0 0 0 1 1 1 1 0
DI 0 0 0 0 1 0 1 0 1 1 1 1 1 0 1 0 0 0 0 1 1 1 1 0
HALT 0 0 0 0 1 1 0 0
STOP 0 0 0 0 1 1 1 0
This chapter explains the instructions of 78K/0S Series. Each instruction is described in the unit of mnemonic,
including description of multiple operands.
The basic configuration of instruction descriptions is shown on the next page.
For the number of instruction bytes and operation codes, refer to CHAPTER 4 INSTRUCTION SET.
DESCRIPTION EXAMPLE
Move
MOV
Byte Data Transfer
Meaning of instruction
[Instruction format] MOV dst, src: Indicates the basic description format of the instruction.
[Operand] Indicates operands that can be specified with this instruction. Refer to 4.1 Operation
for a description of each operand symbol.
A, saddr [HL], A
[Flag] Indicates the operation of the flag that changes by instruction execution.
Each flag operation symbol is shown in the legend.
Z AC CY
Legend
Symbol Description
Blank Unchanged
0 Cleared to 0
1 Set to 1
× Set or cleared according to the result
R Previously saved value is restored
[Description example]
MOV A, #4DH; 4DH is transferred to A register.
MOV ... 60
XCH ... 61
Move
MOV Byte Data Transfer
[Operand]
A, saddr [DE], A
saddr, A A, [HL]
A, sfr [HL], A
Note Except r = A
[Flag]
PSW, #byte and PSW, A All other operand
operands combinations
Z AC CY Z AC CY
× × ×
[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 or the “MOV PSW, A” instruction
and the subsequent instruction.
[Description example]
MOV A, #4DH; 4DH is transferred to A register.
Exchange
XCH Byte Data Exchange
[Operand]
XCH A, X
Note
A, r
A, saddr
A, sfr
A, [DE]
A, [HL]
A, [HL + byte]
Note Except r = A, X
[Flag]
Z AC CY
[Description]
• The 1st and 2nd operand contents are exchanged.
[Description example]
XCH A, 0FEBCH; The A register contents and address FEBCH contents are exchanged.
MOVW ... 63
XCHW ... 64
Move Word
MOVW Word Data Transfer
[Operand]
AX, saddrp
saddrp, AX
Note
AX, rp
Note
rp, AX
[Flag]
Z AC CY
[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 to saddrp. An odd address cannot be specified.
Exchange Word
XCHW Word Data Exchange
[Operand]
[Flag]
Z AC CY
[Description]
• The 1st and 2nd operand contents are exchanged.
[Description example]
XCHW AX, BC; The memory contents of AX register are exchanged with those of the BC register.
ADD ... 66
ADDC ... 67
SUB ... 68
SUBC ... 69
AND ... 70
OR ... 71
XOR ... 72
CMP ... 73
Add
ADD Byte Data Addition
[Operand]
A, r A, [HL + byte]
A, saddr
[Flag]
Z AC CY
× × ×
[Description]
• The destination operand (dst) specified with the 1st operand is added to the source operand (src) specified
with 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 from bit 7, the CY flag is set (1). In all other cases, the CY flag is cleared (0).
• If the addition generates a carry from bit 3 to bit 4, 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.
[Operand]
A, r A, [HL + byte]
A, saddr
[Flag]
Z AC CY
× × ×
[Description]
• The destination operand (dst) specified with the 1st operand, the source operand (src) specified with 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 from bit 7, the CY flag is set (1). In all other cases, the CY flag is cleared (0).
• If the addition generates a carry from bit 3 to bit 4, the AC flag is set (1). In all other cases, the AC flag is
cleared (0).
[Description example]
ADDC A, [HL]; The A register contents, the contents at address (HL register), and the CY flag are added and
the result is stored in the A register.
Subtract
SUB Byte Data Subtraction
[Operand]
A, r A, [HL + byte]
A, saddr
[Flag]
Z AC CY
× × ×
[Description]
• The source operand (src) specified with the 2nd operand is subtracted from the destination operand (dst)
specified with 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 at bit 7, the CY flag is set (1). In all other cases, the CY flag is cleared
(0).
• If the subtraction generates a borrow from bit 4 to bit 3, the AC flag is set (1). In all other cases, the AC flag
is cleared (0).
[Description example]
SUB A, D; The D register is subtracted from the A register and the result is stored in the A register.
[Operand]
A, r A, [HL + byte]
A, saddr
[Flag]
Z AC CY
× × ×
[Description]
• The source operand (src) specified with the 2nd operand and the CY flag are subtracted from the destination
operand (dst) specified with 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 at bit 7, the CY flag is set (1). In all other cases, the CY flag is cleared
(0).
• If the subtraction generates a borrow from bit 4 to bit 3, 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.
And
AND Logical Product of Byte Data
[Operand]
A, r A, [HL + byte]
A, saddr
[Flag]
Z AC CY
[Description]
• The destination operand (dst) specified with the 1st operand and the source operand (src) specified with the
2nd operand are ANDed bit wise, 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 0FEBAH, #11011100B; The FEBAH contents and 11011100B are ANDed bit wise and the result is stored
at FEBAH.
Or
OR Logical Sum of Byte Data
[Operand]
OR A, #byte OR A, !addr16
A, r A, [HL + byte]
A, saddr
[Flag]
Z AC CY
[Description]
• The destination operand (dst) specified with the 1st operand and the source operand (src) specified with the
2nd operand are ORed bit wise, 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, 0FE98H; The A register and FE98H are ORed bit wise and the result is stored in the A register.
Exclusive Or
XOR Exclusive Logical Sum of Byte Data
[Operand]
A, r A, [HL + byte]
A, saddr
[Flag]
Z AC CY
[Description]
• The destination operand (dst) specified with the 1st operand and the source operand (src) specified with the
2nd operand are XORed bit wise, and the result is stored in the destination operand (dst).
Logical negation of all bits of the destination operand (dst) is possible with this instruction by selecting #0FFH
for the source operand (src).
• 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 A and L registers are XORed bit wise and the result is stored in the A register.
Compare
CMP Byte Data Comparison
[Operand]
A, r A, [HL + byte]
A, saddr
[Flag]
Z AC CY
× × ×
[Description]
• The source operand (src) specified with the 2nd operand is subtracted from the destination operand (dst)
specified with 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 at bit 7, the CY flag is set (1). In all other cases, the CY flag is cleared
(0).
• If the subtraction generates a borrow from bit 4 to bit 3, the AC flag is set (1). In all other cases, the AC flag
is cleared (0).
[Description example]
CMP 0FE38H, #38H; 38H is subtracted from the contents at address FE38H and only the Z, AC, and CY flags
are changed (comparison of contents at address FE38H and the immediate data).
ADDW ... 75
SUBW ... 76
CMPW ... 77
Add Word
ADDW Word Data Addition
[Operand]
[Flag]
Z AC CY
× × ×
[Description]
• The destination operand (dst) specified with the 1st operand is added to the source operand (src) specified
with 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 from 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, #0ABCDH; ABCDH is added to the AX register and the result is stored in the AX register.
Subtract Word
SUBW Word Data Subtraction
[Operand]
[Flag]
Z AC CY
× × ×
[Description]
• The source operand (src) specified with the 2nd operand is subtracted from the destination operand (dst)
specified with 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 at 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]
SUBW AX, #0ABCDH; ABCDH is subtracted from the AX register contents and the result is stored in the AX
register.
Compare Word
CMPW Word Data Comparison
[Operand]
[Flag]
Z AC CY
× × ×
[Description]
• The source operand (src) specified with the 2nd operand is subtracted from the destination operand (dst)
specified with 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 at 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, #0ABCDH; ABCDH is subtracted from the AX register and only the Z, AC, and CY flags are
changed (comparison of the AX register and the immediate data).
INC ... 79
DEC ... 80
INCW ... 81
DECW ... 82
Increment
INC Byte Data Increment
[Operand]
INC r
saddr
[Flag]
Z AC CY
× ×
[Description]
• The destination operand (dst) contents are incremented by only one.
• If the increment result is 0, the Z flag is set (1). In all other cases, the Z flag is cleared (0).
• If the increment generates a carry from bit 3 to bit 4, the AC flag is set (1). In all other cases, the AC flag is
cleared (0).
• Because this instruction is frequently used for a counter for repeated operations, the CY flag contents are not
changed (to hold the CY flag contents in multiple-byte operation).
[Description example]
INC B; The B register is incremented.
Decrement
DEC Byte Data Decrement
[Operand]
DEC r
saddr
[Flag]
Z AC CY
× ×
[Description]
• The destination operand (dst) contents are decremented by only one.
• If the decrement result is 0, the Z flag is set (1). In all other cases, the Z flag is cleared (0).
• If the decrement generates a carry from bit 4 to bit 3, the AC flag is set (1). In all other cases, the AC flag is
cleared (0).
• Because this instruction is frequently used for a counter for repeated operations, the CY flag contents are
not changed (to hold the CY flag contents in multiple-byte operation).
• If dst is the B or C register or saddr, and it is not desired to change the AC and CY flag contents, the DBNZ
instruction can be used.
[Description example]
DEC 0FE92H ; The contents at address FE92H are decremented.
Increment Word
INCW Word Data Increment
[Operand]
INCW rp
[Flag]
Z AC CY
[Description]
• The destination operand (dst) contents are incremented by only one.
• Because this instruction is frequently used for increment of a register (pointer) used for addressing, the Z, AC,
and CY flag contents are not changed.
[Description example]
INCW HL ; The HL register is incremented.
Decrement Word
DECW Word Data Decrement
[Operand]
DECW rp
[Flag]
Z AC CY
[Description]
• The destination operand (dst) contents are decremented by only one.
• Because this instruction is frequently used for decrement of a register (pointer) used for addressing, the Z,
AC, and CY flag contents are not changed.
[Description example]
DECW DE ; The DE register is decremented.
ROR ... 84
ROL ... 85
RORC ... 86
ROLC ... 87
Rotate Right
ROR Byte Data Rotation to the Right
[Operand]
ROR A, 1
[Flag]
Z AC CY
[Description]
• The destination operand (dst) contents specified with the 1st operand are rotated to the right just once.
• The LSB (bit 0) contents are simultaneously rotated to MSB (bit 7) and transferred to the CY flag.
CY 7 0
[Description example]
ROR A, 1; The A register contents are rotated one bit to the right.
Rotate Left
ROL Byte Data Rotation to the Left
[Operand]
ROL A, 1
[Flag]
Z AC CY
[Description]
• The destination operand (dst) contents specified with the 1st operand are rotated to the left just once.
• The MSB (bit 7) contents are simultaneously rotated to LSB (bit 0) and transferred to the CY flag.
CY 7 0
[Description example]
ROL A, 1; The A register contents are rotated to the left by one bit.
[Operand]
RORC A, 1
[Flag]
Z AC CY
[Description]
• The destination operand (dst) contents specified with the 1st operand are rotated just once to the right
including the CY flag.
CY 7 0
[Description example]
RORC A, 1; The A register contents are rotated to the right by one bit including the CY flag.
[Operand]
ROLC A, 1
[Flag]
Z AC CY
[Description]
• The destination operand (dst) contents specified with the 1st operand are rotated just once to the left
including the CY flag.
CY 7 0
[Description example]
ROLC A, 1; The A register contents are rotated to the left by one bit including the CY flag.
SET1 ... 89
CLR1 ... 90
NOT1 ... 91
[Operation] dst ← 1
[Operand]
SET1 saddr.bit
sfr.bit
A.bit
PSW.bit
[HL].bit
CY
[Flag]
× × × 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 0FE55H.1; Bit 1 of FE55H is set (1).
[Operation] dst ← 0
[Operand]
CLR1 saddr.bit
sfr.bit
A.bit
PSW.bit
[HL].bit
CY
[Flag]
× × × 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).
_______
[Operand]
NOT1 CY
[Flag]
Z AC CY
[Description]
• The CY flag is inverted.
[Description example]
NOT1 CY; The CY flag is inverted.
CALL ... 93
CALLT ... 94
RET ... 95
RETI ... 96
Call
CALL Subroutine Call (16 Bit Direct)
[Operand]
CALL !addr16
[Flag]
Z AC CY
[Description]
• This is a subroutine call with a 16-bit absolute address or a register indirect address.
• The next instruction’s start address (PC + 3) is saved in the stack and is branched to the address specified
with the target operand (target).
[Description example]
CALL !3059H; Subroutine call to 3059H
Call Table
CALLT Subroutine Call (Call Table Reference)
[Operand]
CALLT [addr5]
[Flag]
Z AC CY
[Description]
• This is a subroutine call for call table reference.
• The next instruction’s start address (PC + 1) 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 following 5 bits
are specified with addr5).
[Description example]
CALLT [40H]; Subroutine call to the addresses indicated by word data of 0040H and 0041H.
Return
RET Return from Subroutine
[Operand]
None
[Flag]
Z AC CY
[Description]
• This is a return instruction from the subroutine call made with the CALL and CALLT instructions.
• The word data saved in the stack returns to the PC, and the program returns from the subroutine.
[Operand]
None
[Flag]
Z AC CY
R R R
[Description]
• This is a return instruction from the vectored interrupt.
• The data saved in the stack returns to the PC and 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.
• 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) can
be acknowledged.
PUSH ... 98
POP ... 99
MOVW SP, AX ... 100
MOVW AX, SP ... 100
Push
PUSH Push
[Operand]
PUSH PSW
rp
[Flag]
Z AC CY
[Description]
• The data of the register specified with the source operand (src) is saved in the stack.
[Description example]
PUSH AX; AX register contents are saved in the stack.
Pop
POP Pop
[Operand]
POP PSW
rp
[Flag]
dst = rp PSW
Z AC CY Z AC CY
R R R
[Description]
• Data is returned from the stack to the register specified with the destination operand (dst).
• When the operand is PSW, each flag is replaced with stack data.
• No interrupts are acknowledged between the POP PSW instruction and the subsequent instruction.
[Description example]
POP AX; The stack data is returned to the AX register.
[Operand]
MOVW SP, AX
AX, SP
[Flag]
Z AC CY
[Description]
• This is an instruction to manipulate the stack pointer contents.
• The source operand (src) specified with the 2nd operand is stored in the destination operand (dst) specified
with the 1st operand.
[Description example]
MOVW SP, AX; AX register contents are stored in the stack pointer.
BR ... 102
Branch
BR Unconditional Branch
[Operation] PC ← target
[Operand]
BR !addr16
AX
$addr16
[Flag]
Z AC CY
[Description]
• This is an instruction to branch unconditionally.
• The word data of the target address operand (target) is transferred to PC and program branches.
[Description example]
BR AX; The AX register contents are regarded as an address to which the program branches.
BC ... 104
BNC ... 105
BZ ... 106
BNZ ... 107
BT ... 108
BF ... 109
DBNZ ... 110
Branch if Carry
BC Conditional Branch with Carry Flag (CY = 1)
[Operation] PC ← PC + 2 + jdisp8 if CY = 1
[Operand]
BC $addr16
[Flag]
Z AC CY
[Description]
• When CY = 1, program branches to the address specified with the operand.
When CY = 0, no processing is carried out and the subsequent instruction is executed.
[Description example]
BC $300H; When CY = 1, program branches to 0300H (with the start of this instruction set in the range of
addresses 027FH to 037EH).
[Operation] PC ← PC + 2 + jdisp8 if CY = 0
[Operand]
BNC $addr16
[Flag]
Z AC CY
[Description]
• When CY = 0, program branches to the address specified with the operand.
When CY = 1, no processing is carried out and the subsequent instruction is executed.
[Description example]
BNC $300H; When CY = 0, program branches to 0300H (with the start of this instruction set in the range of
addresses 027FH to 037EH).
Branch if Zero
BZ Conditional Branch with Zero Flag (Z = 1)
[Operation] PC ← PC + 2 + jdisp8 if Z = 1
[Operand]
BZ $addr16
[Flag]
Z AC CY
[Description]
• When Z = 1, program branches to the address specified with the operand.
When Z = 0, no processing is carried out and the subsequent instruction is executed.
[Description example]
DEC B
BZ $3C5H; When the B register is 0, program branches to 03C5H (with the start of this instruction set in the
range of addresses 0344H to 0443H).
[Operation] PC ← PC + 2 + jdisp8 if Z = 0
[Operand]
BNZ $addr16
[Flag]
Z AC CY
[Description]
• When Z = 0, program branches to the address specified with the operand.
When Z = 1, no processing is carried out and the subsequent instruction is executed.
[Description example]
CMP A, #55H
BNZ $0A39H; If the A register is not 0055H, program branches to 0A39H (with the start of this instruction set in
the range of addresses 09B8H to 0AB7H).
Branch if True
BT Conditional Branch by Bit Test (Byte Data Bit = 1)
[Operand]
BT saddr.bit, $addr16 4
sfr.bit, $addr16 4
A.bit, $addr16 3
PSW.bit, $addr16 4
[Flag]
Z AC CY
[Description]
• If the 1st operand (bit) contents have been set (1), program branches to the address specified with the 2nd
operand ($addr16).
If the 1st operand (bit) contents have not been set (1), no processing is carried out and the subsequent
instruction is executed.
[Description example]
BT 0FE47H.3, $55CH; When bit 3 at address FE47H is 1, program branches to 055CH (with the start of this
instruction set in the range of addresses 04DAH to 05D9H).
Branch if False
BF Conditional Branch by Bit Test (Byte Data Bit = 0)
[Operand]
BF saddr.bit, $addr16 4
sfr.bit, $addr16 4
A.bit, $addr16 3
PSW.bit, $addr16 4
[Flag]
Z AC CY
[Description]
• If the 1st operand (bit) contents have been cleared (0), program branches to the address specified with the
2nd operand ($addr16).
If the 1st operand (bit) contents have not been cleared (0), no processing is carried out and the subsequent
instruction is executed.
[Description example]
BF P2.2, $1549H; When bit 2 of port 2 is 0, program branches to address 1549H (with the start of this instruction
set in the range of addresses 14C6H to 15C5H).
[Operand]
DBNZ B, $addr16 2
C, $addr16 2
saddr, $addr16 3
[Flag]
Z AC CY
[Description]
• One is subtracted from the destination operand (dst) contents specified with the 1st operand and the
subtraction result is stored in the destination operand (dst).
• If the subtraction result is not 0, program branches to the address indicated with the 2nd operand ($addr16).
When the subtraction result is 0, no processing is carried out and the subsequent instruction is executed.
• The flag remains unchanged.
[Description example]
DBNZ B, $1215H; The B register contents are decremented. If the result is not 0, program branches to 1215H
(with the start of this instruction set in the range of addresses 1194H to 1293H).
No Operation
NOP No Operation
[Operation] no operation
[Operand]
None
[Flag]
Z AC CY
[Description]
• No processing is performed and only time is consumed.
Enable Interrupt
EI Interrupt Enabled
[Instruction format] EI
[Operation] IE ← 1
[Operand]
None
[Flag]
Z AC CY
[Description]
• The maskable interrupt acknowledge-enable status is set (by setting the interrupt enable flag (IE) (1)).
• Interrupts are acknowledged immediately after this instruction is executed.
• If this instruction is executed, vectored interrupt acknowledgment with another source can be disabled. For
details, refer to "Interrupt Functions" in the User's Manual of each product.
Disable Interrupt
DI Interrupt Disabled
[Instruction format] DI
[Operation] IE ← 0
[Operand]
None
[Flag]
Z AC CY
[Description]
• Maskable interrupt acknowledgment with vectored interrupt is disabled (with the interrupt enable flag (IE)
cleared (0)).
• No interrupts are acknowledged between this instruction and the subsequent instruction.
• For details of interrupt servicing, refer to "Interrupt Functions" in the User's Manual of each product.
Halt
HALT HALT Mode Set
[Operand]
None
[Flag]
Z AC CY
[Description]
• This instruction is used to set the HALT mode to stop the CPU operation clock. Total power consumption of
the system can be reduced with intermittent operations through combination with the normal operation mode.
Stop
STOP Stop Mode Set
[Operand]
None
[Flag]
Z AC CY
[Description]
• This instruction is used to set the STOP mode to stop the main system clock oscillator and to stop the whole
system. Power dissipation can be minimized to an ultra-low leakage current level only.
[A] [M]
[B] [N]
A history of the revisions up to this edition is shown below. “Applied to:” indicates the chapters to which the
revision was applied.
Modification of the format of the table of the internal data memory space of the CHAPTER 1 MEMORY
78K/0S Series products SPACE
Tel. FAX
Address
North America Hong Kong, Philippines, Oceania Asian Nations except Philippines
NEC Electronics Inc. NEC Electronics Hong Kong Ltd. NEC Electronics Singapore Pte. Ltd.
Corporate Communications Dept. Fax: +852-2886-9022/9044 Fax: +65-250-3583
Fax: 1-800-729-9288
1-408-588-6130
Korea Japan
Europe
NEC Electronics Hong Kong Ltd. NEC Semiconductor Technical Hotline
NEC Electronics (Europe) GmbH
Seoul Branch Fax: 044-435-9608
Technical Documentation Dept.
Fax: 02-528-4411
Fax: +49-211-6503-274
South America Taiwan
NEC do Brasil S.A. NEC Electronics Taiwan Ltd.
Fax: +55-11-6465-6829 Fax: 02-2719-5951
Document title: