ETC W65C02S8P-14

The Western Design Center, Inc.
February 2004
W65C02S Data Sheet
W65C02S
Microprocessor
DATA SHEET
WDC
 The Western Design Center, Inc., 2003. All rights reserved
The Western Design Center, Inc.
February 2004
W65C02S Data Sheet
WDC reserves the right to make changes at any time without notice in order to improve design and supply the best possible
product. Information contained herein is provided gratuitously and without liability, to any user. Reasonable efforts have been
made to verify the accuracy of the information but no guarantee whatsoever is given as to the accuracy or as to its applicability to
particular uses. In every instance, it must be the responsibility of the user to determine the suitability of the products for each
application. WDC products are not authorized for use as critical components in life support devices or systems. Nothing
contained herein shall be construed as a recommendation to use any product in violation of existing patents or other rights of
third parties. The sale of any WDC product is subject to all WDC Terms and Conditions of Sales and Sales Policies, copies of
which are available upon request.
Copyright 1981-2004 by The Western Design Center, Inc. All rights reserved, including the right of reproduction, in whole, or
in part, in any form.
The Western Design Center, Inc.
W65C02S Data Sheet
2
The Western Design Center, Inc.
W65C02S Data Sheet
TABLE OF CONTENTS
1
INTRODUCTION................................................................................................................................................................................5
1.1
2
FUNCTIONAL DESCRIPTION......................................................................................................................................................6
2.1
2.2
2.3
2.4
2.5
2.6
2.7
2.8
3
INSTRUCTION REGISTER (IR) AND D ECODE ........................................................................................................................... 6
TIMING CONTROL UNIT (TCU) ................................................................................................................................................. 6
ARITHMETIC AND LOGIC UNIT (ALU) ..................................................................................................................................... 6
ACCUMULATOR REGISTER (A)................................................................................................................................................... 6
INDEX R EGISTERS (X AND Y)...................................................................................................................................................... 6
PROCESSOR S TATUS REGISTER (P) ........................................................................................................................................... 6
PROGRAM COUNTER R EGISTER (PC)....................................................................................................................................... 6
S TACK POINTER R EGISTER (S) .................................................................................................................................................. 7
PIN FUNCTION DESCRIP TION ...................................................................................................................................................9
3.1
3.2
3.3
3.4
3.5
3.6
3.7
3.8
3.9
3.10
3.11
3.12
3.13
3.14
3.15
4
FEATURES OF THE W65C02S ..................................................................................................................................................... 5
ADDRESS BUS (A0-A15)............................................................................................................................................................... 9
BUS ENABLE (BE).......................................................................................................................................................................... 9
DATA BUS (D0-D7)........................................................................................................................................................................ 9
INTERRUPT R EQUEST (IRQB).................................................................................................................................................... 9
MEMORY LOCK (MLB) ............................................................................................................................................................... 9
NO N-MASKABLE INTERRUPT (NMIB)...................................................................................................................................... 9
NO CONNECT (NC) ..................................................................................................................................................................... 10
PHASE 2 IN (PHI2), PHASE 2 OUT (PHI2O) AND PHASE 1 OUT (PHI1O) ...................................................................... 10
R EAD/WRITE (RWB) ................................................................................................................................................................. 10
R EADY (RDY) .............................................................................................................................................................................. 10
R ESET (RESB) ............................................................................................................................................................................. 11
S ET OVERFLOW (SOB).............................................................................................................................................................. 11
SYNCHRONIZE WITH OPCODE FETCH (SYNC)................................................................................................................... 11
POWER (VDD) AND GROUND (VSS)........................................................................................................................................ 11
V ECTOR PULL (VPB) ................................................................................................................................................................. 11
ADDRESSING MODES ...................................................................................................................................................................16
4.1
4.2
4.3
4.4
4.5
4.6
4.7
4.8
4.9
4.10
4.11
4.12
4.13
4.14
4.15
4.16
ABSOLUTE A.................................................................................................................................................................................. 16
ABSOLUTE INDEXED INDIRECT (A, X) ...................................................................................................................................... 16
ABSOLUTE INDEXED WITH X A,X ............................................................................................................................................. 16
ABSOLUTE INDEXED WITH Y A, Y ............................................................................................................................................ 17
ABSOLUTE INDIRECT (A)............................................................................................................................................................ 17
ACCUMULATOR A ....................................................................................................................................................................... 17
IMMEDIATE ADDRESSING #....................................................................................................................................................... 17
IMPLIED I....................................................................................................................................................................................... 17
PROGRAM COUNTER R ELATIVE R ........................................................................................................................................... 18
S TACK S ......................................................................................................................................................................................... 18
ZERO PAGE ZP.............................................................................................................................................................................. 18
ZERO PAGE INDEXED INDIRECT (ZP , X) .................................................................................................................................. 18
ZERO PAGE INDEXED WITH X ZP ,X ......................................................................................................................................... 19
ZERO PAGE INDEXED WITH Y ZP , Y ........................................................................................................................................ 19
ZERO PAGE INDIRECT (ZP )........................................................................................................................................................ 19
ZERO PAGE INDIRECT INDEXED WITH Y (ZP ), Y .................................................................................................................. 19
5
OPERATION TABLES ....................................................................................................................................................................21
6
DC, AC AND TIMING CHARACTERISTICS .........................................................................................................................23
The Western Design Center, Inc.
W65C02S Data Sheet
3
The Western Design Center, Inc.
W65C02S Data Sheet
6.1
6.2
DC CHARACTERISTICS TA = -40°C TO +85°C (PLCC, QFP) TA= 0°C TO 70°C (DIP) .......................................... 24
AC CHARACTERISTICS TA = -40°C TO +85°C (PLCC, QFP) TA= 0°C TO 70°C (DIP) .......................................... 25
7
CAVEATS ............................................................................................................................................................................................36
8
W65C02DB DEVELOPER BOARD AND .................................................................................................................................37
IN-CIRCUIT EMULATOR (ICE)..........................................................................................................................................................37
8.1
8.2
8.3
8.4
9
FEATURES :.................................................................................................................................................................................... 38
MEMORY MAP :............................................................................................................................................................................. 38
CROSS -DEBUGGING MONITOR PROGRAM............................................................................................................................. 38
BUILDING................................................................................................................................................................................... 38
HARD CORE MODEL .....................................................................................................................................................................39
9.1
10
10.1
FEATURES OF THE W65C02S HARD CORE M ODEL ................................................................................................................. 39
SOFT CORE RTL MODEL ........................................................................................................................................................39
W65C02 SYNTHESIZABLE RTL-CODE IN VERILOG HDL................................................................................................. 39
TABLE OF TABLES
TABLE 3 -1
TABLE 3 -2
TABLE 4 -1
TABLE 5 -1
TABLE 5 -2
TABLE 6 -1
TABLE 6 -2
TABLE 6 -3
TABLE 6 -4
TABLE 6 -5
TABLE 7 -1
VECTOR LOCATIONS....................................................................................................................................................12
PIN FUNCTION TABLE..................................................................................................................................................12
ADDRESSING MODE TABLE ......................................................................................................................................20
INSTRUCTION SET TABLE .........................................................................................................................................21
W65C02S OPCODE MATRIX ........................................................................................................................................22
ABSOLUTE MAXIMUM RATINGS ............................................................................................................................23
DC CHARACTERISTICS................................................................................................................................................24
AC CHARACTERISTICS ..............................................................................................................................................25
OPERATION, OPERATION CODES AND STATUS REGISTER.....................................................................28
INSTRUCTION TIMING CHART ...............................................................................................................................32
MICROPROCESSOR OPERATIONAL ENHANCEMENTS ..............................................................................36
TABLE OF FIGURES
FIGURE 2-1
FIGURE 2-2
FIGURE 3-1
FIGURE 3-2
FIGURE 3-3
FIGURE 6-1
FIGURE 6-2
FIGURE 6-3
W65C02S INTERNAL ARCHITECTURE SIMPLIFIED BLOCK DIAGRAM.............................................7
W65C02S MICROPROCESSOR PROGRAMMING MODEL ............................................................................8
W65C02S 40 PIN PDIP PINOUT .................................................................................................................................13
W65C02S 44 PIN PLCC PINOUT ...............................................................................................................................14
W65C02S 44 PIN QFP PINOUT ..................................................................................................................................15
IDD VS VDD .....................................................................................................................................................................24
F MAX VS VDD...............................................................................................................................................................24
GENERAL TIMING DIAGRAM ................................................................................................................................26
The Western Design Center, Inc.
W65C02S Data Sheet
4
The Western Design Center, Inc.
W65C02S Data Sheet
1 INTRODUCTION
The W65C02S is a low power cost sensitive 8-bit microprocessor. The W65C02S is a fully static core and the PHI2 clock
can be stopped when it is in the high (logic 1) or low (logic 0) state. The variable length instruction set and manually
optimized core size makes the W65C02S an excellent choice for low power System-on-Chip (SoC) designs. The Verilog
RTL model is available for ASIC design flows. WDC, a Fabless Semiconductor Company, provides packaged chips for
evaluation or volume production. To aid in system development, WDC provides a Development System that includes a
W65C02DB Developer Board, an In-Circuit Emulator (ICE) and the W65cSDS Software Development System, see
www.westerndesigncenter.com for more information.
1.1
Features of the W65C02S
•
8-bit data bus
•
16-bit address bus provides access to 65,536 bytes of memory space
•
8-bit ALU, Accumulator, Stack Pointer, Index Registers, Processor Status Register
•
16-bit Program Counter
•
69 instructions
•
16 addressing modes
•
212 Operation Codes (OpCodes)
•
Vector Pull (VPB) output indicates when interrupt vectors are being addressed
•
WAit-for-Interrupt (WAI) and SToP (STP) instructions reduce power consumption, decrease interrupt latency and
provide synchronization with external events
•
Variable length instruction set provides for lower power and smaller code optimization over fixed length instruction
set processors
•
Fully static circuitry
•
Wide operating voltage range, 1.8+/- 5%, 2.5+/- 5%, 3.0+/- 5%, 3.3+/ - 10%, 5.0+/- 5% specified
•
Low Power consumption, 150uA@1MHz
The Western Design Center, Inc.
W65C02S Data Sheet
5
The Western Design Center, Inc.
W65C02S Data Sheet
2 FUNCTIONAL DESCRIPTION
The internal organization of the W65C02S is divided into two parts: 1) Register Section and 2) Control Section.
Instructions obtained from program memory are executed by implementing a series of data transfers within the
Register Section. Signals that cause data transfers are generated within the Control Section.
2.1
Instruction Register (IR) and Decode
The Operation Code (OpCode) portion of the instruction is loaded into the Instruction Register from the Data Bus
and is latched during the OpCode fetch cycle. The OpCode is then decoded, along with timing and interrupt signals,
to generate various control signals for program execution.
2.2
Timing Control Unit (TCU)
The Timing Control Unit (TCU) provides timing for each instruction cycle that is executed. The TCU is set to zero for each
instruction fetch, and is advanced at the beginning of each cycle for as many cycles as is required to complete the instruction.
Data transfers between registers depend upon decoding the contents of both the IR and the TCU.
2.3
Arithmetic and Logic Unit (ALU)
All arithmetic and logic operations take place within the ALU. In addition to data operations, the ALU also
calculates the effective address for relative and indexed addressing modes. The result of a data operation is stored in
either memory or an internal register. Carry, Negative, Overflow and Zero flags are updated following the ALU data
operation.
2.4
Accumulator Register (A)
The Accumulator Register (A) is an 8-bit general purpose register which holds one of the operands and the result of
arithmetic and logical operations. Reconfigured versions of this processor family could have additional
accumulators.
2.5
Index Registers (X and Y)
There are two 8-bit Index Registers (X and Y) which may be used as general purpose registers or to provide an index
value for calculation of the effective address. When executing an instruction with indexed addressing, the
microprocessor fetches the OpCode and the base address, and then modifies the address by adding the Index
Register contents to the address prior to performing the desired operation.
2.6
Processor Status Register (P)
The 8-bit Processor Status Register (P) contains status flags and mode select bits. The Carry (C), Negative (N),
Overflow (V) and Zero (Z) status flags serve to report the status of ALU operations. These status flags are tested
with Conditional Branch instructions. The Decimal (D) and IRQB disable (I) are used as mode select flags. These
flags are set by the program to change microprocessor operations. Bit 5 is available for a user status or mode bit.
2.7
Program Counter Register (PC)
The Western Design Center, Inc.
W65C02S Data Sheet
6
The Western Design Center, Inc.
W65C02S Data Sheet
The 16-bit Program Counter Register (PC) provides the addresses which are used to step the microprocessor through
sequential program instructions. This register is incremented each time an instruction or operand is fetched from
program memory.
2.8
Stack Pointer Register (S)
D0-D7
INDEX Y
(8 BITS)
STACK POINTER
(S) (8 BITS)
ALU
(8 BITS)
ACCUMULATOR
(A) ( 8BITS)
PROG. COUNTER
(PC) (16 BITS)
PROCESSOR
STATUS
(P) 8 BITS
INTERNAL DATA BUS (8 BITS)
INTERNAL ADDRESS BUS (16 BITS)
IRQB
NMIB
RESB
INTERRUPT
LOGIC
INDEX X
(8 BITS)
DATA BUS BUFFER
BE
A0-A15
ADDRESS BUFFER
The Stack Pointer Register (S) is an 8-bit register which is used to indicate the next available location in the stack
memory area. It serves as the effective address in stack addressing modes as well as subroutine and interrupt
processing.
TIMING
CONTROL
PHI2
INSTRUCTION
DECODE
BE
RWB
BE
SYSTEM
CONTROL
RDY
VPB
DATA
LATCH
SYNC
INSTRUCTION REGISTER
(8 BITS)
Figure 2-1 W65C02S Internal Architecture Simplified Block Diagram
The Western Design Center, Inc.
W65C02S Data Sheet
7
The Western Design Center, Inc.
W65C02S Data Sheet
7
0
A
Accumulator A
7
0
Y
Index Register Y
7
0
X
0
PCH
PCL
8
V
1
B
D
S
I
Program Counter PC
0
7
1
N
Index Register X
7
15
Z
C
Stack Pointer S
Processor Status Register "P"
Carry 1 = true
Zero 1 = result
IRQB disable 1 = disable
Decimal mode 1= true
BRK command 1 = BRK, 0 = IRQB
Overflow 1 = true
Negative 1 = neg.
Figure 2-2 W65C02S Microprocessor Programming Model
The Western Design Center, Inc.
W65C02S Data Sheet
8
The Western Design Center, Inc.
W65C02S Data Sheet
3 PIN FUNCTION DESCRIPTION
3.1
Address Bus (A0-A15)
The sixteen bit Address Bus formed by A0-A15, address memory and I/O registers that exchange data on the Data
Bus. The address lines can be set to the high impedance state by the Bus Enable (BE) signal.
3.2
Bus Enable (BE)
The Bus Enable (BE) input signal provides external control of the Address, Data and the RWB buffers. When Bus
Enable is high, the Address, Data and RWB buffers are active. When BE is low, these buffers are set to the high
impedance status. Bus Enable is an asynchronous signal.
3.3
Data Bus (D0-D7)
The eight Data Bus lines D0-D7 are used to provide instructions, data and addresses to the microprocessor and
exchange data with memory and I/O registers. These lines may be set to the high impedance state by the Bus Enable
(BE) signal.
3.4
Interrupt Request (IRQB)
The Interrupt Request (IRQB) input signal is used to request that an interrupt sequence be initiated. The program
counter (PC) and Processor Status Register (P) are pushed onto the stack and the IRQB disable (I) flag is set to a “1”
disabling further interrupts before jumping to the interrupt handler. These values are used to return the processor to
its original state prior to the IRQB interrupt. The IRQB low level should be held until the interrupt handler clears
the interrupt request source. When Return from Interrupt (RTI) is executed the (I) flag is restored and a new
interrupt can be handled. If the (I) flag is cleared in an interrupt handler, nested interrupts can occur. The Wait-forInterrupt (WAI) instruction may be used to reduce power and synchronize with, as an example timer interrupt
requests.
3.5
Memory Lock (MLB)
The Memory Lock (MLB) output may be used to ensure the integrity of Read-Modify-Write instructions in a
multiprocessor system. Memory Lock indicates the need to defer arbitration of the bus cycle when MLB is low.
Memory Lock is low during the last three cycles of ASL, DEC, INC, LSR, ROL, ROR, TRB, and TSB memory
referencing instructions.
3.6
Non-Maskable Interrupt (NMIB)
A negative transition on the Non-Maskable Interrupt (NMIB) input initiates an interrupt sequence after the current
instruction is completed. Since NMIB is an edge-sensitive input, an interrupt will occur if there is a negative
transition while servicing a previous interrupt. Also, after the edge interrupt occurs no further interrupts will occur if
NMIB remains low. The NMIB signal going low causes the Program Counter (PC) and Processor Status Register
information to be pushed onto the stack before jumping to the interrupt handler. These values are used to return the
processor to it's original state prior to the NMIB interrupt.
The Western Design Center, Inc.
W65C02S Data Sheet
9
The Western Design Center, Inc.
W65C02S Data Sheet
3.7
No Connect (NC)
The No Connect (NC) pins are not connected internally and should not be connected externally.
3.8
Phase 2 In (PHI2), Phase 2 Out (PHI2O) and Phase 1 Out (PHI1O)
Phase 2 In (PHI2) is the system clock input to the microprocessor internal clock. During the low power Standby
Mode, PHI2 can be held in either high or low state to preserve the contents of internal registers since the
microprocessor is a fully static design. The Phase 2 Out (PHI2O) signal is generated from PHI2. Phase 1 Out
(PHI1O) is the inverted PHI2 signal. An external oscillator is recommended for driving PHI2 and used for the main
system clock. All production test timing is based on PHI2. PHI2O and PHI1O were used in older systems for
system timing and internal oscillators when an external crystal was used.
3.9
Read/Write (RWB)
The Read/Write (RWB) output signal is used to control data transfer. When in the high state, the microprocessor is
reading data from memory or I/O. When in the low state, the Data Bus contains valid data to be written from the
microprocessor and stored at the addressed memory or I/O location. The RWB signal is set to the high impedance
state when Bus Enable (BE) is low.
3.10 Ready (RDY)
A low input logic level on the Ready (RDY) will halt the microprocessor in its current state. Returning RDY to the
high state allows the microprocessor to continue operation following the next PHI2 negative transition. This bidirectional signal allows the user to single -cycle the microprocessor on all cycles including write cycles. A negative
transition to the low state prior to the falling edge of PHI2 will halt the microprocessor with the output address lines
reflecting the current address being fetched. This assumes the processor setup time is met. This condition will
remain through a subsequent PHI2 in which the ready signal is low. This feature allows microprocessor interfacing
with low-speed memory as well as direct memory access (DMA). The WAI instruction pulls RDY low signaling the
WAit-for-Interrupt condition, thus RDY is a bi-directional pin. On the W65C02 hard core there is a WAIT output
signal that can be used in ASIC's thus removing the bi-directional signal and RDY becomes only the input. In such
a situation the WAI instruction will pull WAIT low and must be used external of the core to pull RDY low or the
processor will continue as if the WAI never happened. The microprocessor will be released when RDY is high and
a falling edge of PHI2 occurs. This again assumes the processor control setup time is met. The RDY pin has an
active pull-up, when outputting a low level, the pull-up is disabled. The RDY pin can still be wire ORed.
The Western Design Center, Inc.
W65C02S Data Sheet
10
The Western Design Center, Inc.
W65C02S Data Sheet
3.11 Reset (RESB)
The Reset (RESB) input is used to initialize the microprocessor and start program execution. The RESB signal must
be held low for at least two clock cycles after VDD reaches operating voltage. Ready (RDY) has no effect while
RESB is being held low. All Registers are initialized by software except the Decimal and Interrupt disable mode
select bits of the Processor Status Register (P) are initialized by hardware. When a positive edge is detected, there
will be a reset sequence lasting seven clock cycles. The program counter is loaded with the reset vector from
locations FFFC (low byte) and FFFD (high byte). This is the start location for program control. RESB should be
held high after reset for normal operation.
Processor Status Register (P)
7
*
N
6
*
V
5
1
4
1
B
3
0
D
2
1
I
1
*
Z
0
*
C
*=software initialized
3.12 Set Overflow (SOB)
A negative transition on the Set Overflow (SOB) pin sets the overflow bit (V) in the status code register. The signal is
sampled on the rising edge of PHI2. SOB was originally intended for fast input recognition because it can be tested
with a branch instruction; however, it is not recommended in new system design and was seldom used in the past.
3.13 SYNChronize with OpCode fetch (SYNC)
The OpCode fetch cycle of the microprocessor instruction is indicated with SYNC high. The SYNC output is
provided to identify those cycles during which the microprocessor is fetching an OpCode. The SYNC line goes high
during the clock cycle of an OpCode fetch and stays high for the entire cycle. If the RDY line is pulled low during
the clock cycle in which SYNC went high, the processor will stop in its current state and will remain in the state
until the RDY line goes high. In this manner, the SYNC signal can be used to control RDY to cause single
instruction execution.
3.14 Power (VDD) and Ground (VSS)
VDD is the positive power supply voltage and VSS is system logic ground.
3.15 Vector Pull (VPB)
The Vector Pull (VPB) output indicates that a vector location is being addressed during an interrupt sequence. VPB
is low during the last interrupt sequence cycles, during which time the processor reads the interrupt vector. The
VPB signal may be used to select and prioritize interrupts from several sources by modifying the vector addresses.
The Western Design Center, Inc.
W65C02S Data Sheet
11
The Western Design Center, Inc.
W65C02S Data Sheet
Table 3-1 Vector Locations
FFFE, F
FFFC, D
FFFA, B
BRK/IRQB
RESB
NMIB
Software/Hardware
Hardware
Hardware
Table 3-2 Pin Function Table
Pin
Description
A0-A15
Address Bus
BE
Bus Enable
D0-D7
Data Bus
IRQB
Interrupt Request
MLB
Memory Lock
NC
No Connection
NMIB
Non-Maskable Interrupt
PHI1O
Phase 1 Out Clock
PHI2
Phase 2 In Clock
PHI2O
Phase 2 Out Clock
RDY
Ready
RESB
Reset
RWB
Read/Write
SOB
Set Overflow
SYNC
Synchronize
VDD
Positive Power Supply
VPB
Vector Pull
VSS
Internal Logic Ground
The Western Design Center, Inc.
W65C02S Data Sheet
12
The Western Design Center, Inc.
W65C02S Data Sheet
VPB
RDY
PHI1O
IRQB
MLB
NMIB
SYNC
VDD
A0
A1
A2
A3
A4
A5
A6
A7
A8
A9
A10
A11
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
40
39
38
37
36
35
34
33
32
31
30
29
28
27
26
25
24
23
22
21
RESB
PHI2C
SOB
PHI2
BE
NC
RWB
D0
D1
D2
D3
D4
D5
D6
D7
A15
A14
A13
A12
VSS
Figure 3-1 W65C02S 40 Pin PDIP Pinout
The Western Design Center, Inc.
W65C02S Data Sheet
13
The Western Design Center, Inc.
2
1
44
43
42
41
BE
PHI2
SOB
3
PHI2O
RDY
4
RESB
PHI1O
5
VSS
IRQB
6
VPB
MLB
W65C02S Data Sheet
40
NMIB
7
39
NC
SYNC
8
38
RWB
VDD
9
37
VDD
A0
10
36
D0
A1
11
35
D1
NC
12
34
D2
A2
13
33
D3
A3
14
32
D4
A4
15
31
D5
A5
16
30
D6
A6
17
29
D7
26
27
28
A14
A15
25
A12
24
VSS
23
VSS
22
A11
21
A10
20
A9
19
A8
A7
18
A13
W65C02
Figure 3-2 W65C02S 44 Pin PLCC Pinout
The Western Design Center, Inc.
W65C02S Data Sheet
14
The Western Design Center, Inc.
MLB
IRQB
PHI1O
RDY
VPB
VSS
RESB
PHI2O
SOB
PHI2
BE
W65C02S Data Sheet
44
43
42
41
40
39
38
37
36
35
34
3
31
VDD
A0
4
30
D0
A1
5
29
D1
NC
6
28
D2
A2
7
27
D3
A3
8
26
D4
A4
9
25
D5
A5
10
24
D6
A6
11
23
D7
13
14
15
16
17
18
19
20
21
22
A15
A7
12
A14
VDD
A13
RWB
A12
32
VSS
2
VSS
SYNC
A11
NC
A10
33
A9
1
A8
NMIB
Figure 3-3 W65C02S 44 Pin QFP Pinout
The Western Design Center, Inc.
W65C02S Data Sheet
15
The Western Design Center, Inc.
W65C02S Data Sheet
4 ADDRESSING MODES
The W65C02S is capable of directly addressing 65,536 bytes of memory. The Program Address and Data Address space is
contiguous throughout the 65,536 byte address space. Words, arrays, records, or any data structures may span the 65,536
byte address space. The following addressing mode descriptions provide additional detail as to how effective addresses are
calculated. Sixteen addressing modes are available for the W65C02S. This address space has special significance within
certain addressing modes.
4.1
Absolute a
With Absolute addressing the second and third bytes of the instruction form the 16-bit address.
Byte:
Instruction:
2
ADH
Operand Address:
4.2
1
ADL
0
OpCode
ADH
ADL
Absolute Indexed Indirect (a,x)
With the Absolute Indexed Indirect addressing mode, the X Index Register is added to the second and third byes of the
instruction to form an address to a pointer. This address mode is only used with the JMP instruction and the program
Counter is loaded with the first and second bytes at this pointer.
Byte:
Instruction:
2
ADH
1
ADL
Indirect Base address:
ADH
+
Indirect address:
New PC value:
4.3
0
OpCode
ADL
X
effective address
indirect address
Absolute Indexed with X a,x
With the Absolute Indexed with X addressing mode, the X Index Register is added to the second and third bytes of the
instruction to form the 16-bits of the effective address.
Byte:
Instruction:
2
ADH
1
ADL
0
OpCode
ADH
+
Operand address:
The Western Design Center, Inc.
W65C02S Data Sheet
ADL
X
effective address
16
The Western Design Center, Inc.
W65C02S Data Sheet
4.4
Absolute Indexed with Y a, y
With the Absolute Indexed with Y addressing mode, the Y Index Register is added to the second and third bytes of the
instruction to form the 16-bit effective address.
Byte:
Instruction:
2
ADH
1
ADL
0
OpCode
ADH
+
Operand address:
4.5
ADL
Y
effective address
Absolute Indirect (a)
With the Absolute Indirect addressing mode, the second and third bytes of the instruction form an address to a pointer. This
address mode is only used with the JMP instruction and the Program Counter is loaded with the first and second bytes at this
pointer.
Byte:
Instruction:
2
ADH
Indirect address:
New PC value:
4.6
1
ADL
0
OpCode
ADH
ADL
indirect address
Accumulator A
With Accumulator addressing the operand is implied as the Accumulator and therefore only a single byte forms the
instruction..
Byte:
Instruction:
2
1
Operand:
4.7
0
OpCode
accumulator
Immediate Addressing #
With Immediate Addressing the operand is the second byte of the instruction.
Byte:
Instruction:
2
1
Operand
Operand:
4.8
0
OpCode
Operand
Implied i
Implied addressing uses a single byte instruction. The operand is implicitly defined by the instruction.
Byte:
Instruction:
2
Operand address:
The Western Design Center, Inc.
1
0
OpCode
implied
W65C02S Data Sheet
17
The Western Design Center, Inc.
W65C02S Data Sheet
4.9
Program Counter Relative r
The Program Counter relative addressing mode, sometimes referred to as Relative Addressing, is used with the Branch
instructions. If the condition being tested is met, the second byte of the instruction is added to the Program Counter and
program control is transferred to this new memory location.
Byte:
Instruction:
2
1
offset
0
OpCode
PCH
+
New PC value
PCL
offset
effective address
4.10 Stack s
The Stack may use memory from 0100 to 01FF and the effective address of the Stack address mode will always be within
this range. Stack addressing refers to all instructions that push or pull data from the stack, such as Push, Pull, Jump to
Subroutine, Return from Subroutine, Interrupts and Return from Interrupt.
Byte:
Instruction:
2
1
Operand address:
0
OpCode
1
S
4.11 Zero Page zp
With Zero Page (zp) addressing the second byte of the instruction is the address of the operand in page zero.
Byte:
Instruction:
2
Operand address:
1
zp
0
OpCode
0
zp
4.12 Zero Page Indexed Indirect (zp,x)
The Zero Page Indexed Indirect addressing mode is often referred to as Indirect,X. The second byte of the instruction is the
zero page address to which the X Index Register is added and the result points to the low byte of the indirect address.
Byte:
Instruction:
2
1
zp
0
OpCode
Base Address:
+
Indirect Address:
0
Operand address:
The Western Design Center, Inc.
zp
X
address
indirect address
W65C02S Data Sheet
18
The Western Design Center, Inc.
W65C02S Data Sheet
4.13 Zero Page Indexed with X zp,x
With Zero Page Indexed with X addressing mode, the X Index Register is added to the second byte of instruction to form the
effective address.
Byte:
Instruction:
2
1
zp
0
OpCode
Base Address:
+
Operand Address:
0
zp
X
effective address
4.14 Zero Page Indexed with Y zp, y
With Zero Page Indexed with Y addressing, the second byte of the instruction is the zero page address to which the Y Index
Register is added to form the page zero effective address.
Byte:
Instruction:
2
1
zp
0
OpCode
Base Address:
+
Operand Address:
0
zp
Y
effective address
4.15 Zero Page Indirect (zp)
With Zero Page Indirect addressing mode, the second byte of the instruction is a zero page indirect address that points to the
low byte of a two byte effective address.
Byte:
Instruction:
2
Indirect Address:
1
zp
0
OpCode
0
zp
Operand Address:
indirect address
4.16 Zero Page Indirect Indexed with Y (zp), y
The Zero Page Indirect Indexed with Y addressing mode is often referred to as Indirect Y. The second byte of the instruction
points to the low byte of a two byte (16-bit) base address in page zero. Y Index Register is added to the base address to form
the effective address.
Byte:
Instruction:
1
zp
0
OpCode
Indirect Base Address:
0
zp
Operand Address:
indirect base address
+
Y
effective address
The Western Design Center, Inc.
2
W65C02S Data Sheet
19
The Western Design Center, Inc.
W65C02S Data Sheet
Table 4-1 Addressing Mode Table
Address Mode
Instruction Times in Memory
Cycle
Memory Utilization in Number of
Program Sequence Bytes
Original
NMOS 6502
W65C02S
Original
NMOS 6502
W65C02S
4 (3)
4 (3)
3
3
5
5
3
3
1.
Absolute a
2.
Absolute Indexed Indirect (a,x)
3.
Absolute Indexed with X a,x
4 (1,3)
4 (1,3)
3
3
4.
Absolute Indexed with Y a,y
4 (1)
4 (1)
3
3
5.
Absolute Indirect (a)
4 (3)
4 (3)
3
3
6.
Accumulator A
2
2
1
1
7.
Immediate #
2
2
2
2
8.
Implied i
2
2
1
1
9.
Program Counter Relative r
2 (2)
2 (2)
2
2
3-7
3-7
1-3
1-4
3 (3)
3 (3)
2
2
6
6
2
2
13. Zero Page Indexed with X zp,x
4 (3)
4 (3)
2
2
14. Zero Page Indexed with Y zp,y
4
4
2
2
15. Zero Page Indirect (zp)
-
5
-
2
16. Zero Page Indirect Indexed with Y (zp),y
5
5
2
2
10. Stack s
11. Zero Page zp
12. Zero Page Indexed Indirect (zp,x)
Notes: (indicated in parenthesis)
1. Page boundary, add 1 cycle if page boundary is crossed when forming address
2. Branch taken, add 1 cycle if branch is taken
3. Read-Modify-Write, add 2 cycles
The Western Design Center, Inc.
W65C02S Data Sheet
20
The Western Design Center, Inc.
W65C02S Data Sheet
5
OPERATION TABLES
Table 5-1 Instruction Set Table
1.
2.
3.
ADC
AND
ASL
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
•BBR
•BBS
BCC
BCS
BEQ
BIT
BMI
BNE
BPL
•BRA
BRK
BVC
BVS
CLC
CLD
CLI
CLV
CMP
CPX
CPY
DEC
DEX
DEY
EOR
INC
INX
INY
JMP
JSR
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
48.
49.
50.
51.
52.
LDA
LDX
LDY
LSR
NOP
ORA
PHA
PHP
PHX
PHY
PLA
PLP
•PLX
•PLY
•RMB
ROL
ROR
RTI
RTS
SBC
ADd memory to accumulator with Carry
"AND" memory with accumulator
Arithmetic Shift one bit Left, memory or
accumulator
Branch on Bit Reset
Branch of Bit Set
Branch on Carry Clear (Pc=0)
Branch on Carry Set (Pc=1)
Branch if EQual (Pz=1)
BIt Test
Branch if result MInus (Pn=1)
Branch if Not Equal (Pz=0)
Branch if result PLus (Pn=0)
BRanch Always
BReaK instruction
Branch on oVerflow Clear (Pv=0)
Branch on oVerflow Set (Pv=1)
CLear Cary flag
CLear Decimal mode
CLear Interrupt disable bit
CLear oVerflow flag
CoMPare memory and accumulator
ComPare memory and X register
ComPare memory and Y register
DECrement memory or accumulate by one
DEcrement X by one
DEcrement Y by one
"Exclusive OR" memory with accumulate
INCrement memory or accumulate by one
INcrement X register by one
INcrement Y register by one
JuMP to new location
Jump to new location Saving Return (Jump to
SubRoutine)
LoaD Accumulator with memory
LoaD the X register with memory
LoaD the Y register with memory
Logical Shift one bit Right memory or accumulator
No OPeration
"OR" memory with Accumulator
PusH Accumulator on stack
PusH Processor status on stack
PusH X register on stack
PusH Y register on stack
PuLl Accumulator from stack
PuLl Processor status from stack
PuLl X register from stack
PuLl Y register from stack
Reset Memory Bit
ROtate one bit Left memory or accumulator
ROtate one bit Right memory or accumulator
ReTurn from Interrupt
ReTurn from Subroutine
SuBtract memory from accumulator with borrow
(Carry bit)
The Western Design Center, Inc.
53.
54.
55.
56.
57.
58.
59.
60.
61.
62.
63.
64.
65.
66.
67.
68.
69.
SED
SEI
•SMB
STA
•STP
STX
STY
•STZ
TAX
TAY
•TRB
•TSB
TSX
TXA
TXS
TYA
•WAI
SEt Decimal mode
SEt Interrupt disable status
Set Memory Bit
STore Accumulator in memory
SToP mode
STore the X register in memory
STore the Y register in memory
STore Zero in memory
Transfer the Accumulator to the X register
Transfer the Accumulator to the Y register
Test and Reset memory Bit
Test and Set memory Bit
Transfer the Stack pointer to the X register
Transfer the X register to the Accumulator
Transfer the X register to the Stack pointer register
Transfer Y register to the Accumulator
WAit for Interrupt
Note: •=New Instruction
W65C02S Data Sheet
21
The Western Design Center, Inc.,
RTI s
6,1
BVC r
2,2
RTS s
6,1
4
5
6
W65C02S Datasheet
SBC (zp),y SBC (zp)
5,2
5,2 *
CPY #
2,2
BNE r
2,2
CPX #
2,2
BEQ r
2,2
C
D
E
F
1
2
* = Old instruction with new addressing modes
• = New Instruction
0
SBC (zp,x)
6,2
BCS r
2,2
B
4
5
LDA zp
3,2
6
LDX zp
3,2
STA zp,x STX zp,y
4,2
4,2
8
RMB0 zp PHP s
5,2 • 3,1
RMB1 zp CLC i
5,2
• 2,1
RMB2 zp PLP s
5,2 • 4,1
RMB3 zp SEC i
5,2 • 2,1
RMB4 zp PHA s
5,2 • 3,1
RMB5 zp CLI i
5,2 • 2,1
RMB6 zp PLA s
5,2 • 4,1
RMB7 zp SEI i
5,2 • 2,1
SMB0 zp DEY i
5,2 • 2,1
SMB1 zp TYA i
5,2 • 2,1
SMB2 zp TAY i
7
7
8
A
STA a,y
5,3
BIT #
2,2
9
B
ORA a
4,3
D
ASL a
6,3
E
BBR0 r
F
6,3 •
5,3 •
TRB a ORA a,x ASL a,x BBR1 r
6,3
6,3 • 4,3
5,3 •
BIT a AND a ROL a BBR2 r
4,3
4,3
6,3
5,3 •
BIT a,x AND a,x ROL a,x BBR3 r
6,3
4,3 * 4,3
5,3 •
JMP a EOR a
LSR a BBR4 r
3,3
4,3
6,3
5,3 •
EOR a,x LSR a,x BBR5 r
4,3
6,3
5,3 •
JMP (a) ADC a ROR a BBR6 r
6,3
4,3
6,3
5,3 •
JMP (a,x) ADC a,x ROR a,x BBR7 r
4,3
6,3
6,3 *
5,3 •
STY a STA a STX a BBS0 r
4,3
4,3
4,3
5,3 •
STZ a STA a,x STZ a,x BBS1 r
4,3 • 4,3
5,3 • 5,3 •
LDY a LDA a
LDX a BBS2 r
TSB a
C
A
B
C
4,3
D
4,3
E
4,3
F
A
9
8
7
6
5
4
3
2
1
0
M
S
D
5,3 •
TSX i
LDY a,x LDA a,x LDX a,y BBS3 r
B
2,1
4,3
4,3
4,3
5,3 •
DEX i WAI i CPY a CMP a DEC a BBS4 r
C
2,1
4,3
6,3
3,1 • 4,3
5,3 •
PHX s STP i
CMP a,x DEC a,x BBS5 r
D
4,3
6,3
3,1 • 3,1 •
5,3 •
NOP i
CPX a SBC a
INC a BBS6 r
E
2,1
4,3
4,3
6,3
5,3 •
PLX s
SBC a,x INC a,x BBS7 r
F
4,3
6,3
4,1 •
5,3 •
TAX i
2,1
TXS i
2,1
TXA i
2,1
LSR A
2,1
EOR a,y PHY s
4,3
3,1 •
ADC # ROR A
2,2
2,1
PLY
s
ADC a,y
4,3
4,1 •
EOR #
2,2
ASL A
2,1
INC
A
ORA a,y
4,3
2,1 *
AND # ROL A
2,2
2,1
DEC
A
AND a,y
4,3
2,1 *
ORA #
2,2
9
LDA #
2,2
5,2 • 2,1
LDY zp,x LDA zp,x LDX zp,y SMB3 zp CLV i LDA a,y
4,2
4,2
4,2
4,3
5,2 • 2,1
CPY zp
CMP zp
DEC zp SMB4 zp INY i CMP #
3,2
3,2
5,2
2,2
5,2 • 2,1
SMB5
zp
CMP zp,x DEC zp,x
CLD i CMP a,y
4,2
6,2
4,3
5,2 • 2,1
CPX zp
SBC zp
INC zp SMB6 zp INX i SBC #
3,2
3,2
5,2
2,2
5,2 • 2,1
SBC zp,x INC zp,x SMB7 zp SED i SBC a,y
4,2
6,2
4,3
5,2 • 2,1
LDY zp
3,2
LDX #
2,2
LDA (zp),y LDA (zp)
5,2
5,2 *
CMP (zp,x)
6,2
CMP (zp),y CMP (zp)
5,2
5,2 *
LDA (zp,x)
6,2
LDY #
2,2
A
9
8
STY zp,x
4,2
ADC zp
ROR zp
3,2
5,2
3,2 •
STZ zp,x ADC zp,x ROR zp,x
4,2
6,2
4,2 •
STY zp
STA zp
STX zp
3,2
3,2
3,2
STZ zp
LSR zp
5,2
ORA zp,x ASL zp,x
4,2
6,2
5,2 •
BIT zp
AND zp
ROL zp
3,2
3,2
5,2
BIT zp,x AND zp,x ROL zp,x
6,2
4,2
* 4,2
STA (zp,x)
6,2
3,2 •
BCC r STA (zp),y STA (zp)
2,2
6,2
5,2 *
3
EOR (zp),y EOR (zp)
5,2
5,2 *
ADC (zp,x)
6,2
ADC (zp),y ADC (zp)
5,2
5,2 *
BMI r
2,2
3
BVS r
2,2
BRA r
EOR zp,x LSR zp,x
4,2
6,2
EOR (zp,x)
6,2
JSR a
6,3
2
7
EOR zp
3,2
ORA (zp),y ORA (zp)
5,2
5,2 *
AND (zp,x)
6,2
AND (zp),y AND (zp)
5,2
5,2 *
BPL r
2,2
•
ASL zp
5,2
1
5,2
TRB zp
ORA zp
3,2
TSB zp
6
ORA (zp,x)
6,2
5
4
BRK s
7,1
3
0
2
1
W65C02S OpCode Matrix
0
M
S
D
The Western Design Center, Inc.
W65C02S Datasheet
Table 5-2 W65C02S OpCode Matrix
22
The Western Design Center, Inc.
W65C02S Datasheet
6 DC, AC AND TIMING CHARACTERISTICS
Table 6-1 Absolute Maximum Ratings
Rating
Symbol
Value
Supply Voltage
VDD
-0.3 to +7.0V
Input Voltage
VIN
-0.3 to VDD +0.3V
TS
-55°C to +150°C
Storage Temperature
This device contains input protection against damage due to high static voltages or electric fields; however, precautions should be taken
to avoid application of voltages higher than the maximum rating.
Note: Exceeding these ratings may result in permanent damage. Functional operation under these conditions is not implied.
The Western Design Center, Inc.
W65C02S Datasheet
23
The Western Design Center, Inc.
W65C02S Datasheet
6.1
DC Characteristics TA = -40°C to +85°C (PLCC, QFP) TA= 0°C to 70°C (DIP)
Table 6-2 DC Characteristics
5.0 +/ - 5%
3.3 +/ - 10%
3.0 +/- 5%
Min
Max
Min
Max
Min
Max
Min
Max
Min
Max
Supply Voltage
Input High Voltage (1)
BE, D0-D7, RDY, SOB
IRQB, NMIB, PHI2, RESB
Input Low Voltage (1)
BE, D0-D7, RDY, SOB,
IRQB, NMIB, PHI2, RESB
Input Leakage Current (Vin=0.4 to 2.4, VDD=max)
BE, IRQB, NMIB, PHI2, RESB, SOB
4.75
5.25
3.0
3.6
2.85
3.15
2.37
2.63
1.71
1.89
V
VDDx0.7
VDD-0.4
VDD+0.3
VDD+0.3
VDDx0.7
VDD-0.4
VDD+0.3
VDD+0.3
VDDx0.7
VDD-0.4
VDD+0.3
VDD+0.3
VDDx0.7
VDD-0.4
VDD+0.3
VDD+0.3
VDDx0.7
VDD-0.4
VDD+0.3
VDD+0.3
V
VSS-0.3
VDDx0.3
VSS-0.3
VDDx0.3
VSS-0.3
VDDx0.3
VSS-0.3
VDDx0.3
VSS-0.3
VDDx0.3
V
VSS-0.3
VSS+0.4
VSS-0.3
VSS+0.4
VSS-0.3
VSS+0.4
VSS-0.3
VSS+0.4
VSS-0.3
VSS+0.1
-20
20
-20
20
-20
20
-20
20
-20
20
nA
RDY Input Pull-UP Current (Vin=VDD-0.4V (min)
Vin=0.4(max))
-1
-20
-1
-20
-1
-10
-1
-10
-0.25
-2.0
µA
Iin
D0-D7 (off state)
Output High current (Voh=VDD-.4, VDD=min)
-20
20
-20
20
-20
20
-20
20
-20
20
nA
Ioh
A0-A15, D0-D7, MLB, PHI1O, PHI2O, RWB, SYNC,
VPB
700
-
350
-
300
-
200
-
100
-
uA
A0-A15, D0-D7, MLB, PHI1O, PHI2O, RWB, SYNC,
VPB
1.6
-
1.6
-
1.6
-
1.0
-
0.5
-
mA
Supply Current (with Tester Loading)
Supply Current (Core)
-
1.5
0.5
-
1.0
0.3
-
1.0
0.25
-
0.75
0.2
-
0.5
0.15
mA/
MHz
-
1
-
1
-
1
-
1
-
1
uA
-
5
-
5
-
5
-
5
-
5
pF
Symbol
VDD
Vih
Vil
Iin
Ipup
2.5 +/ - 5%
1.8 +/ - 5%
Units
Output Low current (Vol=0.4, VDD=min)
Iol
Idd
Standby Current Outputs Unloaded
BE, IRQB, NMIB, PHI2, SOB=VDD
*Capacitance (Vin=0V, TA=25°C, f-1MHz)
BE, IRQB, NMIB, PHI2, RESB, RDY, SOB
A0-A15, D0-D7, RWB
Isby
Cin
Cts
*Not insp ected during production test; verified on a sample basis.
1.2
1.1
1.0
0.9
0.8
0.7
0.6
0.5
0.4
0.3
0.2
0.1
0.0
1 MHz Operation@85°C
Typical 0.6u processed device
× (With tester loading)
• (CORE power only)
×
Vdd (VOLTS)
Idd (mA)
(1) For high speed tests, Vih and Vil are set for VDD-.2v and VSS+.2V. The input “1” and “0” thresholds are tested at 1 MHz.
×
×
•
×
•
0
1
•
•
2
4
3
Vdd (VOLTS)
5
6
Figure 6-1 Idd vs Vdd
The Western Design Center, Inc.
W65C02S Datasheet
6.0
5.5
5.0
4.5
4.0
3.5
3.0
2.5
2.0
1.5
1.0
0.0
Typical 0.6u processed device @85°C
×
×
0
2
4
6
×
×
8 10 12 14 16 18
F Max (MHz)
20
Figure 6-2 F Max vs Vdd
24
The Western Design Center, Inc.
W65C02S Datasheet
6.2
AC Characteristics TA = -40°C to +85°C (PLCC, QFP) TA= 0°C to 70°C (DIP)
Table 6-3 AC Characteristics
Symbol
Parameter
5.0 +/-5%
14MHz
Min
Max
3.3 +/-10%
8MHz
Min
Max
3.0 +/-5%
8MHz
Min
Max
2.5 +/-5%
4MHz
Min
Max
1.8 +/-5%
2MHz
Min
Max
4.75
5.25
3.0
3.6
2.85
3.15
2.375
2.675
1.71
1.89
V
Units
VDD
Supply Voltage
tACC
Access Time
30
-
70
-
70
-
145
-
290
-
nS
tAH
Address Hold Time
10
-
10
-
10
-
10
-
10
-
nS
tADS
Address Setup Time
-
30
-
40
-
40
-
75
-
150
nS
tBVD
BE to Valid Data (1)
-
25
-
30
-
30
-
30
-
30
nS
CEXT
Capacitive Load (2)
-
35
-
35
-
35
-
35
-
35
pF
tPWH
Clock Pulse Width High
35
-
62
-
62
-
125
-
250
-
nS
tPWL
Clock Pulse Width Low
35
-
63
-
63
-
125
-
250
-
nS
tCYC
Cycle Time (3)
70
-
125
-
125
-
250
-
500
-
nS
tF,tR
Fall Time, Rise Time
-
5
-
5
-
5
-
5
-
5
nS
tPCH
Processor Control Hold Time
10
-
10
-
10
-
10
-
10
-
nS
tPCS
Processor Control Setup Time
10
-
15
-
15
-
30
-
60
-
nS
tDHR
Read Data Hold Time
10
-
10
-
10
-
10
-
10
-
nS
tDSR
Read Data Setup Time
10
-
15
-
15
-
30
-
60
-
nS
tMDS
Write Data Delay Time
-
25
-
40
-
40
-
70
-
140
nS
tDHW
Write Data Hold Time
10
-
10
-
10
-
10
-
10
-
nS
1.
2.
3.
BE to High Impedance State is not testable but should be the same amount of time as BE to Valid Data
ATE or loading on all outputs
Since this is a static design, the maximum cycle time could be infinite.
The Western Design Center, Inc.,
W65C02S Datasheet
25
The Western Design Center, Inc.
W65C02S Datasheet
tF
tR
PHI2
tPWL
tPWH
tAH
tAH
see note 1
A0-A15. MLB,
R/W, SYNC, VPB
tADS
tACC
tDSR
Read Data
tDHR
tMDS
Write Data
tDHR
Write Data
tDHW
tPCS
tDHW
SOB
tPCH
tPCH
IRQB, NMIB
RDY, RESB
tPCS
SOB
DATA
tBVD
Figure 6-3 General Timing Diagram
Timing Notes:
1.
2.
Timing measurement points are 50% VDD.
PHI1O and PHI2O clock delay from PHI2 is no longer specified or tested and WDC recommends using an oscillator for system time base and PHI2
processor input clock.
The Western Design Center, Inc.
W65C02S Datasheet
26
The Western Design Center, Inc.
W65C02S Datasheet
The page left blank intentionally
The Western Design Center, Inc.
W65C02S Datasheet
27
The Western Design Center, Inc.
W65C02S Datasheet
ADC
AND
ASL
BBR0
BBR1
BBR2
BBR3
BBR4
BBR5
BBR6
BBR7
BBS0
BBS1
BBS2
BBS3
BBS4
BBS5
BBS6
BBS7
BCC
BCS
BEQ
BIT
BMI
BNE
BPL
BRA
The Western Design Center, Inc.
(a,x)
a,x
a,y
(a)
A
#
i
r
s
zp
(zp,x)
zp,x
zp,y
(zp)
(zp),y
Operation
# Immediate Data
~ NOT
^ AND
v OR
v Exclusive OR
A+M+C→A
A^M→A
C← 7 6 5 4 3 2 1 0 ←0
Branch on bit 0 reset
Branch on bit 1 reset
Branch on bit 2 reset
Branch on bit 3 reset
Branch on bit 4 reset
Branch on bit 5 reset
Branch on bit 6 reset
Branch on bit 7 reset
Branch on bit 0 set
Branch on bit 1 set
Branch on bit 2 set
Branch on bit 3 set
Branch on bit 4 set
Branch on bit 5 set
Branch on bit 6 set
Branch on bit 7 set
Branch C = 0
Branch if C = 1
Branch if Z = 1
A^M
Branch if N = 0
Branch if Z = 0
Branch if N = 0
Branch Always
a
Mnemomic
Table 6-4 Operation, Operation Codes and Status Register
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
6D
7D
79
2D
3D
39
0E
1E
69
65
61
29
25
21
0A
06
75
72
71
35
32
31
16
0F
1F
2F
3F
4F
5F
6F
7F
8F
9F
AF
BF
CF
DF
EF
FF
90
B0
F0
2C
3C
89
24
30
34
Processor Status Register (P)
*User Defined
7
N
N
N
N
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
M7
.
6
V
V
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
M6
.
5
1
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
4
1
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
3
D
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
2
I
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
Z
.
1
Z
Z
Z
Z
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
0
C
C
.
C
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
D0
10
80
W65C02S Datasheet
28
The Western Design Center, Inc.
a,x
a,y
(a)
A
#
i
r
s
zp
(zp,x)
zp,x
zp,y
(zp)
(zp).y
Processor Status Register (P)
*User Defined
(a,x)
Operation
# Immediate Data
~ NOT
^ AND
v OR
v Exclusive OR
a
Mnemomic
W65C02S Datasheet
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
7
N
6 5
V 1
4
1
3
D
2
I
1
Z
0
C
.
.
.
.
.
.
.
.
.
1
.
.
0
.
.
1
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
0
BRK
BVC
BVS
Break
Branch if V = 0
CLC
CLD
C→0
18
0→ D
D8
.
.
.
.
0
.
.
.
CLI
0→1
58
.
.
.
.
.
0
.
.
CLV
CMP
CPX
0→V
B8
.
0
.
.
.
.
.
.
N
.
.
.
.
.
Z
C
00
50
Branch if V = 1
70
A-M
CD
X-M
CPY
DEC
Y-M
Decrement
CE
DEX
X-1 → A
CA
DEY
EOR
Y-1 → Y
A vM →A
88
4D
5D
INC
Increments
EE
FE
INX
INY
X+1 → X
Y+1 → Y
JMP
Jump to new location
4C
JSR
LDA
Jump to Subroutine
20
M→A
AD
LDX
M→ X
AE
LDY
LSR
NOP
M→Y
AC
BC
0 → 7 6 5 4 3 2 1 0→ C
4E
5E
No Operation
The Western Design Center, Inc.
DD
D9
C9
C5
EC
E0
E4
N
.
.
.
.
.
Z
C
CC
C0
C4
N
.
.
.
.
.
Z
C
N
.
.
.
.
.
Z
.
N
.
.
.
.
.
Z
.
N
.
.
.
.
.
Z
.
N
.
.
.
.
.
Z
.
N
.
.
.
.
.
Z
.
E8
N
.
.
.
.
.
Z
.
C8
N
.
.
.
.
.
Z
.
DE
3A
59
C6
49
45
1A
7C
C1
D5
D2
D1
D6
41
E6
55
52
51
F6
6C
BD
.
.
.
.
.
.
.
Z
.
N
.
.
.
.
.
Z
.
N
.
.
.
.
.
Z
.
BE
A2
A6
A0
A4
B4
N
.
.
.
.
.
Z
.
46
56
0
.
.
.
.
.
Z
C
.
.
.
.
.
.
.
.
B6
B1
.
.
A5
W65C02S Datasheet
B2
.
.
A9
EA
B5
.
B9
4A
A1
.
N
29
The Western Design Center, Inc.
a,x
a,y
(a)
A
#
i
r
s
zp
(zp,x)
zp,x
zp,y
(zp)
(zp),y
Processor Status Register (P)
*User Defined
(a,x)
Operat ion
# Immediate Data
~ NOT
^ AND
v OR
v Exclusiv e OR
a
Mnemomic
W65C02S Datasheet
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
ORA
PHA
PHP
A V M→A
A → Ms, S -1 → S
P → Ms, S-1 → S
08
7
N
N
.
.
PHX
PHY
X → Ms, S -1 → S
DA
.
.
.
.
.
.
.
.
Y → Ms, S -1 → S
5A
.
.
.
.
.
.
.
.
PLA
S + 1 → S, Ms → A
68
N
.
.
.
.
.
Z
.
PLP
PLX
S + 1 → S, Ms → P
28
N
V
.
1
D
I
Z
C
S + 1 → S, Ms → X
FA
N
.
.
.
.
.
Z
.
PLY
S + 1 → S, Ms → Y
7A
N
.
.
.
.
.
Z
.
RMB0
RMB1
RMB2
Reset Memory Bit 0
.
.
.
.
.
.
.
.
Reset Memory Bit 1
.
.
.
.
.
.
.
.
Reset Memory Bit 2
.
.
.
.
.
.
.
.
RMB3
RMB4
Reset Memory Bit 3
.
.
.
.
.
.
.
.
Reset Memory Bit 4
.
.
.
.
.
.
.
.
RMB5
Reset Memory Bit 5
.
.
.
.
.
.
.
.
RMB6
RMB7
Reset Memory Bit 6
.
.
.
.
.
.
.
.
Reset Memory Bit 7
.
.
.
.
.
.
.
ROL
C←7 6 5 4 3 2 1 0 ← C
2E
3E
2A
26
36
N
.
.
.
.
.
Z
C
ROR
C→7 6 5 4 3 2 1 0 → C
6E
7E
6A
66
76
N
.
.
.
.
.
Z
C
RTI
Return from Interrupt
N
V
.
1.
D
I
Z
C
RTS
Return from Subroutine
SBC
SEC
A - M - (~C) → A
1→C
SED
1→D
The Western Design Center, Inc.
0D
1D
19
09
05
01
15
12
11
48
40
60
ED
FD
F9
6
V
.
.
.
5
1
.
.
.
4
1
.
.
.
3
D
.
.
.
2
I
.
.
.
1
Z
Z
.
.
0
C
.
.
.
.
.
.
.
.
.
.
.
N
V
.
.
.
.
Z
C
38
.
.
.
.
.
.
1
F8
.
.
.
1
.
.
.
E9
E5
W65C02S Datasheet
E1
F5
F2
F1
.
.
30
The Western Design Center, Inc.
a,x
a,y
(a)
A
#
i
r
s
zp
(zp,x)
zp,x
zp,y
(zp)
(zp),y
Processor Status Register (P)
*User Defined
(a,x)
Operation
# Immediate Data
~ NOT
^ AND
v OR
v Exclusive OR
a
Mnemomic
W65C02S Datasheet
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
Set Memory Bit 0
87
.
Set Memory Bit 1
97
.
6 5
V 1
.
.
.
.
.
.
SMB2
SMB3
Set Memory Bit 2
Set Memory Bit 3
A7
.
.
.
.
.
.
.
.
B7
.
.
.
.
.
.
.
.
SMB4
Set Memory Bit 4
C7
.
.
.
.
.
.
.
.
SMB5
SMB6
Set Memory Bit 5
Set Memory Bit 6
D7
.
.
.
.
.
.
.
.
E7
.
.
.
.
.
.
.
.
SMB7
Set Memory Bit 7
F7
.
.
.
.
.
.
.
.
STA
STP
STX
A→M
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
X→ M
8E
86
.
.
.
.
.
.
.
.
STY
STZ
Y→M
8C
84
94
.
.
.
.
.
.
.
.
00 → M
9C
64
74
.
.
.
.
.
.
.
.
TAX
A→Y
AA
N
.
.
.
.
.
Z
.
TAY
TRB
A→X
AB
N
.
.
.
.
.
Z
.
~A^M → M
1C
.
.
.
.
.
Z
.
TSB
AVM → M
0C
.
.
.
.
.
.
Z
.
TSX
TXA
S→ X
BA
N
.
.
.
.
.
Z
.
X→ A
8A
N
.
.
.
.
.
Z
.
TXS
X→ S
9A
.
.
.
.
.
.
.
.
TYA
WAI
Y→A
98
N
.
.
.
.
.
Z
.
0 → RDY
CB
.
.
.
.
.
.
.
.
SEI
SMB0
SMB1
1→I
78
8D
9D
The Western Design Center, Inc.
99
.
85
81
95
92
DB
STOP (1→ PHI2)
9E
7
N
96
91
14
04
W65C02S Datasheet
4
1
.
.
.
3
D
.
.
.
2
I
1
.
.
1
Z
.
.
.
0
C
.
.
.
31
The Western Design Center, Inc.
W65C02S Datasheet
Table 6-5 Instruction Timing Chart
Address Mode
1a. Absolute a
ADC, AND, BIT, CMP, CPX, CPY, EOR,
LDA, LDX, LDY, ORA, SBC, STA, STX,
STY, STZ
16 OpCodes, 3 bytes, 4&5 cycles
1b. Absolute (R-M-W) a
ASL, DEC, INC, LSR, ROL, ROR, TRB,
TSB
8 OpCodes, 3 bytes, 6 cycles
Note
(6)
1c. Absolute (JUMP) a
JMP (4C)
1 OpCode, 3 bytes, 3 cycles
1d. Absolute (JUMP to subroutine) a
JSR (20)
1 OpCode, 3 bytes, 3 cycles
(different order from N6502)
2. Absolute Indexed Indirect (a, x)
JMP (7C)
1 OpCode, 3 bytes, 6 cycles
3a. Absolute , X a, x
ADC, AND, BIT, CMP, EOR, LDA, LDY,
ORA, SBC, STA, STZ
11 OpCodes, 3 bytes, 4,5 and 6 cycles
3b. Absolute, X(R-M-W) a, x
ASL, DEC, INC, LSR, ROL, ROR
6 OpCodes, 3 bytes, 7 cycles
4. Absolute, Y a, y
ADC, AND, CMP, EOR, LDA, LDX, ORA,
SBC, STA
9 OpCodes, 3 bytes, 4,5 and 6 cycles
5. Absolute Indirect (a)
JMP (6C)
1 OpCode, 3 bytes, 6 cycles
6. Accumulator A
ASL, DEC, INC, LSR, ROL, ROR
6 OpCodes, 1 byte, 2 cycles
7. Immediate #
ADC, AND, BIT, CLR, CMP, CPY, CPX,
EOR, LDA, LDX, LDY, ORA, SBC
13 OpCodes, 2 bytes, 2 and 5 cycles
8a. Implied i
CLC, CLD, CLI, CLV, DEX, DEY, INX,
INY, NOP, SEC, SED, SEI, TAX. TAY,
TXA. TSX. TXS, TYA
18 OpCodes, 1 byte, 2 cycles
The Western Design Center, Inc.
(1)
(1)
(6)
(1)
(1)
(6)
(6)
Cycle
1
2
3
4
VPB
1
1
1
1
MLB
1
1
1
1
SYNC
1
0
0
0
Address Bus
PC
PC+1
PC+2
AA
Data Bus
OpCode
AAL
AAH
Data
RWB
1
1
1
1/0
1
2
3
4
5
6
1
2
3
1
1
2
3
4
5
6
1
1
2
3
4
5
6
1
1
2
3
4
1
2
3
4
5
6
7
1
2
3
4
1
2
3
4
5
6
1
1
2
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
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
0
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
1
1
0
0
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
0
0
0
0
1
0
0
1
1
0
0
0
0
0
1
1
0
0
0
0
0
1
1
0
0
0
1
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
1
1
0
PC
PC+1
PC+2
AA
AA
AA
PC
PC+1
PC+2
New PC
PC
PC+1
S
S
S+1
PC+2
New PC
PC
PC+1
PC+2
PC+2
AA+X
AA+X+1
New PC
PC
PC+1
PC+2
AA+X
PC
PC+1
PC+2
AAH,AAL+X
AA+X
AA+X+1
AA+X
PC
PC+1
PC+2
AA+Y
PC
PC+1
PC+2
PC+2
0,AA
0,AA+1
New PC
PC
PC+1
OpCode
AAL
AAH
Data
IO
Data
OpCode
New PCL
New PCH
New OpCode
OpCode
New PCL
IO
PCH
PCL
New PCH
New OpCode
OpCode
AAL
AAH
IO
New PCL
New PCH
OpCode
OpCode
AAL
AAH
Data
OpCode
AAL
AAH
IO
Data
IO
Data
OpCode
AAL
AAH
Data
OpCode
AAL
AAH
IO
New PCL
New PCH
OpCode
OpCode
IO
1
1
1
1
1
0
1
1
1
1
1
1
1
0
0
1
1
1
1
1
1
1
1
1
1
1
1
1/0
1
1
1
1
1
1
0
1
1
1
1/0
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
0
PC
PC+1
OpCode
ID
1
1
1
2
1
1
1
1
1
0
PC
PC+1
OpCode
IO
1
1
W65C02S Datasheet
32
The Western Design Center, Inc.
W65C02S Datasheet
Address Mode
8b. Stop the Clock i
STP
1 OpCode, 1 byte, 3 cycles
Note
RESB=1
RESB=0
RESB=0
RESB=1
8c. Wait for Interrupt i
WAI
1 OpCode, 1 byte, 3 cycles
IRQB NMIB
9a. Relative r
BCC, BCS, BEQ, BMI, BNE, BPL,
BRA, BVC, BVS
9 OpCodes, 2 bytes, 2,3 and 4 cycles
9b. Relative Bit Branch r
BBRx, BBSx
16 OpCodes, 3 bytes, 5,6 and 7 cycles
(4)
(2)
(3)
(2)
(3)
10a. Stack s
ABORTB, IRQB, NMIB, RESB
4 hardware interrupts, 0 bytes, 7 cycles
(5)
10b. Stack (Software Interrupts) s
BRK
1 OpCode, 2 bytes, 7 cycles
10c. Stack (Return from interrupt) s
RTI
1 OpCode, 1 byte, 6 cycles
10d. Stack (Return from subroutine) s
RTS
1 OpCode, 1 byte, 6 cycles
10e. Stack s
PHA, PHP, PHX, PHY
4 OpCodes, 1 byte, 3 cycles
10f. Stack s
PLA, PLP, PLX, PLY
4 OpCodes, 1 byte, 4 cycles
11a. Zero Page zp
ADC, AND, BIT, CMP, CPX, CPY,
EOR, LDA, LDX, LDY, ORA, SBC,
STA, STX, STY, STZ
16 OpCodes, 2 bytes, 3 and 4 cycles
The Western Design Center, Inc.
Cycle
1
2
3
1c
1b
1a
1
1
2
3
1
1
2
1
VPB
1
1
1
1
1
1
1
1
1
1
1
1
1
1
MLB
1
1
1
1
1
1
1
1
1
1
1
1
1
1
SYNC
1
0
0
0
0
0
1
1
0
0
1
1
0
1
Address Bus
PC
PC+1
PC+1
PC+1
PC+1
PC+1
PC+1
PC
PC+1
PC+1
PC+1
PC
PC+1
New PC
Data Bus
OpCode
IO
IO
RES(BRK)
RES(BRK)
RES(BRK)
BEGIN
OpCode
IO
IO
IRQ(BRK)
OpCode
Offset
OpCode
RWB
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
3
4
5
1
2
3
4
5
6
7
1
1
2
3
4
5
6
7
1
1
2
3
4
5
6
1
1
2
3
4
5
6
1
1
2
3
1
1
2
3
4
1
1
2
3
1
1
1
1
1
1
1
1
1
1
1
0
0
1
1
1
1
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
0
0
0
0
1
0
0
0
0
0
0
1
1
0
0
0
0
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
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
1
1
0
0
0
0
0
1
1
0
0
0
0
0
1
1
0
0
1
1
0
0
0
1
1
0
0
1
PC
PC+1
0,zp
PC+2
PC+Offset
PC
PC
01,S
01,S-1
01,S-2
VA
VA+1
New PC
PC
PC+1
S
S-1
S-2
VA
VA+1
New PC
PC
PC+1
S+1
S+2
S+3
PC+1
Return PC
PC
PC+1
PC+1
S+1
S+2
PC+1
Return PC
PC
PC+1
S
PC+1
PC
PC+1
PC+1
S+1
PC+1
PC
PC+1
0,zp
PC+2
OpCode
zp
Data
Offset
New OpCode
not used
not used
Return PCH
Return PCL
Return P
New PCL
New PCH
New OpCode
OpCode
not used
Return PCH
Return PCL+2
Return P
New PCL
New PCH
New OpCode
OpCode
Not Used
Return P
Return PCL
Return PCH
IO
New OpCode
OpCode
not used
not used
Return PCL
Return PCH
IO
New OpCode
OpCode
not used
Register Value
New OpCode
OpCode
not used
not used
Register Value
New OpCode
OpCode
zp
Data
New OpCode
1
1
1
1
1
1
1
0
0
0
1
1
1
1
1
0
0
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1/0
1
W65C02S Datasheet
33
The Western Design Center, Inc.
W65C02S Datasheet
Address Mode
11b. Zero Page zp
ASL, DEC, INC, ROL, ROR, TRB, TSB
7 OpCodes
Note
11c. Zero Page zp
RMBx, SMBx
16 OpCodes, 2 bytes, 5 cycles
11d. Zero Page zp
BBRx, BBSx
16 OpCodes, 3 bytes, 5 cycles
12. Zero Page Indexed Indirect (zp,x)
ADC, AND, CMP, EOR, LDA, ORA,
SBC, STA
8 OpCodes, 1 byte, 5 cycles
13a. Zero Page Indexed with X zp,x
ADC, AND, BIT, CMP, EOR, LDA,
ORA, LDY, SBC, STA, STY, STZ
12 OpCodes, 1 byte, 4 cycles
13b. Zerp Page Indexed with X zp,x
ASL, DEC, INC, LSR, ROL, ROR
6 OpCodes, 1 byte, 6 cycles
14. Zero Page Indexed with Y zp,y
ADC, AND, CMP, EOR, LDA, LDX,
ORA, SBC, STA, STX
10 OpCodes, 1 byte, 4 cycles
15. Zero Page Indirect (zp)
ADC, AND, CMP, EOR, LDA, ORA,
SBC, STA
8 OpCodes, 1 byte, 4 cycles
16.. Zero Page Indirect Indexed with y
(zp),y
ADC, AND, CMP, EOR, LDA, ORA,
SBC, STA
8 OpCodes, 1 byte, 4, 5 and 6 cycles
The Western Design Center, Inc.
(6)
(1)
Cycle
1
2
3
4
5
1
1
2
3
4
5
1
2
3
4
5
1
VPB
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
3
4
5
1
1
2
3
4
1
1
2
3
4
5
6
1
1
2
3
4
1
1
2
3
4
1
1
2
3
4
5
5a
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
1
1
1
1
MLB
1
1
0
0
0
1
1
1
1
1
1
1
1
1
1
1
1
SYNC
1
0
0
0
0
1
1
0
0
0
0
1
0
0
0
0
1
Address Bus
PC
PC+1
PC+1
zp
zp
PC+2
PC
PC+1
zp
zp
zp
PC
PC+1
zp
PC+2
PC+3
PC+2+0Offset
Data Bus
OpCode
zp
Data
not used
Data
New OpCode
OpCode
zp
Data
not used
Data
OpCode
zp
Data
Offset
not used
New OpCode
RWB
1
1
1
1
0
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
0
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
0
0
0
1
1
0
0
0
1
1
0
0
0
0
0
1
1
0
0
0
1
1
0
0
0
1
1
0
0
0
0
0
PC
PC+1
PC+1
0,zp+X
Indirect address
PC+1
PC
PC+1
PC+1
0,zp+X
PC+1
PC
PC+1
PC+1
0,zp+X
0,zp+X
0,zp+X
PC+1
PC
PC+1
PC+1
0,zp+Y
PC+1
PC
PC+1
0,zp
Indirect address
PC+1
PC
PC+1
0,zp
0,zp+1
Indirect address+y
PC+2
OpCode
zp
not used
Indirect address
Data
New OpCode
OpCode
zp
not used
Data
New OpCode
OpCode
zp
not used
Data
not used
Data
New OpCode
OpCode
zp
not used
Data
New OpCode
OpCode
zp
Indirect address
Data
New OpCode
OpCode
zp
Indirect address HIGH
Indirect address LOW
Data
New OpCode
1
1
1
1
1
1
1
1
1
1/0
1
1
1
1
1
1
0
1
1
1
1
1/0
1
1
1
1
1/0
1
1
1
1
1
1/0
I
W65C02S Datasheet
34
The Western Design Center, Inc.
W65C02S Datasheet
Notes:
1.
2.
3.
4.
5.
6.
Add 1 cycle for indexing across page boundaries, or write. This cycle contains invalid addresses.
Add 1 cycle if branch is taken.
Add 1 cycle if branch is taken across page boundaries.
Wait at cycle 2 for 2 cycles after NMIB or IRQB active input.
RWB remains high during Reset.
Add 1 cycle for decimal mode
AAH
AAH
AAL
AAVH
AAVL
C
DEST
ID
IO
P
Absolute Address
Absolute Address High
Absolute Address Low
Absolute Address Vector High
Absolute Address Vector Low
Accumulator
Destination
Immediate Data
Internal Operation
Status Register
The Western Design Center, Inc.
PC
PCH
PCL
R-M -W
REG
S
SRC
SO
V
x,y
zp
Program Counter
Program Counter High
Program Counter Low
Read-Modify-Write
Register
Stack Address
Source
Stack Offset
Vector Address
Index Register
Zero Page Address
W65C02S Datasheet
35
The Western Design Center, Inc.
W65C02S Datasheet
7 CAVEATS
Table 7-1 Microprocessor Operational Enhancements
Function
NMOS 6502
W65C02S
Indexed addressing across page
boundary
Extra read of invalid address.
Extra read of last instruction byte.
Execution of invalid OpCodes.
Some terminate only by reset.
Results are undefined.
All are NOP's (reserved for future use).
OpCode
Bytes
Cycles
02,22,42,62,82
2
2
C2, E2
X3,OB-BB,EB,FB
1
1
44
2
3
54,D4,F4
2
4
5C
3
8
DC,FC
3
4
Jump indirect, operand = XXFF.
Page address does not increment.
Page address increments, one additional
cycle.
Read/Modify/Write instruction at
effective address.
One read and two write cycles.
Two read and one write cycle.
Decimal flag.
Indeterminate after reset.
Initialized to binary mode (D=0) after reset
and interrupts.
Flags after decimal operation.
Invalid N, V and Z flags.
Valid flags. One additional cycle.
Interrupt after fetch of BRK
instruction
Interrupt vector is loaded; BRK
vector is ignored.
BRK is executed, and then interrupt is
executed.
Ready.
Input.
Bi-directional, WAI instruction pulls low.
Read/Modify/Write instructions
absolute indexed in same page.
Seven cycles.
Six cycles.
Oscillator.
Requires external active components.
Crystal or RC network will oscillate when
connected between PHI2 and PHI10.
Assertion of Ready (RDY) during
write operations.
Ignored.
Stops processor during PHI2, and WAI
instruction pulls RDY low.
Clock inputs.
PHI2 is the only required clock.
PHI2 is the only required clock.
Unused input-only pins.
Must be tied to VDD.
Must be tied to VDD.
The BRK instruction for both the NMOS 6502 and 65C02 is a 2 byte instruction. The NMOS and CMOS devices
simply skips the second byte (i.e. doesn’t care about the second byte) by incrementing the program counter twice.
It is important to realize that if a return from interrupt is used it will return to the location after the second or
signature byte.
The Western Design Center, Inc.
W65C02S Datasheet
36
The Western Design Center, Inc.
W65C02S Datasheet
8 W65C02DB DEVELOPER BOARD AND
IN-CIRCUIT EMULATOR (ICE)
CONTROL BUS
ADDRESS BUSS
DATA BUSS
CHIP SET
MEMORY BUS
RAM
PHI2
MPU
RESB
I/O
PLD
I/O
PORTS
MATRIX
I/O
JTAG
RESET
CIRCUIT
PC
PARALLEL PORT
OSCILLATOR
EPROM
PROGRAMABLE I/O BUSS
The W65C02DB is used for W65C02 core microprocessor System-Chip Development, W65C02S (chip) System
Development, or Embedded W65C02DB (board) Development.
The Western Design Center, Inc.
W65C02S Datasheet
37
The Western Design Center, Inc.
W65C02S Datasheet
8.1
Features:
W65C02S 8-bit MPU, total access to all control lines, Memory Bus, Programmable I/O Bus, PC Interface, 20 I/O lines, easy
oscillator change, 32K SRAM, 32K EPROM, W65C22S Versatile Interface Adapter VIA peripheral chip, on-board matrix,
CPLD for Memory map decoding, hardware breakpoints and ASIC design.
The CPLD chip is a XILINX XC95108 for changing the chip select and I/O functions if required. To change the CPLD chip
to suit your own setup, you need XILINX Data Manager for the XC95108 CPLD chip. The W65C02DB includes an onboard programming header for JTAG configuration. For more details refer to the circuit diagram. The on-board W65C02S
and the W65C22S devices have measurement points for core power consumption. Power input is provided by an optional
power board which plugs into the 10 pin power header.
An EPROM programmer or an EPROM emulator is required to reprogram the EPROM. WDC’s (W65SDS) Software
Development System includes a W65C02S Assembler and Linker, W65C02S C-Compiler and Optimizer, and W65C02S
Simulator/Debugger. WDC’s PC IO daughter board can be used to connect the Developer Board to the parallel port of a PC
for In-Circuit Debugging.
8.2
CS1B:
CS3B:
CS2B:
8.3
Memory map:
8000-FFFF
0000-00EF & 0100-7FFF
00F0-00FF
⇒
⇒
⇒
EPROM (27C256)
SRAM (62C256)
VIA(W65C22S)
Cross-Debugging Monitor Program
The Cross-Debugging Monitor Programs
<drive>:\WDC_SDS\DEBUG\WDCMON\
of
the
Developer
Boards
are
located
in
the
directory
This directory contains the source and the batch files for all of the monitor programs. These programs can be burned into an
EPROM and used with the WDC evaluation boards (Developer Boards) and the WDC IO (or ZIO-1) daughter board to
interface to the parallel port of a PC. Then, the WDCDB.EXE debugger can be used to download programs, single step, set
breakpoints, examine memory, etc for In-Circuit Debugging (ICD).
The monitors have been designed to run correctly with a W65C02 MPU (WDCMON_1), W65C816 MPU (WDCMON_2),
W65C134 MCU (WDC134), or W65C265 MCU (WDC265). It detects the appropriate CPU type on RESET and operates
accordingly.
8.4
BUILDING
The batch files assemble the program and link it producing Motorola S-Record output. This can be changed by using a
different option with the WDCLN linker
The Western Design Center, Inc.
W65C02S Datasheet
38
The Western Design Center, Inc.
W65C02S Datasheet
9 HARD CORE MODEL
9.1
Features of the W65C02S Hard Core Model
•
The W65C02S core uses the same instruction set as the W65C02S.
•
The only functional difference between the W65C02S and W65C02S core is the RDY pin. The W65C02S RDY pin is
bi-directional utilizing an active pull-up. The W65C02S core RDY function is split into 2 pins, RDY, WAITN and
WAITP. The WAITN output goes low and WAITP goes high when a WAI instruction is executed.
•
The ESD and latch-up buffers have been removed.
•
The output from the core is the buffer N-channel and the P-channel transistor drivers.
•
The following inputs, if not used, must be pulled to the high state: RDY, IRQB, NMIB, BE and SOB.
•
The timing of the W65C02S core is the same as the W65C02S.
10 SOFT CORE RTL MODEL
10.1 W65C02 Synthesizable RTL-Code in Verilog HDL
The RTL-Code (Register Transfer Level) in Verilog is a synthesizable model. The behavior of this model is equivalent to
the original W65C02S hardcore. The W65C02 RTL-Code is available as the core model and the W65C02S standard chip
model. The standard chip model includes the soft-core and the buffer ring in RTL-Code.
The Western Design Center, Inc.
W65C02S Datasheet
39
The Western Design Center, Inc.
W65C02S Datasheet
ORDERING INFORMATION
W65C02S6PL-14
W65C
Description
W65C = standard product
02S
Product Identification Number
6
Foundry Process
Blank = 1.2u
8=.8u, 6=.6u
PL
Package
P = Plastic Dual-In-Line, 40 pins
PL = Plastic Leaded Chip Carrier, 44 pins
Q = Quad Flat Pack, 44 pins
Temperature/Processing
Blank = -40°C to + 85°C (PLCC and QFP) 0°C to 70°C (DIP)
-14
Speed Designator
-14 = 14MHz
____________________________________________________________________________________
To receive general sales or technical support on standard product or information about our module library licenses,
contact us at:
The Western Design Center, Inc.
2166 East Brown Road
Mesa, Arizona 85213 USA
Phone: 480-962-4545 Fax: 480-835-6442
[email protected]
www.westerndesigncenter.com
_______________________________________________________________________________________
WARNING:
MOS CIRCUITS ARE SUBJECT TO DAMAGE FROM STATIC DISCHARGE
Internal static discharge circuits are provided to minimize part damage due to environmental static electrical charge
build-ups. Industry established recommendations for handling MOS circuits include:
1.
2.
3.
Ship and store product in conductive shipping tubes or conductive foam plastic. Never ship or store product in
non-conductive plastic containers or non-conductive plastic foam material.
Handle MOS parts only at conductive work stations.
Ground all assembly and repair tools.
The Western Design Center, Inc.
W65C02S Datasheet
40