No part of this material may be reproduced or duplicated in any form or by any means without the written permission of Seiko
Epson. Seiko Epson reserves the right to make changes to this material without notice. Seiko Epson does not assume any
liability of any kind arising out of any inaccuracies contained in this material or due to its application or use in any product or
circuit and, further, there is no representation that this material is applicable to products requiring high level reliability, such
as medical products. Moreover, no license to any intellectual property rights is granted by implication or otherwise, and there
is no representation or warranty that anything made in accordance with this material will be free from any patent or copyright
infringement of a third party. This material or portions thereof may contain technology or the subject relating to strategic
products under the control of the Foreign Exchange and Foreign Trade Law of Japan and may require an export license from
the Ministry of International Trade and Industry or other approval from another government agency.
Starting April 1, 2001, the product number will be changed as listed below. To order from April 1,
2001 please use the new product number. For further information, please contact Epson sales
representative.
Configuration of product number
Devices
S1C60N01F0A01
Development tools
S5U1
∗1: For details about tool types, see the tables below. (In some manuals, tool types are represented by one digit.)
∗2: Actual versions are not written in the manuals.
C60R08D11
00
Packing specification
Specification
Package (D: die form; F: QFP)
Model number
Model name (C: microcomputer, digital products)
Product classification (S1: semiconductor)
00
Packing specification
Version (1: Version 1 ∗2)
Tool type (D1: Development Tool ∗1)
Corresponding model number (60R08: for S1C60R08)
Tool classification (C: microcomputer use)
Product classification
(S5U1: development tool for semiconductor products)
APPENDIX A. S1C6200A (ADVANCED S1C6200) CORE CPU _________________ 84
B. INSTRUCTION INDEX ______________________________________ 87
S1C6200/6200A CORE CPU MANUALEPSONi
1 DESCRIPTION
1DESCRIPTION
The S1C6200/6200A is the Core CPU of the S1C62 Family of CMOS 4-bit single-chip microcomputers. The CPU features a highly-integrated architecture. Memory-mapped peripheral circuits can include
RAM, ROM, I/O ports, interrupt controllers, timers and LCD drivers, depending upon the application.
The memory address space is divided into program and data memory, each with data and address lines.
Program memory consists of on-chip ROM, containing instructions to be executed by the CPU. Data
memory consists of RAM and memory-mapped I/O, as determined by the design of the peripheral circuitry.
A large memory as well as instructions capable of 8-bit data manipulation enhance the functionality of the
S1C62 Family. Implementation of a common Core CPU ensures that a wide range of application-specific
devices can be designed and fabricated with the minimum turnaround time.
1.1System Features
• Common Core CPU for all S1C62 Family microcomputers
• UP to 8,192 12-bit words of program memory (ROM)
• UP to 4,096 4-bit words of data memory (RAM/peripheral circuits)
• Memory-mapped I/O
• 5, 7 or 12 clock cycle instructions
• 109 instructions
• Up to 85 levels of subroutine nesting
• 8-bit stack pointer
• Up to 15 interrupt vectors
• Two standby modes
• Low-power CMOS process
1.2Instruction Set Features
• Four addressing modes: one direct, two indirect, and one stack pointer
• Direct addressing transfers data to and from data memory with a single instruction, resulting in more
efficient code
• 8-bit load instructions and table look-up instructions
• Arithmetic operations in either hexadecimal or decimal
There are some differences in the following operation/circuit between the S1C6200 and the S1C6200A.
For the detailes of each difference, refer to the section enclosed with parentheses.
• Initial setting of D (decimal) flag (refer to Section 2.5.5, "Initial reset".)
• Interrupt circuit
–Interrupt timing (refer to Section 2.5.3, "Operation during interrupt generation".)
–Writing to interrupt mask registers and reading of interrupt flags (refer to Appendix A, "S1C6200A
(Advanced S1C6200) Core CPU".)
S1C6200/6200A CORE CPU MANUALEPSON1
1 DESCRIPTION
RAM, Peripheral I/O
(4,096 4-bit words max.)
8-bit address bus13-bit address bus
Program Counter Block
Micro-Instructions
Instruction Decorder
Instruction Register (12)
Program Memory
(8,192 12-bit words max.)
Data Memory
YHL (8)
XHL (8)
Stack Pointer (8)
12-bit data bus
ROM
RP (4)
4-bit address bus
4-bit data bus
XP (4)
YP (4)
Interrupt
Controller
A (4)
TEMPB (5)
I DZC
Oscillator
Timing
Generator
B (4)
TEMPA (5)
ALU
S1C6200 CORE CPU
Fig. 1.1 Block diagram
2EPSONS1C6200/6200A CORE CPU MANUAL
2 MEMORY AND OPERATIONS
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;;;;;;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;;;;;;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;;;
2MEMORYAND OPERATIONS
A single-chip microcomputer using the S1C6200/6200A Core CPU has four major blocks: the
program memory (ROM), the data memory (RAM and I/O), the arithmetic logic unit (ALU) and the timing
generator circuit. This section describes each of these blocks in detail.
2.1Program Memory (ROM)
Program memory contains the instructions that the CPU executes. Figure 2.1.1 shows the configuration of
the program memory.
Each instruction is a 12-bit word. Program memory can also be used for data tables for the table look-up
instructions.
There are two banks of program memory. Each bank is subdivided into 16 pages of 256 words (or steps).
That is:
Program memory = 2 banks
= 8,192 steps
1 bank= 4,096 steps
= 16 pages
1 page= 256 steps
1 step= 1 word
= 12 bits
Certain addresses in ROM have specific functions, as shown in Table 2.1.1.
Table 2.1.1 Allocated program memory
AddressFunction
Bank 0, Page 1, Step 0
Bank 0, Page 1, Step 1 to 15
Bank 0, Page 0, Step 0 to 255
Bank 1, Page 1, Step 1 to 15
Bank 1, Page 0, Step 0 to 255
Reset vector
Interrupt vectors used while a program is running in bank 0
Bank 0, page 0 area
Direct call subroutines for use by CALZ while a program is running in bank 0
Interrupt vectors used while a program is running in bank 1
Bank 1, page 0 area
Direct call subroutines for use by CALZ while a program is running in bank 1
Page 1
Bank 0
Step 0
Step 1
Step 15
Step 254
Step 255
12-bit
instructions
Reset vector
Interrupt
vectors
for Bank 0
;;;;
;;;;
;;;;
;;;;
;;;;
;;;;
Bank 0
Step 0
Step 1
Step 254
Step 255
Page 0
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
Bank 0Bank 1
Bank 0
Step 0
Step 1
Page 3
Bank 0
Page 2
Bank 0
Step 0
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
Step 254
Step 255
PCB (between banks)
;;
;;
S1C6200/6200A CORE CPU MANUALEPSON3
Fig. 2.1.1 Program memory configuration
Page 15
Bank 0
Page 14
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
PCP
(within bank)
Program or data
code area
PCS
(within bank)
Bank 1
Step 0
Step 1
Step 254
Step 255
;;
;;
Bank 1
Step 0
Page 0
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;
;;;;
;;;;
;;;;
;;;;
;;;;
;;;;
Bank 1
;;;;
Step 0
;;;;
;;;;
Step 1
;;;;
;;;;
Step 15
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
Page 3
Bank 1
Page 2
Step 254
Step 255
Program or data
code or CALZ
subloutines in
Bank 0
Page 1
;;;;;
;;;;;
Interrupt
;;;;;
;;;;;
vectors
;;;;;
for Bank 1
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;
;;
Bank 1
Step 0
Step 1
Step 254
Step 255
Program or data
code or CALZ
subloutines in
Bank 1
Bank 1
Page 14
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
Page 15
;;;;
;;;;
;;;;
;;;;
;;;;
;;;;
;;;;
;;;;
;;;;
;;;;
;;;;
;;;;
2 MEMORY AND OPERATIONS
2.1.1 Program counter block
The program counter is used to point to the next instruction step to be executed by the CPU. See Figure
2.1.1.1.
The program counter has the following registers.
Table 2.1.1.1 Program counter registers
RegisterSize
PCB (Program Counter-Bank)
PCP (Program Counter-Page)
PCS (Program Counter-Step)
NBP (New Bank Pointer)
NPP (New Page Pointer)
PCB, PCP and PCS together from a 13-bit counter which can address any location in program memory.
PCP and PCS together from a 12-bit counter which can address any location within a given bank of pro-
gram memory. Each time an instruction other than a jump is executed, this counter increments by one.
Thus, a jump instruction does not need to be executed between the last step of one page and the first step of
the next.
The contents of NBP and NPP are loaded into PCB and PCP each time an instruction is executed. On reset,
NBP and NPP are loaded with the same values as PCB and PCP.
2.1.2 Flags
The following flags are provided.
Table 2.1.2.1 Flags
FlagSize
Interrupt
Decimal mode
Zero
Carry
Menus
I
D
Z
C
1: Enabled
0: Disabled
1: Decimal
0: Hexadecimal
1: Set
0: Ignored
1: Set
0: Ignored
4EPSONS1C6200/6200A CORE CPU MANUAL
2 MEMORY AND OPERATIONS
2.1.3 Jump instructions
A jump can be made using the instructions in Table 2.1.3.1.
Table 2.1.3.1 Jump instructions
Type of jumpInstruction
Unconditional
Conditional
Subroutine call
Return
Page set
Indirect
The differences between jumps within the same page and jumps from one page to another is as follows.
• Jumps within the same page
A jump can be made within the same page using any of the following instructions:
JP, JP C, JP Z, JP NZ, JPBA or CALL
The destination address is specified by the 8-bit operand. A label can be used to specify a destination
address with the S1C62 Family cross assembler.
• Jumps from one page to another
The destination bank and page should be set using PSET before executing a JP instruction.
2.1.4 PSET with jump instructions
PSET loads the four low-order bits (page part) of its 5-bit operand to NPP (new page pointer) and loads the
high-order bit (bank part) to NBP (new bank pointer). Executing a JP instruction immediately after PSET
causes a jump to the bank specified by NBP, the page specified by NPP and the step specified by the JP
instruction operand. See Figure 2.1.4.1.
Page 14
PSET
JUMP
Step 0
Step 1
Page 15Bank 0
Jump with PSET can go anywhere
within the program memory
Jump can go between banks
Bank 1
Page 3Bank 1
Page 2Bank 1
Page 1Bank 1
Page 0Bank 1
Bank 1
Step 0
Step 1
Step 254
Step 255
Page 15Bank 1
Page 14
JUMP
Jump without PSET
can go anywhere
Step 0
Step 1
Step 254
Step 255
Bank 0
Page 3Bank 0
Page 2Bank 0
Page 1Bank 0
Page 0Bank 0
Bank 0
Step 0
Step 1
Step 254
Step 255
within one page
Step 254
Step 255
Fig. 2.1.4.1 The PSET and jump instructions
2.1.5 Call instructions
As only the page data specified by NPP is loaded to PCP when a call instruction is executed, subroutine
calls between banks are not possible. Jumps between banks can only be made using JP instructions.
S1C6200/6200A CORE CPU MANUALEPSON5
2 MEMORY AND OPERATIONS
2.1.6 PSET instruction
Jump or call instructions must follow PSET immediately in order for PSET to affect the destination address.
When a jump or call is not immediately preceded by PSET, the destination address is within the current
page.
Some examples using PSET are shown in Table 2.1.6.1.
Table 2.1.6.1 PSET examples
Bank Page StapInstruction
PSET
JP
PSET
NOP5
JP
SCF
PSET
JP
RFC
PSET
JP
JP
13H
08H
•
•
15H
09H
•
•
14H
C, 07H
•
•
05H
C, 08H
09H
•
•
0
01H
10H
0
01H
11H
•
•
•
•
•
•
0
01H
21H
0
01H
22H
0
01H
23H
•
•
•
•
•
•
0
01H
55H
0
01H
56H
0
01H
57H
•
•
•
•
•
•
0
01H
60H
0
01H
61H
0
01H
62H
0
01H
63H
•
•
•
•
•
•
The program jumps to bank 1, page 3, step 8.
The data set by PSET is canceled.
The program jumps to bank 0, page 1, step 9.
C flag is set.
The program jumps to bank 1, page 4, step 7 because C flag = 1.
C flag is reset.
No jump occurs because C flag = 0.
The data set by PSET is canceled, and the program jumps to bank 0, page 1, step 9.
Operation
2.1.7 CALZ instruction
CALZ is a direct subroutine call instruction. It calls a subroutine, in page 0 of the current bank, from any
page without requiring the use of PSET.
If CALZ is executed immediately after PSET, the bank and page set by PSET is canceled. This allows direct
subroutine calls to page 0, minimizing repeated code and unnecessary use of PSET. See Figure 2.1.7.1.
Bank 0 Page 0
EEE....................
RET
Bank 0 Page 2
PSET
CALZ
LD
0AH
EEE
A,0
Fig. 2.1.7.1 The use of the CALZ instruction
Not effect
on destination
of CALZ
6EPSONS1C6200/6200A CORE CPU MANUAL
The difference between CALL and CALZ is shown in Figure 2.1.7.2.
2 MEMORY AND OPERATIONS
CALL with PSET
can go anywhere
within a bank
Bank 1
Page 1Bank 1
Page 0Bank 1
Step 0
Step 1
Page 3
CALZ
Bank 1
Step 0
Step 1
Step 254
Step 255
Page 15Bank 1
Page 14
CALL
Step 0
Step 1
Bank 0Bank 1
Bank 0
Page 3
Page 1Bank 0
Page 0Bank 0
CALZ
Bank 0
Step 0
Step 1
Step 254
Step 255
Page 15Bank 0
Page 14
PSET
CALL
CALL without PSET
can go anywhere
in a page
Step 254
Step 255
CALL and CALZ
cannot go
between banks
Step 254
Step 255
CALZ can only go to page 0
of the current bank
Fig. 2.1.7.2 The difference between CALL and CALZ instructions
2.1.8 RET and RETS instructions
The RET instruction causes a return from a subroutine to the address immediately following the address
from where that subroutine was called. The RETS instruction causes a return to the address following this
address. Proper use of RET and RETS allows simple conditional exits subroutines back to the main routine.
See Figure 2.1.8.1.
Bank 0 Page 0
Program memory
PSET
0AH
CALL
DDD
LD
Bank 0 Page 10
Program memory
LD
A,0
B,0
DDD....................
RET
RETS
Fig. 2.1.8.1 Difference between RET and RETS instructions
2.1.9 Stack considerations for call instructions
When a subroutine is called, the return address is loaded into the stack and retrieved when control is
returned to the calling program. Nesting allows efficient usage of the stack area.
As the stack area resides in the data memory, care should be taken to ensure that the stack area is not
corrupted by other data.
S1C6200/6200A CORE CPU MANUALEPSON7
2 MEMORY AND OPERATIONS
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
2.2Data Memory
The data memory area comprises 4,096 4-bit words. The RAM, timer, I/O and other peripheral circuits are
mapped into this memory according to the designer's specifications. Figure 2.2.1 shows the data memory
configuration.
Page 15
SP
Page 0
only
RP
Page 0
only
Page 0
Step 0
Step 1
Step 15
Step 254
Step 255
Page 2
Page 1
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
Page 14
Step 0
Step 1
Page 3
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
Step 254
Step 255
4-bit data
Fig. 2.2.1 Data memory configuration
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
XHL or YHL
(within page)
XP or YP
(page specification)
;;
Memory or I/O
;;
;;
Register area
;;
2.2.1 Data memory addressing
The following registers and pointers, which are described in detail below, are used to address the data
memory.
Table 2.2.1.1 Registers and pointer for data memory addressing
Register/Pointer
Index Register X
Index Register Y
Stack Pointer
Register
• Index register IX
Index register IX has a 4-bit page part (XP) and an 8bit register (XHL), and can address any location in
the data memory. See Figure 2.2.1.1.
XHL is divided into two 4-bit groups: the four highorder bits (XH) and the four low-order bits (XL), and
can address any location within a page.
–MX is the data memory location whose address is specified by IX.
–M(X) refers to the contents of the data memory location whose address is specified by IX.
–XHL can be incremented by 1 or 2 using a post-increment instruction (LDPX, ACPX, SCPX, LBPX or
RETD). An overflow occurring in XHL does not affect the flags.
Mnemonic
IX
IY
SP
RP
Size (bits)
12
12
8
4
MSB
4
XP
44
XHXL
XHL
IX
Fig. 2.2.1.1 The configuration of the index register IX
LSB
8EPSONS1C6200/6200A CORE CPU MANUAL
2 MEMORY AND OPERATIONS
Push-down
(SP is decremented)
Pop-up
(SP is incremented)
OperationInstruction
Stack usage
-3
-3
-1
-1
+3
+1
+1
Interrupt
CALL or CALZ
PUSH
DEC SP
RET, RETS or RETD
POP
INC SP
• Index register IY
Index register IY is like the index register IX: it has a
4-bit page part (YP), an 8-bit register (YHL), and can
address any location in the data memory. See Figure
2.2.1.2.
YHL is divided into two 4-bit groups: the four high-
order bits (YH) and the four low-order bits (YL), and
can address any location within a page.
MSB
4
YP
44
YHYL
YHL
IY
Fig. 2.2.1.2 The configuration of the index register IY
–MY is the data memory location whose address is specified by IY.
–M(Y) refers to the contents of the data memory location whose address is specified by IY.
–YHL can be incremented by 1 using a post-increment instruction (LDPY, ACPY or SCPY). An
overflow occurring in YHL does not affect the flags.
LSB
• Stack pointer SP
The stack area resides in the data memory. The 8-bit, push-down/pop-up stack pointer (SP) is used to
address an element within the stack.
Since it is an 8-bit pointer, SP can only address 256
words out of the total 4,096 words of data memory.
When SP is used, the high-order 4 bits (page part) of
the data memory address are 0, giving a stack area of
256 words in the address range 000H to 0FFH.
In systems with a RAM area of less than 256 words,
the entire RAM area can be used as the stack area.
Stack area usage is shown in Table 2.2.1.2.
The PUSH instruction can be used to store registers and flags in the stack in single-word (4-bit) units.
The POP instruction is used to retrieve this data.
When an interrupt occurs or a call instruction is executed, the return address from the program counter
is pushed onto the stack. When a return instruction is executed, the return address is retrieved from the
stack and loaded into the program counter.
On an interrupt, only the program counter is saved on the stack; flag and register data are not saved.
Programs should be designed so that flag and register data are pushed onto the stack by the interrupt
service routines.
Following a system reset, SP should be initialized using the LD SPH,r or LD SPL,r instructions, where
r represents A, B, MX or MY (4 bits).
Stack pointer data can be read using LD r,SPH or LD r,SPL.
Table 2.2.1.2 Stack usage
• Register pointer RP
The register pointer (RP) is a 4-bit register used to address the first 16 words of data memory, or the
register area. Direct addressing can be used to read from, write to, increment or decrement any location
within this area efficiently, using a single instruction.
Programs cannot directly access RP. It uses the
operand of direct addressing instructions. The
instructions that can access the register area of data
memory are:
LD
LD
LD
S1C6200/6200A CORE CPU MANUALEPSON9
LD
INC
DEC
A,Mn
B,Mn
Mn,A
Mn,B
Mn
Mn
A ← M(n)
B ← M(n)
M(n) ← A
M(n) ← B
M(n) ← M(n) + 1
M(n) ← M(n)
n: 0 to F
where M(n) is the contents of a data memory
location within the register area.
As the register area can also be indirectly accessed
–
1
using IX, IY or SP, the stack area should not grow
to address 000H to 00FH when RP is used.
2 MEMORY AND OPERATIONS
2.3ALU (Arithmetic Logic Unit) and Registers
Table 2.3.1 shows ALU operations between the 4-bit registers, TEMPA and TEMPB.
Table 2.3.1 ALU register operation
OperationInstruction
Add, without carry
Add, with carry
Subtract, without borrow
Subtract, with borrow
Logical-AND
Logical-OR
Exclusive-OR
Comparison
Flag bit test
Rotate right, with carry
Rotate left, with carry
Invert
The Z (zero) flag is set when the result of ALU operation is
C3210
X0000X: Don't care.
The C (carry) flag is set when an add operation causes a carry or when a subtract operation causes a
borrow.
ADD
ADC
SUB
SBC
AND
OR
XOR
CP
FAN
RRC
RLC
NOT
2.3.1 D (decimal) flag and decimal operations
Setting the D (decimal) flag activates the decimal mode, allowing decimal addition and subtraction. Table
2.3.1.1 shows the relations of actual (decimal) results, ALU outputs, and the values of the C and Z flags.
Table 2.3.1.1 Results of hexadecimal and decimal operations
B
C
D
E
F
0
1
2
3
4
5
6
7
8
9
0
1
2
3
4
5
6
7
8
9
A
B
C
D
E
F
10EPSONS1C6200/6200A CORE CPU MANUAL
2 MEMORY AND OPERATIONS
Hexadecimal operations will not always produce the correct result if performed in decimal mode.
Note that:
• An add instruction with carry (for example, ADC XH,i) which uses index registers XH, XL, YH and YL,
does not involve decimal correction even if it is performed in the decimal mode. This is because it uses
an 8-bit field for 4-bit data.
• The results of the compare instruction (CP) is not decimal-corrected, because the carry flag is ignored.
• The result of the register memory increment instruction (INC Mn) and decrement instruction (DEC Mn)
are not decimal-corrected.
2.3.2 A and B registers
The A and B registers are 4-bit general-purpose registers used as accumulators. They transfer data and
perform ALU operations with other registers, data memory and immediate data.
The data in A can be paired with that in B for use as an indirect jump address by the JPBA instruction.
2.4Timing Generator
S1C6200/6200A instructions can be divided into three different types depending on the number of clock
cycles per instruction: 5, 7 or 12 clock cycles. The more complex the instruction, the more cycles it requires.
Note that the number of clock cycles determines the duration of instructions which, in turn, will affect any
timing performed in software.
As shown in Figure 2.4.1, the first state of all instructions is a fetch cycle. This is followed by a number of
execute cycles.
5-clock/7-clock instructions
Clock
Status
Instruction
register
Date
memory
FetchExecuteFetch
State
0
State
1
Execute
State2State0State
1
State
2
State
3
12-clock instructions
Clock
Status
Instruction
register
Fetch
State
0
State
1
State
2
Execute
State3State4State
5
State
6
Fig. 2.4.1 Instruction execution timing
2.4.1 HALT and SLP (sleep) modes
HALT and SLP cause the CPU to store the return address on the stack and then stop. HALT will only stop
the CPU; the system clock will continue to run. SLP also stops the system clock, resulting in reduced power
consumption. The CPU can be restarted by an interrupt.
As interrupts are not automatically enabled by the execution of HALT or SLP, programs should always
enable interrupts before executing HALT or SLP, otherwise they will hang waiting for an interrupt.
S1C6200/6200A CORE CPU MANUALEPSON11
2 MEMORY AND OPERATIONS
2.5Interrupts
The S1C6200/6200A can have up to 15 interrupt vectors. When used with peripheral circuits, these allow
internal and external interrupts to be processed easily. See Figure 2.5.3.1 through 2.5.3.4.
2.5.1 Interrupt vectors
The interrupt vectors are assigned to steps 1 to 15 in page 1 of each bank of the program memory. When an
interrupt occurs, the program jumps to the appropriate interrupt vector in the current bank.
The priority and linking of these vectors to actual outside events depends on the configuration of the
peripheral circuits and therefore is device-specific. This information can be found in the technical manuals
for the specific device.
2.5.2 I (interrupt) flag
The I (interrupt) flag enables or disables all interrupts.
When DI or RST F is used to reset the I flag, interrupts are disabled with that instruction step. When EI or
SET F is used to set the I flag, interrupts are enabled after the following instruction step. For example, to
return control from the interrupt subroutine to the main routine, the sequence EI, RET, does not enable
interrupts until after RET has been executed.
The I flag is reset to 0 (DI) on reset.
2.5.3 Operation during interrupt generation
When an interrupt is generated, the program is halted, the program counter (PCP and PCS) is stored on the
stack, the I flag is reset to DI mode and NPP is set to 1. The program then branches to the interrupt vector
corresponding to the interrupt request. Registers and flags are unaffected by an interrupt.
Register and flag data must be saved by the program since they are not automatically stored on the stack.
The I flag can be set to 1 (EI) within the interrupt subroutine, because nesting of multiple interrupts is
available.
If an interrupt is generated while the CPU is in HALT or SLP mode, the CPU is restarted and the interrupt
serviced. When the interrupt service routine is completed, the program resumes from the instruction
following the HALT or SLP.
<Differences between S1C6200 and S1C6200A>
In the S1C6200 and the S1C6200A, the time it takes to complete interrupt processing by hardware after the
Core CPU receives the interrupt request is different as follows:
Table 2.5.3.1 Required interrupt processing time
Item
a) During instruction execution
b) At HALT mode
c) During PSET instruction execution
Program Counter Step
Program Counter Page
Program Counter Bank
New Page Pointer
New Bank Pointer
Stack Pointer
Index Register
Index Register
Register Pointer
General Register
General Register
Interrupt Flag
Decimal Flag
Zero Flag
Carry Flag
PCS
PCP
PCB
NPP
NBP
SP
IX
IY
RP
A
B
I
D
Z
C
8
4
1
4
1
8
12
12
4
4
4
1
1
1
1
<Difference between S1C6200 and S1C6200A>
There is a difference in the setting value of the D (decimal) flag at initial reset between the S1C6200 and the
S1C6200A.
Table 2.5.4.2 D (decimal) flag initial setting
CPU Core
D (decimal) flag setting
S1C6200A
When using the model loaded with the S1C6200 Core CPU, set or reset the D flag in the user's initial
routine before using an arithmetic instruction. (refer to the SDF and RDF instructions.)
S1C6200/6200A CORE CPU MANUALEPSON15
3 INSTRUCTION SET
3INSTRUCTION SET
This chapter describes the entire instruction set of the S1C6200/6200A Core CPU.
A subset is allocated to each device within the S1C62 Family according to the configuration of the device.
Therefore not all instructions are available in every device. The relevant information is in the technical
manual for each device.
The source format and a description of the assembler is in the series-specific cross assembler manuals.
The instruction set contains 109 instructions. Each instruction comprises of one 12-bit word.
3.1Instruction Indices
Three index tables are used for easy reference instructions.
a. Index by function
The instructions are arranged by function.
1. Branch
2. System control
3. Flag operation
4. Stack operation
5. Index operation
6. Data transfer
7. Arithmetic and logical operation
b. Index in alphabetical order
The instructions are arranged in alphabetical order. Page number references are provided.
c. Index by operation code
The instructions are arranged in numerical order by operation code.
16EPSONS1C6200/6200A CORE CPU MANUAL
3.1.1 By function
3 INSTRUCTION SET
ClassificationOperandClock
Branch
instructions
System
control
instructions
Index
operation
instructions
Mne-
monic
PSET
JP
JPBA
CALL
CALZ
RET
RETS
RETD
NOP5
NOP7
HALT
SLP
INC
LD
ADC
p
s
C, s
NC, s
Z, s
NZ, s
s
s
e
X
Y
X, e
Y, e
XP, r
XH, r
XL, r
YP, r
YH, r
YL, r
r, XP
r, XH
r, XL
r, YP
r, YH
r, YL
XH, i
XL, i
YH, i
YL, i
B
1
0
0
0
0
0
1
0
0
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
Operation CodeFlag
A
9
8
7
6
5
4
1
1
0
0
1
0
p4
p3
0
0
0
s7
s6
s5
s4
s3
0
1
0
s7
s6
s5
s4
s3
0
1
1
s7
s6
s5
s4
s3
1
1
0
s7
s6
s5
s4
s3
1
1
1
s7
s6
s5
s4
s3
1
1
1
1
1
1
0
1
0
0
s7
s6
s5
s4
s3
1
0
1
s7
s6
s5
s4
s3
1
1
1
1
1
0
1
1
1
1
1
1
0
1
0
0
1
e7
e6
e5
e4
e3
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
0
1
1
0
1
1
1
1
0
1
1
e7
e6
e5
e4
e3
0
0
0
e7
e6
e5
e4
e3
1
1
0
1
0
0
0
1
1
0
1
0
0
0
1
1
0
1
0
0
0
1
1
0
1
0
0
1
1
1
0
1
0
0
1
1
1
0
1
0
0
1
1
1
0
1
0
1
0
1
1
0
1
0
1
0
1
1
0
1
0
1
0
1
1
0
1
0
1
1
1
1
0
1
0
1
1
1
1
0
1
0
1
1
0
1
0
0
0
0
0
0
1
0
0
0
0
1
0
1
0
0
0
1
0
0
1
0
0
0
1
1
3
2
1
0
IDZC
p2
p1
p0
s2
s1
s0
s2
s1
s0
s2
s1
s0
s2
s1
s0
s2
s1
s0
1
0
0
0
s2
s1
s0
s2
s1
s0
1
1
1
1
1
1
1
0
e2
e1
e0
1
0
1
1
1
1
1
1
1
0
0
0
1
0
0
1
0
0
0
0
0
0
0
0
e2
e1
e0
e2
e1
e0
0
0
r1
r0
0
1
r1
r0
1
0
r1
r0
0
0
r1
r0
0
1
r1
r0
1
0
r1
r0
0
0
r1
r0
0
1
r1
r0
1
0
r1
r0
0
0
r1
r0
0
1
r1
r0
1
0
r1
r0
i3
i2
i1
i0
i3
i2
i1
i0
i3
i2
i1
i0
i3
i2
i1
i0
5
5
5
5
5
5
5
7
7
7
12
12
5
7
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
↑
↑
7
↓
↓
↑
↑
7
↓
↓
↑
↑
7
↓
↓
↑
↑
7
↓
↓
Operation
←
p4, NPP ← p3~p0
NBP
←
NBP, PCP ← NPP, PCS ← s7~s0
PCB
←
NBP, PCP ← NPP, PCS ← s7~s0 if C=1
PCB
←
NBP, PCP ← NPP, PCS ← s7~s0 if C=0
PCB
←
NBP, PCP ← NPP, PCS ← s7~s0 if Z=1
PCB
←
NBP, PCP ← NPP, PCS ← s7~s0 if Z=0
PCB
←
NBP, PCP ← NPP, PCSH ← B, PCSL ← A
PCB
←
M(SP-1)
SP
M(SP-1)
SP
PCSL
SP
PCSL
SP
PCSL
SP
PCP, M(SP-2) ← PCSH, M(SP-3) ← PCSL+1
←
SP-3, PCP ← NPP, PCS ← s7~s0
←
PCP, M(SP-2) ← PCSH, M(SP-3) ← PCSL+1
←
SP-3, PCP ← 0, PCS ← s7~s0
←
M(SP), PCSH ← M(SP+1), PCP ← M(SP+2)
←
SP+3
←
M(SP), PCSH ← M(SP+1), PCP ← M(SP+2)
←
SP+3, PC ← PC+1
←
M(SP), PCSH ← M(SP+1), PCP ← M(SP+2)
←
SP+3, M(X) ← e3~e0, M(X+1) ← e7~e4, X ← X+2
No operation (5 clock cycles)
No operation (7 clock cycles)
Halt (stop clock)
SLEEP (stop oscillation)
A, Mn
B, Mn
Mn, A
Mn, B
r, i
r, q
r, SPH
r, SPL
r, XH
r, XL
r, XP
r, YH
r, YL
r, YP
SPH, r
SPL, r
XH, r
XL, r
XP, r
X, e
YH, r
YL, r
YP, r
Y, e
MX, i
r, q
MY, i
r, q
No operation (5 clock cycles)
No operation (7 clock cycles)
←
r
r
←
rVi3~i0
r
←
rVq
r
←
M(SP), SP ← SP+1
F
←
M(SP), SP ← SP+1
r
←
M(SP), SP ← SP+1
XH
←
M(SP), SP ← SP+1
XL
←
M(SP), SP ← SP+1
XP
←
M(SP), SP ← SP+1
YH
←
M(SP), SP ← SP+1
YL
←
M(SP), SP ← SP+1
YP
S1C6200/6200A CORE CPU MANUALEPSON21
3 INSTRUCTION SET
Mne-
PageOperandClock
monic
67
PSET
68
PUSH
68
69
69
70
70
71
71
RCF
72
RDF
72
RET
73
RETD
73
RETS
74
RLC
74
RRC
75
RST
75
RZF
76
SBC
76
77
SCF
77
SCPX
78
SCPY
78
SDF
79
SET
79
SLP
80
SUB
80
SZF
81
XOR
81
82
p
F
r
XH
XL
XP
YH
YL
YP
e
r
r
F, i
r, i
r, q
MX, r
MY, r
F, i
r, q
r, i
r, q
B
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
Operation CodeFlag
A
9
8
7
6
5
4
1
1
0
0
1
0
p4
1
1
1
1
1
0
0
1
1
1
1
1
0
0
1
1
1
1
1
0
0
1
1
1
1
1
0
0
1
1
1
1
1
0
0
1
1
1
1
1
0
0
1
1
1
1
1
0
0
1
1
1
1
1
0
0
1
1
1
0
1
0
1
1
1
1
0
1
0
1
1
1
1
1
1
0
1
0
0
1
e7
e6
e5
e4
1
1
1
1
1
0
1
0
1
0
1
1
1
1
1
1
0
1
0
0
0
1
1
1
0
1
0
1
1
1
1
0
1
0
1
1
0
1
0
1
r1
r0
0
1
0
1
0
1
1
1
1
1
0
1
0
0
1
1
1
0
0
1
1
1
1
1
0
0
1
1
1
1
1
0
1
0
0
1
1
1
0
1
0
0
1
1
1
1
1
1
1
0
1
0
1
0
1
0
1
1
1
0
1
0
0
1
0
1
0
0
r1
r0
0
1
0
1
1
1
0
3
2
1
0
IDZC
p3
p2
p1
p0
1
0
1
0
0
0
r1
r0
0
1
0
1
0
1
1
0
0
1
0
0
1
0
0
0
1
0
0
1
0
1
1
1
1
1
1
0
1
0
1
1
1
1
1
1
e3
e2
e1
e0
1
1
1
0
r1
r0
r1
r0
1
1
r1
r0
i3
1
i3
r1
r0
0
1
1
0
i3
1
r1
r0
0
i3
r1
r0
↓
i2
i1
i0
1
0
1
i2
i1
i0
q1
q0
0
0
1
0
r1
r0
1
r1
r0
1
0
0
↑
i2
i1
i0
0
0
1
q1
q0
0
1
0
i2
i1
i0
q1
q0
5
5
5
5
5
5
5
5
5
↓
7
↓
7
7
12
12
↑
↑
7
↓
↓
↑
↑
5
↓
↓
↓
↓
↓
7
↓
7
★
↑
↑
7
↓
↓
★
↑
↑
7
↓
↓
↑
7
★
↑
↑
7
↓
↓
★
↑
↑
7
↓
↓
↑
7
↑
↑
↑
7
5
★
↑
↑
7
↓
↓
↑
7
↑
7
↓
↑
7
↓
Operation
←p4, NPP←p3~p0
NBP
←SP-1, M(SP)←F
SP
←SP-1, M(SP)←r
SP
←SP-1, M(SP)←XH
SP
←SP-1, M(SP)←XL
SP
←SP-1, M(SP)←XP
SP
←SP-1, M(SP)←YH
SP
←SP-1, M(SP)←YL
SP
←SP-1, M(SP)←YP
SP
←0
C
←0 (Decimal Adjuster OFF)
D
←M(SP), PCSH←M(SP+1), PCP←M(SP+2)
PCSL
←SP+3
SP
←M(SP), PCSH←M(SP+1), PCP←M(SP+2)
PCSL
←SP+3, M(X)←e3~e0, M(X+1)←e7~e4, X←X+2
SP
←M(SP), PCSH←M(SP+1), PCP←M(SP+2)
PCSL
←SP+3, PC←PC+1
SP
←d2, d2←d1, d1←d0, d0←C, C←d3
d3
←C, d2←d3, d1←d2, d0←d1, C←d0
d3
←FΛi3~i0
F
←0
Z
←r-i3~i0-C
r
←r-q-C
r
←1
C
←M(X)-r-C, X←X+1
M(X)
←M(Y)-r-C, Y←Y+1
M(Y)
←1 (Decimal Adjuster ON)
D
←FVi3~i0
F
SLEEP (stop oscillation)
←r-q
r
←1
Z
←r∀i3~i0
r
←r∀q
r
22EPSONS1C6200/6200A CORE CPU MANUAL
3.1.3 By operation code
3 INSTRUCTION SET
Operation
Code (HEX)
000 to 0FF
100 to 1FF
200 to 2FF
300 to 3FF
400 to 4FF
500 to 5FF
600 to 6FF
700 to 7FF
800 to 8FF
900 to 9FF
A00 to A0F
A10 to A1F
A20 to A2F
A30 to A3F
A40 to A4F
A50 to A5F
A60 to A6F
A70 to A7F
A80 to A8F
A90 to A9F
AA0 to AAF
AB0 to ABF
AC0 to ACF
AD0 to ADF
AE0 to AEF
AF0 to AFF
B00 to BFF
C00 to C3F
C40 to C7F
C80 to CBF
CC0 to CFF
D00 to D3F
D0F to D3F
D40 to D7F
D80 to DBF
DC0 to DFF
E00 to E3F
Mne-
OperandClock
monic
JP
RETD
JP
JP
CALL
CALZ
JP
JP
LD
LBPX
ADC
ADC
ADC
ADC
CP
CP
CP
CP
ADD
ADC
SUB
SBC
AND
OR
XOR
RLC
LD
ADD
ADC
AND
OR
XOR
NOT
SBC
FAN
CP
LD
s
e
C, s
NC, s
s
s
Z, s
NZ, s
Y, e
MX, e
XH, i
XL, i
YH, i
YL, i
XH, i
XL, i
YH, i
YL, i
r, q
r, q
r, q
r, q
r, q
r, q
r, q
r
X, e
r, i
r, i
r, i
r, i
r, i
r
r, i
r, i
r, i
r, i
E40 to E5F
E60 to E6F
E70 to E7F
E80 to E83
E84 to E87
E88 to E8B
E8C to E8F
E90 to E93
E94 to E97
E98 to E9B
EA0 to EA3
EA4 to EA7
EA8 to EAB
EB0 to EB3
EB4 to EB7
EB8 to EBB
EC0 to ECF
EE0
EE0 to EEF
EF0
EF0 to EFF
F00 to F0F
F10 to F1F
F28 to F2B
F2C to F2F
F38 to F3B
F3C to F3F
F40 to F4F
F41
F42
F44
F48
F50 to F5F
F57
F5B
F5D
F5E
F60 to F6F
F70 to F7F
F80 to F8F
Mne-
OperandClock
monic
PSET
LDPX
LDPY
LD
LD
LD
RRC
LD
LD
LD
LD
LD
LD
LD
LD
LD
LD
INC
LDPX
INC
LDPY
CP
FAN
ACPX
ACPY
SCPX
SCPY
SET
SCF
SZF
SDF
EI
RST
DI
RDF
RZF
RCF
INC
DEC
LD
p
MX, i
MY, i
XP, r
XH, r
XL, r
r
YP, r
YH, r
YL, r
r, XP
r, XH
r, XL
r, YP
r, YH
r, YL
r, q
X
r, q
Y
r, q
r, q
r, q
MX, r
MY, r
MX, r
MY, r
F, i
This section describes the operands used in the instructions.
p5-bit immediate data or labels 00H to 1FH. Used to specify a destination address.
s8-bit immediate data or labels 00H to FFH. Used to specify a destination address.
e8-bit immediate data 00H to FFH.
i4-bit immediate data 00H to 0FH.
r2-bit immediate data. See Table 3.2.1.
q2-bit immediate data. See Table 3.2.1.
The contents of A, B, MX, MY are referenced using r and q as shown in the following table.
Table 3.2.1 Values of r and q
r1 or q1
A
B
MX
MY
0
0
1
1
AA register
BB register
XPXP register---four high-order bits of IX
YPYP register---four high-order bits of IY
XXHL register---eight low-order bits of IX
YYHL register---eight low-order bits of IY
XHXH register---four high-order bits of XHL
XLXL register---four low-order bits of XHL
YHYH register---four high-order bits of YHL
YLYL register---four low-order bits of YHL
SPStack pointer SP
SPHFour high-order bits of SP
SPLFour low-order bits of SP
FFlag register (IF, DF, ZF, CF)
MXData memory location whose address is specified by IX
MYData memory location whose address is specified by IY
M
n
Data memory location within the register area (000H to 00FH), specified by immediate data n (0H to FH)
CCarry
NCNo carry
ZZero
NZNot zero
r0 or q0
0
1
0
1
3.3Flags
1. Carry flag
The carry flag is set if a carry was generated by the previous operation. It is affected by 17 arithmetic
and logical instructions, four flag operations, eight index operation instructions and the POP F instruction.
2. Zero flag
The zero flag is set if a zero occurred in the previous operation. It is affected by 26 arithmetic and logical
instructions, four flag operations, eight index operation instructions and the POP F instruction.
3. Decimal flag
The decimal flag enables decimal addition and subtraction when set. It is set by SDF or SET F,i and reset
by RDF or RST F,i. It is affected by the POP F instruction.
4. Interrupt flag
The interrupt flag enables interrupts when set. It is set by EI or SET F,i and reset by DI or RST F,i. It is
affected by the POP F instruction. When an interrupt is generated, the I flag is automatically reset. It is
not automatically set at the end of the interrupt service routine.
26EPSONS1C6200/6200A CORE CPU MANUAL
3.4Instruction Types
Instructions are divided into six types according to the size of the operand.
(I)MSBLSB
Op-code8-bit operand
(II)MSBLSB
Op-code6-bit operand
MSB
(III)
Op-code5-bit operand
LSB
3 INSTRUCTION SET
ex: JP
CALL
LBPX
ex: ADD
LD
FAN
ex: PSETp
s
s
MX,e
etc.
r, i
r, i
r, i
etc.
MSBLSB
(IV)
Op-code4-bit operand
MSBLSB
(V)
Op-code
MSBLSB
(VI)
Op-code
2-bit
operand
3.5Instruction Descriptions
This section describes S1C6200/6200A instructions in alphabetical order.
ex: SET
LD
INC
ex: ACPX
LD
PUSH
ex: JPBA
POP
INC
F, i
r, q
Mn
etc.
MX, r
XH, r
r
etc.
YL
X
etc.
S1C6200/6200A CORE CPU MANUALEPSON27
3 INSTRUCTION SET
ACPX MX,rAdd with carry r-register to M(X), increment X by 1
Source Format:
Operation:
OP-Code:
Type:
Clock Cycles:
Flag:
Description:
Example:
ACPX MX,r
M(X) ← M(X) + r + C, X ← X + 1
1111001010r1 r0F28H to F2BH
MSBLSB
V
7
C –
Set if a carry is generated; otherwise, reset.
Z –
Set if the result is zero; otherwise, reset.
D –
Not affected
I –
Not affected
Adds the carry bit and the contents of the r-register to the data memory location
addressed by IX. X is incremented by one. Incrementing X does not affect the
flags.
ACPX MX,AACPX MX,MY
X register1010 00001010 00011010 0010
Y register0100 01100100 01100100 0110
Memory (A0H)011011111111
Memory (A1H)001100110111
Memory (46H)010001000100
A register100010001000
C flag100
Z flag000
ACPY MY,rAdd with carry r-register to M(Y), increment Y by 1
Source Format:
Operation:
OP-Code:
Type:
Clock Cycles:
Flag:
Description:
Example:
ACPY MY,r
M(Y) ← M(Y) + r + C, Y ← Y + 1
1111001011r1 r0F2CH to F2FH
MSBLSB
V
7
C –
Set if a carry is generated; otherwise, reset.
Z –
Set if the result is zero; otherwise, reset.
D –
Not affected
I –
Not affected
Adds the carry bit and the contents of the r-register to the data memory location
addressed by IY. Y is incremented by one. Incrementing Y does not affect the
flags.
ACPY MY,AACPY MY,MX
X register0010 00010010 00010010 0001
Y register0000 11100000 11110001 0000
Memory (0EH)100010111011
Memory (0FH)010001001010
Memory (21H)011001100110
A register001000100010
C flag100
Z flag000
28EPSONS1C6200/6200A CORE CPU MANUAL
ADC r,iAdd with carry immediate data i to r-register
3 INSTRUCTION SET
Source Format:
Operation:
OP-Code:
Type:
Clock Cycles:
Flag:
Description:
Example:
ADC r,i
r ← r + i
MSBLSB
3 to i0 + C
110001r
1 r0 i3 i2 i1 i0C40H to C7FH
II
7
C –
Set if a carry is generated; otherwise, reset.
Z –
Set if the result is zero; otherwise, reset.
D –
Not affected
I –
Not affected
Adds the carry bit and immediate data i to the r-register.
ADC MX,3ADC B,7
Memory (MX)010010001000
B register100110010000
C flag101
Z flag101
ADC r,qAdd with carry q-register to r-register
Source Format:
Operation:
OP-Code:
Type:
Clock Cycles:
Flag:
Description:
Example:
ADC r,q
r ← r + q + C
10101001r1 r0 q1 q0A90H to A9FH
MSBLSB
IV
7
C –
Set if a carry is generated; otherwise, reset.
Z –
Set if the result is zero; otherwise, reset.
D –
Not affected
I –
Not affected
Adds the carry bit and the contents of the q-register to the r-register.
ADC MY,AADC MX,B
A register010101010101
B register000100010001
Memory (MX)011101111001
Memory (MY)101100010001
C flag110
Z flag000
S1C6200/6200A CORE CPU MANUALEPSON29
3 INSTRUCTION SET
ADC XH,iAdd with carry immediate data i to XH
Source Format:
Operation:
OP-Code:
Type:
Clock Cycles:
Flag:
Description:
Example:
ADC XH,i
XH ← XH + i
10100000i
MSBLSB
3 to i0 + C
3 i2 i1 i0A00H to A0FH
IV
7
C –
Set if a carry is generated; otherwise, reset.
Z –
Set if the result is zero; otherwise, reset.
D –
Not affected
I –
Not affected
Adds the carry bit and immediate data i to XH, the four high-order bits of XHL.
ADC XH,2ADC XH,4
XH register100111000000
C flag101
Z flag001
ADC XL,iAdd with carry immediate data i to XL
Source Format:
Operation:
OP-Code:
Type:
Clock Cycles:
Flag:
Description:
Example:
ADC XL,i
XL ← XL + i
10100001i
MSBLSB
3 to i0 + C
3 i2 i1 i0A10H to A1FH
IV
7
C –
Set if a carry is generated; otherwise, reset.
Z –
Set if the result is zero; otherwise, reset.
D –
Not affected
I –
Not affected
Adds the carry bit and immediate data i to XL, the four low-order bits of XHL.
ADC XL,3ADC XL,0EH
XL register000001000010
C flag101
Z flag100
30EPSONS1C6200/6200A CORE CPU MANUAL
ADC YH,iAdd with carry immediate data i to YH
3 INSTRUCTION SET
Source Format:
Operation:
OP-Code:
Type:
Clock Cycles:
Flag:
Description:
Example:
ADC YH,i
YH ← YH + i
10100010i
MSBLSB
3 to i0 + C
3 i2 i1 i0A20H to A2FH
IV
7
C –
Set if a carry is generated; otherwise, reset.
Z –
Set if the result is zero; otherwise, reset.
D –
Not affected
I –
Not affected
Adds the carry bit and immediate data i to YH, the four high-order bits of YHL.
ADC YH,3ADC YH,6
YH register101011100100
C flag101
Z flag000
ADC YL,iAdd with carry immediate data i to YL
Source Format:
Operation:
OP-Code:
Type:
Clock Cycles:
Flag:
Description:
Example:
ADC YL,i
YL ← YL + i
10100011i
MSBLSB
3 to i0 + C
3 i2 i1 i0A30H to A3FH
IV
7
C –
Set if a carry is generated; otherwise, reset.
Z –
Set if the result is zero; otherwise, reset.
D –
Not affected
I –
Not affected
Adds the carry bit and immediate data i to YL, the four low-order bits of YHL.
ADC YL,3ADC YL,2
YL register101011100000
C flag101
Z flag001
S1C6200/6200A CORE CPU MANUALEPSON31
3 INSTRUCTION SET
ADD r,iAdd immediate data i to r-register
Source Format:
Operation:
OP-Code:
Type:
Clock Cycles:
Flag:
Description:
Example:
ADD r,i
r ← r + i
3 to i0
110000r1 r0 i3 i2 i1 i0C00H to C3FH
MSBLSB
II
7
C –
Set if a carry is generated; otherwise, reset.
Z –
Set if the result is zero; otherwise, reset.
D –
Not affected
I –
Not affected
Adds immediate data i to the contents of the r-register.
ADD A,5ADD MY,2
A register101011111111
Memory (MY)011001101000
C flag100
Z flag000
ADD r,qAdd q-register to r-register
Source Format:
Operation:
OP-Code:
Type:
Clock Cycles:
Flag:
Description:
Example:
ADD r,q
r ← r + q
10101000r1 r0 q1 q0A80H to A8FH
MSBLSB
IV
7
C –
Set if a carry is generated; otherwise, reset.
Z –
Set if the result is zero; otherwise, reset.
D –
Not affected
I –
Not affected
Adds the contents of the q-register to the contents of the r-register.
ADD A,MYADD MX,B
A register001011111111
B register010001000100
Memory (MX)011101111011
Memory (MY)110111011101
C flag100
Z flag100
32EPSONS1C6200/6200A CORE CPU MANUAL
AND r,iLogical AND immediate data i with r-register
3 INSTRUCTION SET
Source Format:
Operation:
OP-Code:
Type:
Clock Cycles:
Flag:
Description:
Example:
AND r,i
r ← r ∧ i
3 to i0
110010r1 r0 i3 i2 i1 i0C80H to CBFH
MSBLSB
II
7
C –
Not affected
Z –
Set if the result is zero; otherwise, reset.
D –
Not affected
I –
Not affected
Performs a logical AND operation between immediate data i and the contents of
the r-register. The result is stored in the r-register.
AND A,5AND MX,3
A register011001000100
Memory (MX)100010000000
C flag111
Z flag001
AND r,qLogical AND q-register with r-register
Source Format:
Operation:
OP-Code:
Type:
Clock Cycles:
Flag:
Description:
Example:
AND r,q
r ← r ∧ q
10101100r1 r0 q1 q0AC0H to ACFH
MSBLSB
IV
7
C –
Not affected
Z –
Set if the result is zero; otherwise, reset.
D –
Not affected
I –
Not affected
Performs a logical AND operation between the contents of the q-register and the
contents of the r-register. The result is stored in the r-register.
AND MX,AAND B,MY
A register010001000100
B register101110110010
Memory (MX)101000000000
Memory (MY)001000100010
C flag000
Z flag010
Pushes the program counter (PCP, PCS) onto the stack as the return address,
then calls the subroutine addressed by the 8-bit operand. As NPP is reset to 0H,
only a subroutine in page 0 can be called.
Compares immediate data i to the r-register by subtracting i from the contents of r.
The r-register remains unchanged.
1. When Z = 0 and C = 0 then i < r
2. When Z = 1 and C = 0 then i = r
3. When Z = 0 and C = 1 then i > r
CP A,4CP MX,7CP B,2
A register0100010001000100
B register1010101010101010
Memory (MX)0010001000100010
C flag1010
Z flag0100
CP r,qCompare q-register with r-register
Source Format:
Source Format:
Operation:
Operation:
OP-Code:
OP-Code:
Type:
Type:
Clock Cycles:
Clock Cycles:
Flag:
Flag:
Description:
Description:
Example:
Example:
CP r,q
r - q
11110000r1 r0 q1 q0F00H to F0FH
MSBLSB
IV
7
C –
Set if r < q; otherwise, reset.
Z –
Set if r = q; otherwise, reset.
D –
Not affected
I –
Not affected
Compares the q-register to the r-register by subtracting the contents of q from the
contents of r. The registers remain unchanged.
1. When Z = 0 and C = 0 then q < r
2. When Z = 1 and C = 0 then q = r
3. When Z = 0 and C = 1 then q > r
CP A,BCP MY,A
A register100010001000
B register010001000100
Memory (MY)011101110111
C flag001
Z flag000
S1C6200/6200A CORE CPU MANUALEPSON35
3 INSTRUCTION SET
CP XH,iCompare immediate data i with XH
Source Format:
Source Format:
Operation:
Operation:
OP-Code:
OP-Code:
Type:
Type:
Clock Cycles:
Clock Cycles:
Flag:
Flag:
Description:
Description:
Example:
Example:
CP XH,i
XH - i
3 to i0
10100100i3 i2 i1 i0A40H to A4FH
MSBLSB
IV
7
C –
Set if XH < i3 to i0; otherwise, reset.
Z –
Set if XH = i
D –
Not affected
I –
Not affected
3 to i0; otherwise, reset.
Compares immediate data i to XH by subtracting i from the contents of XH. XH
remains unchanged.
1. When Z = 0 and C = 0 then i < XH
2. When Z = 1 and C = 0 then i = XH
3. When Z = 0 and C = 1 then i > XH
CP XH,2CP XH,4CP XH,9
XH register0100010001000100
C flag1001
Z flag0010
CP XL,iCompare immediate data i with XL
Source Format:
Source Format:
Operation:
Operation:
OP-Code:
OP-Code:
Type:
Type:
Clock Cycles:
Clock Cycles:
Flag:
Flag:
Description:
Description:
Example:
Example:
CP XL,i
XL - i
3 to i0
10100101i3 i2 i1 i0A50H to A5FH
MSBLSB
IV
7
C –
Set if XL < i3 to i0; otherwise, reset.
Z –
Set if XL = i
D –
Not affected
I –
Not affected
3 to i0; otherwise, reset.
Compares immediate data i to XL by subtracting i from the contents of XL. XL
remains unchanged.
1. When Z = 0 and C = 0 then i < XL
2. When Z = 1 and C = 0 then i = XL
3. When Z = 0 and C = 1 then i > XL
CP XL,7CP XL,9CP XL,0AH
XL register1001100110011001
C flag0001
Z flag0010
36EPSONS1C6200/6200A CORE CPU MANUAL
CP YH,iCompare immediate data i with YH
3 INSTRUCTION SET
Source Format:
Source Format:
Operation:
Operation:
OP-Code:
OP-Code:
Type:
Type:
Clock Cycles:
Clock Cycles:
Flag:
Flag:
Description:
Description:
Example:
Example:
CP YH,i
YH - i
3 to i0
10100110i3 i2 i1 i0A60H to A6FH
MSBLSB
IV
7
C –
Set if YH < i3 to i0; otherwise, reset.
Z –
Set if YH = i
D –
Not affected
I –
Not affected
3 to i0; otherwise, reset.
Compares immediate data i to YH by subtracting i from the contents of YH. YH
remains unchanged.
1. When Z = 0 and C = 0 then i < YH
2. When Z = 1 and C = 0 then i = YH
3. When Z = 0 and C = 1 then i > YH
CP YH,0AHCP YH,3CP YH,0FH
YH register1010101010101010
C flag1001
Z flag0100
CP YL,iCompare immediate data i with YL
Source Format:
Source Format:
Operation:
Operation:
OP-Code:
OP-Code:
Type:
Type:
Clock Cycles:
Clock Cycles:
Flag:
Flag:
Description:
Description:
Example:
Example:
CP YL,i
YL - i
3 to i0
10100111i3 i2 i1 i0A70H to A7FH
MSBLSB
IV
7
C –
Set if YL < i3 to i0; otherwise, reset.
Z –
Set if YL = i
D –
Not affected
I –
Not affected
3 to i0; otherwise, reset.
Compares immediate data i to YL by subtracting i from the contents of YL. YL
remains unchanged.
1. When Z = 0 and C = 0 then i < YL
2. When Z = 1 and C = 0 then i = YL
3. When Z = 0 and C = 1 then i > YL
CP YL,5CP YL,1CP YL,4
YL register0100010001000100
C flag0100
Z flag1001
S1C6200/6200A CORE CPU MANUALEPSON37
3 INSTRUCTION SET
DEC Mn
Source Format:
Operation:
OP-Code:
Clock Cycles:
Description:
Example:
Type:
Flag:
Decrement memory
DEC Mn
M(n
3 to n0) ← M(n3 to n0) - 1
11110111n
MSBLSB
IV
7
C –
Set if a borrow is generated; otherwise, reset.
Z –
Set if the result is zero; otherwise, reset.
D –
Not affected
I –
Not affected
Decrements the contents of the data memory location addressed by Mn by 1.
DEC M0DEC M2DEC M0FH
Memory (00H)1001100010001000
Memory (02H)0000000011111111
Memory (0FH)0001000100010000
C flag1010
Z flag0001
3 n2 n1 n0F70H to F7FH
DEC SPDecrement stack pointer
Source Format:
Operation:
OP-Code:
Type:
Clock Cycles:
Flag:
Description:
Example:
DEC SP
SP ← SP - 1
111111001011 FCBH
MSBLSB
VI
5
C –
Not affected
Z –
Not affected
D –
Not affected
I –
Not affected
Decrements the contents of the stack pointer by 1. This operation does not affect
the flags.
DEC SP
Memory (SP)1011 00011011 0000
C flag00
Z flag11
38EPSONS1C6200/6200A CORE CPU MANUAL
DIDisable interrupts
3 INSTRUCTION SET
Source Format:
Operation:
OP-Code:
Type:
Clock Cycles:
Flag:
Description:
Example:
DI
I ← 0
111101010111 F57H
MSBLSB
VI
7
C –
Not affected
Z –
Not affected
D –
Not affected
I –
Reset
Disables all interrupts.
DI
C flag00
Z flag11
D flag00
I flag10
EIEnable interrupts
Source Format:
Operation:
OP-Code:
Type:
Clock Cycles:
Flag:
Description:
Example:
EI
I ← 1
111101001000 F48H
MSBLSB
VI
7
C –
Not affected
Z –
Not affected
D –
Not affected
I –
Set
Enables all interrupts.
C flag11
Z flag00
D flag00
I flag01
EI
S1C6200/6200A CORE CPU MANUALEPSON39
3 INSTRUCTION SET
FAN r,iLogical AND immediate data i with r-register for flag check
Source Format:
Operation:
OP-Code:
Type:
Clock Cycles:
Flag:
Description:
Example:
FAN r,i
r ∧ i
3 to i0
110110r1 r0 i3 i2 i1 i0D80H to DBFH
MSBLSB
II
7
C –
Not affected
Z –
Set if the result is zero; otherwise, reset.
D –
Not affected
I –
Not affected
Performs a logical AND operation between immediate data i and the contents of
the r-register. Only the Z flag is affected. The r-register remains unchanged.
FAN A,7FAN MY,9FAN B,2
A register1000100010001000
B register0100010001000100
Memory (MY)1000100010001000
C flag1111
Z flag0101
FAN r,qLogical AND q-register with r-register for flag check
Source Format:
Operation:
OP-Code:
Type:
Clock Cycles:
Flag:
Description:
Example:
FAN r,q
r ∧ q
11110001r1 r0 q1 q0F10H to F1FH
MSBLSB
IV
7
C –
Not affected
Z –
Set if the result is zero; otherwise, reset.
D –
Not affected
I –
Not affected
Performs a logical AND operation between the contents of the q-register and the
contents of the r-register. Only the Z flag is affected. The registers remains
unchanged.
FAN A,BFAN MX,BFAN A,MY
A register1000100010001000
B register1010101010101010
Memory (MX)0101010101010101
Memory (MY)1110111011101110
C flag0000
Z flag0010
40EPSONS1C6200/6200A CORE CPU MANUAL
HALTHalt
3 INSTRUCTION SET
Source Format:
Operation:
OP-Code:
Type:
Clock Cycles:
Flag:
Description:
Example:
HALT
Stops CPU
111111111000 FF8H
MSBLSB
VI
5
C –
Not affected
Z –
Not affected
D –
Not affected
I –
Not affected
Stops the CPU. When an interrupt occurs, PCP and PCS are pushed onto the
stack as the return address and the interrupt service routine is executed.
InstructionStatePCPPCSI flag
HALTRUN00010011 00111
Interrupt00010011 01001
HALT
RUN0001Interrupt vector address0
INC MnIncrement memory by 1
Source Format:
Operation:
OP-Code:
Type:
Clock Cycles:
Flag:
Description:
Example:
INC Mn
M(n
3 to n0) ← M(n3 to n0) + 1
11110110n
MSBLSB
IV
7
C –
Set if a carry is generated; otherwise, reset.
Z –
Set if the result is zero; otherwise, reset.
D –
Not affected
I –
Not affected
The contents of the data memory location addressed by Mn is incremented by 1.
INC M1INC M3INC M0DH
Memory (01H)0100010101010101
Memory (03H)1111111100000000
Memory (0DH)0111011101111000
C flag0010
Z flag1010
3 n2 n1 n0F60H to F6FH
S1C6200/6200A CORE CPU MANUALEPSON41
3 INSTRUCTION SET
Increment stack pointer by 1INC SP
Source Format:
Operation:
OP-Code:
Type:
Clock Cycles:
Flag:
Description:
Example:
INC SP
SP ← SP + 1
111111011011 FDBH
MSBLSB
VI
5
C –
Not affected
Z –
Not affected
D –
Not affected
I –
Not affected
Increments the contents of the stack pointer by 1. This operation does not affect
the flags.
INC SP
SP1110 11111111 0000
C flag00
Z flag00
INC XIncrement X-register by 1
Source Format:
Operation:
OP-Code:
Type:
Clock Cycles:
Flag:
Description:
Example:
INC X
X ← X + 1
111011100000 EE0H
MSBLSB
VI
5
C –
Not affected
Z –
Not affected
D –
Not affected
I –
Not affected
Increments the contents of register X by 1. This operation does not affect the
flags.
INC X
X register1111 11101111 1111
C flag11
Z flag00
42EPSONS1C6200/6200A CORE CPU MANUAL
INC YIncrement Y-register by 1
3 INSTRUCTION SET
Source Format:
Operation:
OP-Code:
Type:
Clock Cycles:
Flag:
Description:
Example:
INC Y
Y ← Y + 1
111011110000 EF0H
MSBLSB
VI
5
C –
Not affected
Z –
Not affected
D –
Not affected
I –
Not affected
Increments the contents of register Y by 1. This operation does not affect the
flags.
INC Y
Y register1011 01111011 1000
C flag11
Z flag00
JPBAIndirect jump using registers A and B
Source Format:
Operation:
OP-Code:
Type:
Clock Cycles:
Flag:
Description:
Example:
JPBA
PCB ← NBP, PCP ← NPP, PCSH ← B, PCSL ← A
111111101000 FE8H
MSBLSB
VI
5
C –
Not affected
Z –
Not affected
D –
Not affected
I –
Not affected
Uses the contents of a- and b-registers to specify the destination address of the
jump. The b-register contains the four high-order bits of the address and the aregister contains the four low-order bits of the address.
PSET 15HJPBA
PCB001
NBP011
PCP100010000101
NPP000101010101
PCS1001 00001001 00010000 0110
A register011001100110
B register000000000000
S1C6200/6200A CORE CPU MANUALEPSON43
3 INSTRUCTION SET
JP C,sJump if carry flag is set
Source Format:
Operation:
OP-Code:
Type:
Clock Cycles:
Flag:
Description:
Example:
JP C,s
PCB ← NBP, PCP ← NPP, PCS ← s
0010s
MSBLSB
7 s6 s5 s4 s3 s2 s1 s0200H to 2FFH
7 to s0 if C = 1
I
5
C –
Not affected
Z –
Not affected
D –
Not affected
I –
Not affected
Jumps to the destination address specified by the 8-bit operand when the carry
flag is set.
ADD A,8PSET 06HJP C,10H
PCB0000
NBP0000
PCP0010001000100110
NPP0001000101100110
PCS0011 11000011 11010011 11100001 0000
A register1000000000000000
C flag0111
JP NC,sJump if not carry
Source Format:
Operation:
OP-Code:
Type:
Clock Cycles:
Flag:
Description:
Example:
JP NC,s
PCB ← NBP, PCP ← NPP, PCS ← s
0011s
MSBLSB
7 s6 s5 s4 s3 s2 s1 s0300H to 3FFH
I
5
C –
Not affected
Z –
Not affected
D –
Not affected
I –
Not affected
Jumps to the destination address specified by the 8-bit operand when the carry
flag is not set.
PSET 11HJP NC,10H
PCB001
NBP011
PCP100110010001
NPP000100010001
PCS1000 11111001 00000001 0000
C flag000
7 to s0 if C = 0
44EPSONS1C6200/6200A CORE CPU MANUAL
JP NZ,sJump if not zero
3 INSTRUCTION SET
Source Format:
Operation:
OP-Code:
Type:
Clock Cycles:
Flag:
Description:
Example:
JP NZ,s
PCB ← NBP, PCP ← NPP, PCS ← s
0111s
MSBLSB
7 s6 s5 s4 s3 s2 s1 s0700H to 7FFH
7 to s0 if Z = 0
I
5
C –
Not affected
Z –
Not affected
D –
Not affected
I –
Not affected
Jumps to the destination address specified by the 8-bit operand when the zero flag
is not set.
JP NZ,10H
PCB11
NBP11
PCP00000000
NPP00000000
PCS0000 01110001 0000
Z flag00
JP sJump
Source Format:
Operation:
OP-Code:
Type:
Clock Cycles:
Flag:
Description:
Example:
JP s
PCB ← NBP, PCP ← NPP, PCS ← s
0000s7 s6 s5 s4 s3 s2 s1 s0000H to 0FFH
MSBLSB
I
5
C –
Not affected
Z –
Not affected
D –
Not affected
I –
Not affected
Unconditional jump to the destination address specified by the 8-bit operand.
Jumps to the destination address specified by the 8-bit operand when the zero flag
is set.
SUB A,BPSET 1BHJP Z,10H
PCB0001
NBP0011
PCP0101010101011011
NPP0001000110111011
PCS0000 00100000 00110000 01000001 0000
A register0110000000000000
B register0110011001100110
Z flag0111
LBPX MX,eLoad immediate data e to memory, and increment X by 2
Source Format:
Operation:
OP-Code:
Type:
Clock Cycles:
Flag:
Description:
Example:
LBPX MX,e
M(X) ← e
1001e
MSBLSB
3 to e0, M(X+1) ← e7 to e4, X ← X + 2
7 e6 e5 e4 e3 e2 e1 e0900H to 9FFH
I
5
C –
Not affected
Z –
Not affected
D –
Not affected
I –
Not affected
Stores 8-bit immediate data e in two, consecutive 4-bit locations in data memory.
The X-register is incremented by 2. An overflow in X does not affect the flags.
Set when the high-order bit of the r-register is 1; otherwise, reset.
Z –
Not affected
D –
Not affected
I –
Not affected
Shifts the contents of the r-register one bit to the left. The high-order bit is shifted
into the carry flag and the carry bit becomes the low-order bit of the r-register.
r-register
C
C
d3 d2 d1 d0
C
d3
RLC A
A register00110111
C flag10
r-register
d
2 d1 d0
C
74EPSONS1C6200/6200A CORE CPU MANUAL
RRC rRotate r-register right with carry
3 INSTRUCTION SET
Source Format:
Source Format:
Operation:
Operation:
OP-Code:
OP-Code:
Type:
Type:
Clock Cycles:
Clock Cycles:
Flag:
Flag:
Description:
Description:
Example:
Example:
RRC r
d
3← C, d2← d3, d1← d2, d0← d1, C ← d0
11101000 1 1r1 r0E8CH to E8FH
MSBLSB
V
5
C –
Set when the low-order bit of the r-register is 1; otherwise, reset.
Z –
Not affected
D –
Not affected
I –
Not affected
Shifts the contents of the r-register one bit to the right. The low-order bit is shifted
into the carry flag and the carry bit becomes the high-order bit of the r-register.
r-registerCC
d3d2d1d
0
r-register
d
3d2d1
C
C
d
0
RRC MY
Memory (MY)10101101
C flag10
RST F,iReset flags using immediate data i
Source Format:
Operation:
OP-Code:
Type:
Clock Cycles:
Flag:
Description:
Example:
RST F,i
F ← F ∧ i
3 to i0
11110101 i3 i2 i1 i0F50H to F5FH
MSBLSB
IV
7
C –
Reset if i0 is zero; otherwise, not affected.
Z –
D –
I –
Reset if i
Reset if i
Reset if i
1 is zero; otherwise, not affected.
2 is zero; otherwise, not affected.
3 is zero; otherwise, not affected.
Performs a logical AND operation between immediate data i and the contents of
the flags. The result is stored in each respective flag.
RST F,2
Flags (I,D,Z,C)10100010
S1C6200/6200A CORE CPU MANUALEPSON75
3 INSTRUCTION SET
RZFReset zero flag
Source Format:
Operation:
OP-Code:
Type:
Clock Cycles:
Flag:
Description:
Example:
RZF
Z ← 0
11110101 1 101 F5DH
MSBLSB
VI
7
C –
Not affected
Z –
Reset
D –
Not affected
I –
Not affected
Resets the Z (zero) flag.
ADD A,3RZF
Z flag010
A register110100000000
SBC r,iSubtract with carry immediate data i from r-register
Source Format:
Operation:
OP-Code:
Type:
Clock Cycles:
Flag:
Description:
Example:
SBC r,i
r ← r - i
3 to i0 - C
110101r
MSBLSB
1 r0 i3 i2 i1 i0D40H to D7FH
II
7
C –
Set if a borrow is generated; otherwise, reset.
Z –
Set if the result is zero; otherwise, reset.
D –
Not affected
I –
Not affected
Subtracts the carry flag and immediate data i from the r-register.
SBC A,9SBC MY,0DH
A register100011111111
Memory (MY)111011100000
C flag010
Z flag001
76EPSONS1C6200/6200A CORE CPU MANUAL
SBC r,qSubtract with carry q-register from r-register
3 INSTRUCTION SET
Source Format:
Operation:
OP-Code:
Type:
Clock Cycles:
Flag:
Description:
Example:
SBC r,q
r ← r - q - C
10101011 r1 r0 q1 q0AB0H to ABFH
MSBLSB
IV
7
C –
Set if a borrow is generated; otherwise, reset.
Z –
Set if the result is zero; otherwise, reset.
D –
Not affected
I –
Not affected
Subtracts the carry flag and the contents of the q-register from the r-register.
SBC A,BSBC MY,MX
A register111010111011
B register001000100010
Memory (MX)100110011001
Memory (MY)010001001011
C flag101
Z flag000
SCFSet carry flag
Source Format:
Operation:
OP-Code:
Type:
Clock Cycles:
Flag:
Description:
Example:
SCF
C ← 1
11110100 0 001 F41H
MSBLSB
VI
7
C –
Set
Z –
Not affected
D –
Not affected
I –
Not affected
Sets the C (carry) flag.
C flag01
SCF
S1C6200/6200A CORE CPU MANUALEPSON77
3 INSTRUCTION SET
SCPX MX,rSubtract with carry r-register from M(X) and increment X by 1
Source Format:
Operation:
OP-Code:
Type:
Clock Cycles:
Flag:
Description:
Example:
SCPX MX,r
M(X) ← M(X) - r - C, X ← X + 1
11110011 1 0r1 r0F38H to F3BH
MSBLSB
V
7
C –
Set if a borrow is generated; otherwise, reset.
Z –
Set if the result is zero; otherwise, reset.
D –
Not affected
I –
Not affected
Subtracts the carry flag and the contents of the r-register from the data memory
location addressed by IX. X is incremented by 1. Incrementing X does not affect
the flags.
SCPX MX,B
X register0101 00000101 0001
Memory (50H)01100100
B register00100010
C flag00
Z flag00
SCPY MY,rSubtract with carry r-register from M(Y) and increment Y by 1
Source Format:
Operation:
OP-Code:
Type:
Clock Cycles:
Flag:
Description:
Example:
SCPY MY,r
M(Y) ← M(Y) - r - C, Y ← Y + 1
11110011 1 1r1 r0F3CH to F3FH
MSBLSB
V
7
C –
Set if a borrow is generated; otherwise, reset.
Z –
Set if the result is zero; otherwise, reset.
D –
Not affected
I –
Not affected
Subtracts the carry flag and the contents of the r-register from the data memory
location addressed by IY. Y is incremented by 1. Incrementing Y does not affect
the flags.
SCPY MY,A
Y register1111 11110000 0000
Memory (FFH)01110100
A register00100010
C flag10
Z flag10
78EPSONS1C6200/6200A CORE CPU MANUAL
SDFSet decimal flag
3 INSTRUCTION SET
Source Format:
Operation:
OP-Code:
Type:
Clock Cycles:
Flag:
Description:
Example:
SDF
D ← 1
11110100 0 100 F44H
MSBLSB
VI
7
C –
Not affected
Z –
Not affected
D –
Set
I –
Not affected
Sets the D (decimal) flag.
SDF
D flag01
SET F,iSet flags using immediate data i
Source Format:
Operation:
OP-Code:
Type:
Clock Cycles:
Flag:
Description:
Example:
SET F,i
F ← F ∨ i
3 to i0
11110100 i3 i2 i1 i0F40H to F4FH
MSBLSB
IV
7
C –
Set if i0 is 1; otherwise, not affected.
Z –
Set if i
1 is 1; otherwise, not affected.
D –
Set if i
2 is 1; otherwise, not affected.
I –
Set if i
3 is 1; otherwise, not affected.
Performs a logical OR operation between immediate data i and the contents of the
flags. The results are stored in each respective flag.
SET F,0DH
Flags (C,Z,D,I)00111111
S1C6200/6200A CORE CPU MANUALEPSON79
3 INSTRUCTION SET
SLPSleep
Source Format:
Operation:
OP-Code:
Type:
Clock Cycles:
Flag:
Description:
Example:
SLP
Stop CPU and peripheral oscillator
11111111 1 001 FF9H
MSBLSB
VI
5
C –
Not affected
Z –
Not affected
D –
Not affected
I –
Not affected
Stops the CPU and the peripheral oscillator. When an interrupt occurs PCP and
PCS are pushed onto the stack as the return address and the interrupt service
routine is executed.
InstructionStatePCPPCSI flag
RUN0100 0011 00001
SLP0100 0011 00011
Interrupt →
NOP5RUN
SLEEP
0001 0000 00010
SUB r,qSubtract q-register from r-register
Source Format:
Operation:
OP-Code:
Type:
Clock Cycles:
Flag:
Description:
Example:
SUB r,q
r ← r - q
10101010 r1 r0 q1 q0AA0H to AAFH
MSBLSB
IV
7
C –
Set if a borrow is generated; otherwise, reset.
Z –
Set if the result is zero; otherwise, reset.
D –
Not affected
I –
Not affected
Subtracts the contents of the q-register from the r-register.
SUB A,B
A register11001001
B register00110011
C flag10
Z flag00
80EPSONS1C6200/6200A CORE CPU MANUAL
SZFSet zero flag
3 INSTRUCTION SET
Source Format:
Operation:
OP-Code:
Type:
Clock Cycles:
Flag:
Description:
Example:
SZF
Z ← 1
11110100 0 010 F42H
MSBLSB
VI
7
C –
Not affected
Z –
Set
D –
Not affected
I –
Not affected
Sets the Z (zero) flag.
SZF
Z flag01
XOR r,iExclusive-OR immediate data i with r-register
Source Format:
Operation:
OP-Code:
Type:
Clock Cycles:
Flag:
Description:
Example:
XOR r,i
r ← r ∀ i
3 to i0
110100r1 r0 i3 i2 i1 i0D00H to D3FH
MSBLSB
II
7
C –
Not affected
Z –
Set if the result is zero; otherwise, reset.
D –
Not affected
I –
Not affected
Performs an exclusive-OR operation between immediate data i and the contents
of the r-register. The result is stored in the r-register.
XOR A,12XOR MX,1
A register011010101010
Memory (MX)000100010000
Z flag001
S1C6200/6200A CORE CPU MANUALEPSON81
3 INSTRUCTION SET
XOR r,qExclusive-OR q-register with r-register
Source Format:
Operation:
OP-Code:
Type:
Clock Cycles:
Flag:
Description:
Example:
XOR r,q
r ← r ∀ q
1010111 0 r1 r0 q1 q0AE0H to AEFH
MSBLSB
IV
7
C –
Not affected
Z –
Set if the result is zero; otherwise, reset.
D –
Not affected
I –
Not affected
Performs an exclusive-OR operation between the contents of the q-register and
the contents of the r-register. The result is stored in the r-register.
XOR A,MYXOR MX,B
A register010011001100
B register111111111111
Memory (MX)011101111000
Memory (MY)100010001000
Z flag000
Source Format:
Operation:
OP-Code:
Type:
Clock Cycles:
Flag:
Description:
Example:
MSBLSB
C–
Z–
D–
I–
82EPSONS1C6200/6200A CORE CPU MANUAL
3 INSTRUCTION SET
ABBREVIATIONS
Source Format:
A............. A register (4 bits)
B............. B register (4 bits)
M(SP) ..... Contents of the data memory location whose address is specified by stack pointer SP (4 bits)
M(X) ....... Contents of the data memory location whose address is specified by IX (4 bits)
M(Y) ....... Contents of the data memory location whose address is specified by IY (4 bits)
M(n
MX.......... Data memory location whose address is specified by IX
MY.......... Data memory location whose address is specified by IY
NBP........ New Bank Pointer (1 bit)
NPP........ New Page Pointer (4 bits)
PCB........ Program Counter-Bank (1 bit)
PCP........ Program Counter-Page (4 bits)
PCS........ Program Counter-Step (8 bits)
PCSH ..... Four high-order bits of PCS
PCSL...... Four low-order bits of PCS
RP .......... Register Pointer (4 bits)
SP .......... Stack Pointer (8 bits)
SPH........ Four high-order bits of SP
SPL ........ Four low-order bits of SP
X............. Eight low-order bits of IX, that is, XHL
XH .......... Four high-order bits of X
XL........... Four low-order bits of X
XP .......... Four high-order bits of IX (page part)
Y............. Eight low-order bits of IY, that is, YHL
YH .......... Four high-order bits of Y
YL........... Four low-order bits of Y
YP .......... Four high-order bits of IY (page part)
+ ............. Addition
– ............. Subtraction
∧............... Logical AND
∨ ............. Logical OR
∀............. Exclusive-OR
↓ ............. Reset flag
↑ ............. Set flag
↕ ............. Set/reset flag
∗ ............. Decimal addition/subtraction
Operation:
OP-Code:
MSBLSB
3-0).... Contents of the data memory location within the register area 00H to 0FH (4 bits)
Type:
Clock Cycles:
Flag:
C–
Z–
D–
I–
Description:
Example:
Source Format:
Operation:
OP-Code:
MSBLSB
Type:
Clock Cycles:
Flag:
C–
Z–
D–
I–
Description:
Example:
S1C6200/6200A CORE CPU MANUALEPSON83
APPENDIX A. S1C6200A (ADVANCED S1C6200) CORE CPU
APPENDIX A. S1C6200A (ADVANCED S1C6200) CORE CPU
S1C6200A is an improved version of the S1C6200. In this section, S1C6200A is described only in
terms of its differences with S1C6200. It is recommended that users of S1C6200A read this section.
S1C6200A is a Core CPU which has been made easier to integrate software by improving the parts of the
S1C6200 CPU which are difficult to use.
This section lists its differences with S1C6200; for items which are not included here, refer to the corresponding section in this manual.
A1Outline of Differences
• The D (decimal) flag is set to "0" during initial reset.
• Modifications of the interrupt circuit
- The interrupt timing has been shifted to 0.5 clock later.
- <Reference> In the 1-chip micro controller which uses S1C6200A, writing on the interrupt mask register
and reading the interrupt factor flag during EI (enable interrupt flag) are possible. (However, consult
the respective hardware manuals to find out whether these are possible with the CPU peripheral
circuits.)
A2Detailed Description of the Differences
A2.1 Initial reset
The D (decimal) flag will be set as follows through initial reset:
Table A2.1.1 D (decimal) flag initial setting
CPU Core
D (decimal) flag setting
S1C6200A
0
S1C6200
Undefined
Owing to this, bugs due to omission of D (decimal) flag setting during software development can now be
easily prevented.
For the values of other registers and flags during initial reset, see Section 2.5.4, "Initial reset".
A2.2 Interrupt
Operation during interrupt issuance
The time it takes to complete interrupt processing by hardware after the Core CPU receives the interrupt
request has changed as follows:
Table A2.2.1 Required interrupt processing time
Item
a) During instruction execution
b) At HALT mode
c) During PSET instruction execution
Figure A2.2.1 shows the timing chart of the S1C6200A interrupt.
S1C6200A
(clock cycles)
12.5 to 24.5
12.5 to 19.5
12.5 to 17.5
14 to 15
12.5 to 24.5
12.5 to 22.5
S1C6200
(clock cycles)
13 to 25
13 to 20
13 to 18
14 to 15
13 to 25
13 to 23
84EPSONS1C6200/6200A CORE CPU MANUAL
Clock
Status
APPENDIX A. S1C6200A (ADVANCED S1C6200) CORE CPU
Instruction
System clock
CPU clock
Status
Instruction
5-clock Instrruction
Status:
5-clock Instrruction
Status:
Fetch
Fetch
12-clock Instrruction
Interrupt
Interrupt processing:
ExecuteNote:(*1)
12-clock instruction
7-clock instruction
5-clock instruction
(*2)
a) During instruction execution
HALT
ExecuteNote:(*1)
(*2)
INT1 (*1)INT2 (*1)JP (*2)
... 12.5 to 24.5 clock cycles
... 12.5 to 19.5 clock cycles
... 12.5 to 17.5 clock cycles
INT1 and INT2 are dummy instructions
Branches to the top of the interrupt service routine
INT1 (*1)INT2 (*1)JP (*2)
Interrupt
Interrupt processing: 14 to 15 clock cycles
INT1 and INT2 are dummy instructions
Branches to the top of the interrupt service routine
Clock
Status
Instruction
Status:
PSET
Fetch
b) At HALT mode
CALL
Interrupt
Interrupt processing:
ExecuteNote:(*1)
INT1 (*1)INT2 (*1)JP (*2)
PSET + CALL
PSET + JP
... 12.5 to 24.5 clock cycles
... 12.5 to 22.5 clock cycles
INT1 and INT2 are dummy instructions
(*2)
Branches to the top of the interrupt service routine
c) During "PSET" instruction execution
Fig. A2.2.1 Timing chart of S1C6200A interrupt
S1C6200/6200A CORE CPU MANUALEPSON85
APPENDIX A. S1C6200A (ADVANCED S1C6200) CORE CPU
<Reference 1> Writing on the interrupt mask register during EI
This section describes the operation for writing on the interrupt mask register during EI (enable interrupt
flag) in the regular 1-chip micro controller which uses S1C6200 Core CPU and in the regular 1-chip micro
controller which uses S1C6200A Core CPU. For information on accurate operation, see the respective
hardware manuals of the S1C62 Family.
Table A2.2.2 Writing on the interrupt mask register at EI
CPU Core
Writing on the interrupt mask register at EI
S1C6200A
Possible
The operation during the instruction execution for writing "0" (i.e., to mask the interrupt factor) on the
interrupt mask register at EI is shown in Figure A2.2.2. At this point, the interrupt is masked 0.5 clock
before the start of the instruction execution through the 0.5 clock advance operation.
Moreover, during the instruction execution for writing "1" (i.e., to cancel the interrupt mask) on the mask
register at EI, it is the same as the ordinary interrupt timing as shown in Figure A2.2.2. In other words, if
the interrupt factor flag value is set to "1", the interrupt processing by hardware will start in the next
instruction execution cycle 0.5 clock before the completion of the instruction execution.
Clock
S1C6200
Not possible
Status
Instruction
Corresponding
interrupt factor flag
Interrupt request
FetchExecuteFetchExecuteFetchExecuteFetch
"0" is written to the interrupt mask register
Execute next instructionINT1(interrupt processing)
"1" is written to the interrupt mask register
Fig. A2.2.2 Writing on the interrupt mask register and interrupt request generation
<Reference 2> Reading the interrupt factor flag during EI
This section describes the operation for reading the interrupt factor flag during EI (enable interrupt flag) in
the regular 1-chip micro controller which uses S1C6200 Core CPU and in the regular 1-chip micro controller which uses S1C6200A Core CPU. For information on accurate operation, see the respective hardware
manuals of the S1C62 Family.
Table A2.2.3 Reading the interrupt factor flag at EI
CPU Core
Reading the interrupt factor flag at EI
S1C6200A
Possible
At EI, reading the interrupt factor flag is possible but caution must be observed in the following case: when
the value of the interrupt mask register corresponding to the interrupt factor flag which is to be read is set
to "1" (unmasked). In this case, interrupt request may be issued to the CPU due to the timing by which the
interrupt factor flag is set to "1", or the interrupt factor flag may be cleared by reading it and hence interrupt request will not be issued.
Particularly when there are multiple interrupt factor flags in the same address, extra caution is required.
S1C6200
Not possible
86EPSONS1C6200/6200A CORE CPU MANUAL
APPENDIX B.INSTRUCTION INDEX
ACPX MX,r Add with carry r-register to M(X), increment X by 1 ...........................28
A
ACPY MY,r Add with carry r-register to M(Y), increment Y by 1 ........................... 28
ADC r,iAdd with carry immediate data i to r-register...................................... 29
ADC r,qAdd with carry q-register to r-register.................................................29
ADC XH,iAdd with carry immediate data i to XH................................................30
ADC XL,iAdd with carry immediate data i to XL ................................................30
ADC YH,iAdd with carry immediate data i to YH ................................................ 31
ADC YL,iAdd with carry immediate data i to YL ................................................ 31
ADD r,iAdd immediate data i to r-register .......................................................32
ADD r,qAdd q-register to r-register ..................................................................32
AND r,iLogical AND immediate data i with r-register..................................... 33
AND r,qLogical AND q-register with r-register ................................................33