WDC 65816
   HOME

TheInfoList



OR:

The W65C816S (also 65C816 or 65816) is an 8/16-bit
microprocessor A microprocessor is a computer processor where the data processing logic and control is included on a single integrated circuit, or a small number of integrated circuits. The microprocessor contains the arithmetic, logic, and control circ ...
(MPU) developed and sold by the
Western Design Center The Western Design Center (WDC), located in Mesa, Arizona, is a company which develops intellectual property for, and licenses manufacture of, MOS Technology 65xx based microprocessors, microcontrollers (µCs), and related support devices. W ...
(WDC). Introduced in 1985,Chronology of Microprocessors (1980–1989)
/ref> the W65C816S is an enhanced version of the
WDC 65C02 The Western Design Center (WDC) 65C02 microprocessor is an enhanced CMOS version of the popular nMOS-based 8-bit MOS Technology 6502. The 65C02 fixed several problems in the original 6502 and added some new instructions, but its main feature wa ...
8-bit MPU, itself a CMOS enhancement of the venerable
MOS Technology MOS Technology, Inc. ("MOS" being short for Metal Oxide Semiconductor), later known as CSG (Commodore Semiconductor Group) and GMT Microelectronics, was a semiconductor design and fabrication company based in Audubon, Pennsylvania. It is mos ...
6502 The MOS Technology 6502 (typically pronounced "sixty-five-oh-two" or "six-five-oh-two") William Mensch and the moderator both pronounce the 6502 microprocessor as ''"sixty-five-oh-two"''. is an 8-bit microprocessor that was designed by a small te ...
NMOS MPU. The 65C816 was the CPU for the
Apple IIGS The Apple IIGS (styled as II), the fifth and most powerful of the Apple II family, is a 16-bit personal computer produced by Apple Computer. While featuring the Macintosh look and feel, and resolution and color similar to the Amiga and Atari ST ...
and, in modified form, the Super Nintendo Entertainment System. The ''65'' in the part's designation comes from its 65C02 compatibility mode, and the ''816'' signifies that the MPU has selectable 8- and
16-bit 16-bit microcomputers are microcomputers that use 16-bit microprocessors. A 16-bit register can store 216 different values. The range of integer values that can be stored in 16 bits depends on the integer representation used. With the two mo ...
register Register or registration may refer to: Arts entertainment, and media Music * Register (music), the relative "height" or range of a note, melody, part, instrument, etc. * ''Register'', a 2017 album by Travis Miller * Registration (organ), th ...
sizes. In addition to the availability of 16-bit registers, the W65C816S features extended
memory address In computing, a memory address is a reference to a specific memory location used at various levels by software and hardware. Memory addresses are fixed-length sequences of digits conventionally displayed and manipulated as unsigned integers. ...
ing to 24 bits, supporting up to 16 megabytes of
random-access memory Random-access memory (RAM; ) is a form of computer memory that can be read and changed in any order, typically used to store working data and machine code. A random-access memory device allows data items to be read or written in almost the ...
, an enhanced instruction set, and a 16 bit
stack pointer In computer science, a call stack is a stack data structure that stores information about the active subroutines of a computer program. This kind of stack is also known as an execution stack, program stack, control stack, run-time stack, or mach ...
, as well as several new electrical signals for improved system hardware management. At reset, the W65C816S starts in "emulation mode", meaning it substantially behaves as a 65C02. Thereafter, the W65C816S may be switched to "native mode" with a two instruction sequence, causing it to enable all enhanced features, yet still maintain a substantial degree of
backward compatibility Backward compatibility (sometimes known as backwards compatibility) is a property of an operating system, product, or technology that allows for interoperability with an older legacy system, or with input designed for such a system, especiall ...
with most 65C02 software. However, unlike the PDIP40 version of the 65C02, which is a
pin-compatible In electronics, pin-compatible devices are electronic components, generally integrated circuits or expansion cards, sharing a common footprint and with the same functions assigned or usable on the same pins. Pin compatibility is a property des ...
replacement for its NMOS ancestor, the PDIP40 W65C816S is not pin-compatible with any other 6502 family MPU. Related to the W65C816S is the W65C802, which had the same internal structure and 16-bit support, but used a 40-pin layout compatible with the original 6502. This allowed it to be used as a drop-in replacement in certain roles. However, the 65C802 could not emit a full 24-bit address, which limited it to 64 KB of memory. The 65C802 and its relatives are no longer produced.


History

In 1981,
Bill Mensch William David Mensch, Jr. (born February 9, 1945) is an American electrical engineer born in Quakertown, Pennsylvania. He was a major contributor to the design of the Motorola 6800 8-bit microprocessor and was part of the team led by Chuck Pedd ...
, founder and CEO of WDC, began development of the 65C02 with his production partners, primarily
Rockwell Semiconductor Rockwell may refer to: Arts, entertainment, and media * ''Rockwell'' (album), a 2009 mini-album by Anni Rossi * Rockwell, a fictional town and setting of ''They Hunger'' * ''Rockwell'', a 1994 film about Porter Rockwell * Rockwell, Maine, a f ...
and Synertek. The primary goal of the 65C02 effort was to move from the original 6502's NMOS process to the 65C02's CMOS, which would allow it to run at much lower power levels, somewhere between and when running at the same clock speeds. A number of new opcodes and bug fixes were also worked into the design. Development of the W65C816S commenced in 1982 after Mensch consulted with Apple Computer on a new version of the Apple II series of
personal computer A personal computer (PC) is a multi-purpose microcomputer whose size, capabilities, and price make it feasible for individual use. Personal computers are intended to be operated directly by an end user, rather than by a computer expert or tec ...
s that would, among other things, have improved graphics and sound. Apple wanted an MPU that would be software compatible with the 6502 then in use in the Apple II but with the ability to address more memory, and to load and store 16 bit words. The result was the 65C816, finished in March 1984, with samples provided to both Apple and Atari in the second half of the year and full release in 1985. Mensch was aided during the design process by his sister Kathryn, who was responsible for part of the device's layout. The same process also led to the 65C802, which was identical inside to the 65C816. Both were produced on the same fabrication lines and diverged only during the last metalization stages when the chip was being connected to the external pins. In the 65C802, those pins had the same layout as the original 6502, which allowed it to be used as a drop-in replacement while still allowing the 16-bit processing of the CPU to be used. However, as it used the original pinout it had only 16 addressing pins, and could therefore only access 64 KB of external memory. Typically, when hardware manufacturers designed a project from the ground up, they used the 65C816 rather than the 65C802, resulting in the latter being withdrawn from production. Apple subsequently integrated the 65C816 into the
Apple IIGS The Apple IIGS (styled as II), the fifth and most powerful of the Apple II family, is a 16-bit personal computer produced by Apple Computer. While featuring the Macintosh look and feel, and resolution and color similar to the Amiga and Atari ST ...
computer. The basic 65C816 design was second-sourced by
GTE GTE Corporation, formerly General Telephone & Electronics Corporation (1955–1982), was the largest independent telephone company in the United States during the days of the Bell System. The company operated from 1926, with roots tracing furth ...
,
Sanyo , stylized as SANYO, is a Japanese electronics company and formerly a member of the ''Fortune'' Global 500 whose headquarters was located in Moriguchi, Osaka prefecture, Japan. Sanyo had over 230 subsidiaries and affiliates, and was founded by ...
and others from the mid-to-late 1980s to the early 1990s. In the 1990s, both the 65C816 and 65C02 were converted to a fully
static core Static core generally refers to a microprocessor (MPU) entirely implemented in static logic.  A static core MPU may be halted by stopping the system clock oscillator that is driving it, maintaining its state and resume processing at the poin ...
, which made it possible to completely stop the processor's Ø2 clock without loss of register contents. This feature, along with the use of asynchronous static RAM, made it possible to produce designs that used minimal power when in a standby state. , the W65C816S is available from WDC in 40 pin
PDIP In microelectronics, a dual in-line package (DIP or DIL), is an electronic component package with a rectangular housing and two parallel rows of electrical connecting pins. The package may be through-hole mounted to a printed circuit board ( ...
, PLCC44 or 44-pin TQFP packaging, as well as a core for ASIC integration (for example Winbond's W55V9x series of TV
Edutainment Educational entertainment (also referred to as edutainment) is media designed to educate through entertainment. The term was used as early as 1954 by Walt Disney. Most often it includes content intended to teach but has incidental entertainmen ...
ICs). WDC, itself a
fabless semiconductor company Fabless manufacturing is the design and sale of hardware devices and semiconductor chips while outsourcing their fabrication (or ''fab'') to a specialized manufacturer called a semiconductor foundry. These foundries are typically, but not exclu ...
, works with various
foundries A foundry is a factory that produces metal castings. Metals are cast into shapes by melting them into a liquid, pouring the metal into a mold, and removing the mold material after the metal has solidified as it cools. The most common metals pr ...
to produce the W65C816S, as well as other compatible products. Discrete processors are available through a number of electronics distributors. For designers who wish to include W65C816S functionality into a custom ASIC, WDC offers RTL (
register-transfer level In digital circuit design, register-transfer level (RTL) is a design abstraction which models a synchronous digital circuit in terms of the flow of digital signals (data) between hardware registers, and the logical operations performed on those ...
) code in
Verilog Verilog, standardized as IEEE 1364, is a hardware description language (HDL) used to model electronic systems. It is most commonly used in the design and verification of digital circuits at the register-transfer level of abstraction. It is als ...
.


Features

WDC 65c816 features: * Fully static CMOS design offers low power consumption (300  µ A at 1 
MHz The hertz (symbol: Hz) is the unit of frequency in the International System of Units (SI), equivalent to one event (or cycle) per second. The hertz is an SI derived unit whose expression in terms of SI base units is s−1, meaning that one he ...
) and increased noise immunity. * Wide operating
voltage Voltage, also known as electric pressure, electric tension, or (electric) potential difference, is the difference in electric potential between two points. In a static electric field, it corresponds to the work needed per unit of charge to ...
range: 1.8 V to 5.0 V ± 5%. * Wide operating frequency range, officially 14 MHz maximum at 5 volts (20Mhz in SuperCPU), using a single-phase clock source (hobbyists have successfully operated the 65C816 beyond 20 MHz). *
Emulation Emulation may refer to: *Emulation (computing), imitation of behavior of a computer or other electronic system with the help of another type of system :*Video game console emulator, software which emulates video game consoles *Gaussian process em ...
mode allows substantial software compatibility with the NMOS 6502 and CMOS 65C02, excepting undocumented opcodes. All 256 opcodes in the 65C816 are functional in both operating modes. * 24-bit memory addressing provides access to 16 MB of memory space. * 16-bit ALU, accumulator (C),
stack pointer In computer science, a call stack is a stack data structure that stores information about the active subroutines of a computer program. This kind of stack is also known as an execution stack, program stack, control stack, run-time stack, or mach ...
(S), and
index register An index register in a computer's CPU is a processor register (or an assigned memory location) used for pointing to operand addresses during the run of a program. It is useful for stepping through strings and arrays. It can also be used for hol ...
s (X and Y). * 16-bit Direct Page (aka zero page) register (D). * 8-bit data bank (DB) and program bank (PB) registers, generating bits 16–23 of 24-bit code and data addresses. Separate program and data bank registers allow program segmentation and 16 MB linear data addressing. * Valid data address (VDA) and valid program address (VPA) control outputs for memory qualification, dual
cache Cache, caching, or caché may refer to: Places United States * Cache, Idaho, an unincorporated community * Cache, Illinois, an unincorporated community * Cache, Oklahoma, a city in Comanche County * Cache, Utah, Cache County, Utah * Cache County ...
and cycle steal DMA implementation. * Vector pull (VPB) control output to indicate when an
interrupt vector An interrupt vector table (IVT) is a data structure that associates a list of interrupt handlers with a list of interrupt requests in a table of interrupt vectors. Each entry of the interrupt vector table, called an interrupt vector, is the addre ...
is being fetched. * Abort (ABORTB) input and associated vector supports processor repairs of bus error conditions, such as
page fault In computing, a page fault (sometimes called PF or hard fault) is an exception that the memory management unit (MMU) raises when a process accesses a memory page without proper preparations. Accessing the page requires a mapping to be added t ...
s and memory access violations. * Direct Page register and stack relative addressing provides capability for reentrant,
recursive Recursion (adjective: ''recursive'') occurs when a thing is defined in terms of itself or of its type. Recursion is used in a variety of disciplines ranging from linguistics to logic. The most common application of recursion is in mathematics ...
and re-locatable programming. * 24
addressing mode Addressing modes are an aspect of the instruction set architecture in most central processing unit (CPU) designs. The various addressing modes that are defined in a given instruction set architecture define how the machine language instructions i ...
s—13 original 6502 modes with 92
instructions Instruction or instructions may refer to: Computing * Instruction, one operation of a processor within a computer architecture instruction set * Computer program, a collection of instructions Music * Instruction (band), a 2002 rock band from Ne ...
using 256 op codes, including most new opcodes implemented in the 65C02. * Block-copy instructions, allowing rapid copying of data structures from one area of
RAM Ram, ram, or RAM may refer to: Animals * A male sheep * Ram cichlid, a freshwater tropical fish People * Ram (given name) * Ram (surname) * Ram (director) (Ramsubramaniam), an Indian Tamil film director * RAM (musician) (born 1974), Dutch * ...
to another with minimal code. * Wait-for-Interrupt (WAI) and Stop-the-Clock (STP) instructions further reduce power consumption, decrease
interrupt latency In computing, interrupt latency refers to the delay between the start of an Interrupt Request (IRQ) and the start of the respective Interrupt Service Routine (ISR). For many operating systems, devices are serviced as soon as the device's interrup ...
and allow synchronization with external events. *
Co-Processor A coprocessor is a computer processor used to supplement the functions of the primary processor (the CPU). Operations performed by the coprocessor may be floating-point arithmetic, graphics, signal processing, string processing, cryptography ...
(COP) instruction with associated vector supports co-processor configurations, e.g.,
floating point processor Floating may refer to: * a type of dental work performed on horse teeth * use of an isolation tank * the guitar-playing technique where chords are sustained rather than scratched * ''Floating'' (play), by Hugh Hughes * Floating (psychological ...
s. * Reserved "escape" (WDM) instruction for future two-byte opcodes and a link to future designs (WDM are the initials of W65C816S designer William D. Mensch).


Comparison with earlier models


Two modes

The 65C816 has two operating modes: "emulation mode", in which the 16-bit operations are invisible—the index registers are forced to eight bits—and the chip appears to be very similar to the 6502, with the same cycle timings for the opcodes; and "native mode", which exposes all new features. The CPU automatically enters emulation mode when it is powered on or reset, which allows it to replace a 65(C)02, assuming one makes the required circuit changes to accommodate the different pin layout.


16-bit registers

The most obvious change to the 65C816 when running in native mode is the expansion of the various registers from 8-bit to 16-bit sizes. This enhancement affects the accumulator (A), the X and Y
index register An index register in a computer's CPU is a processor register (or an assigned memory location) used for pointing to operand addresses during the run of a program. It is useful for stepping through strings and arrays. It can also be used for hol ...
s, and the
stack pointer In computer science, a call stack is a stack data structure that stores information about the active subroutines of a computer program. This kind of stack is also known as an execution stack, program stack, control stack, run-time stack, or mach ...
(S). It does not affect the program counter (PC), which has always been 16-bit. When running in native mode, two bits in the status register change their meaning. In the original 6502, bits 4 and 5 were not used, although bit 4 is referred to as the break (b) flag. In native mode, bit 4 becomes the x flag and bit 5 becomes the m flag. These bits control whether or not the
index register An index register in a computer's CPU is a processor register (or an assigned memory location) used for pointing to operand addresses during the run of a program. It is useful for stepping through strings and arrays. It can also be used for hol ...
s (x) and/or accumulator/memory (m) are 8-bit or 16-bit in size. Zeros in these bits set 16-bit sizes, ones set 8-bit sizes. These bits are fixed at ones when the processor is powered on or reset, but become changeable when the processor is switched to native mode. It might not be immediately obvious why one would want to use the now 16-bit registers in 8-bit mode. Switching to 8-bit mode using the new SEP (SEt Processor status bit) and REP (REset Processor status bit) instructions means that all subsequent instructions accessing those registers will only read or write a single byte instead of two. For instance, if the m bit is set to 1 when an LDA $1234 instruction is executed, only a single byte at address $1234 will be read, thereby reducing the number of cycles needed to execute the instruction. This is particularly useful when dealing with 8-bit character data, for instance. When register sizes are set to 16 bits, memory access will access two contiguous bytes of memory, at the cost of one extra clock cycle. Furthermore, a read-modify-write instruction, such as ROR , when used while the accumulator is set to 16 bits, will affect two contiguous bytes of memory, not one. Similarly, all arithmetic and logical operations will be 16-bit operations.


24-bit addressing

The other major change to the system while running in native mode is that the memory model is expanded to a 24-bit format from the original 16-bit format of the 6502. The 65c816 generates 24-bit addresses and makes use of two registers, the data bank register (DB) and the program bank register (PB), to set bits 16-23 of the effective address. In both cases, 'bank' refers to a contiguous 64 KB segment of memory that is bounded by the address range $xx0000-$xxFFFF, where xx is the bank address, that is, bits 16-23 of the effective address. Both DB and PB are initialized to $00 at power-on or reset. During an opcode or
operand In mathematics, an operand is the object of a mathematical operation, i.e., it is the object or quantity that is operated on. Example The following arithmetic expression shows an example of operators and operands: :3 + 6 = 9 In the above exam ...
fetch cycle, PB is prepended to the program counter (PC) to form the 24-bit effective address. Should PC "wrap" (return to zero), PB will not be incremented. Hence a program is bounded by the limits of the bank in which it is executing. Implied by this memory model is that branch and subroutine targets must be in the same bank as the instruction making the branch or call, unless "long" jumps or subroutine calls are used to execute code in another bank. There is no programmatic means by which PB can be directly changed. During a data fetch or store cycle, DB is prepended to a 16-bit data address to form the 24-bit effective address at which data will be accessed. This processor characteristic makes it possible to sanely execute 6502 or 65c02 code that uses 16-bit addresses to reference data elements. Unlike PB, DB can be changed under program control, something that might be done to access data beyond the limits of 16-bit addressing. Also, DB will temporarily increment if an address is indexed beyond the limits of the bank currently in DB. DB is ignored if a 24-bit address is specified as the operand to a data fetch/store instruction, or if the effective address is on direct (zero) page or the
hardware stack In computer science, a stack is an abstract data type that serves as a collection of elements, with two main operations: * Push, which adds an element to the collection, and * Pop, which removes the most recently added element that was not ...
. In the latter case, an implied bank $00 is used to generate the effective address. A further addition to the register set is the 16-bit direct page register (D), which sets the base address for what was formerly called the zero page, but now referred to as direct page. Direct page addressing uses an 8-bit address, which results in faster access than when a 16- or 24-bit address is used. Also, some addressing modes that offer indirection are only possible on direct page. In the 65(c)02, the direct page is always the first 256 bytes of memory, hence "zero page". In native mode, the 65c816 can relocate direct (zero) page anywhere in bank $00 (the first 64 KB of memory) by writing the 16-bit starting address into D. There is a one-cycle access penalty if D is not set to an even page boundary.


Switching between modes

The current mode of operation is stored in the emulation (e) bit. Having already added the new x and m bits to the previous set of six flags in the status register (P), there were not enough bits left to hold the new mode bit. Instead, a unique solution was used in which the mode bit was left "invisible", unable to be directly accessed. The new XCE (eXchange Carry with Emulation) instruction exchanges the value of the emulation bit with the carry (c) bit, bit 0 in the status register. For instance, if one wants to enter native mode after the processor has started up, one would use CLC to clear the carry bit, and then XCE to write it to the emulation bit. Returning to 65c02 emulation mode uses SEC followed by XCE. Internally, the 65c816 is a fully 16-bit design. The m and x bits in P determine how the user registers (accumulator and index) appear to the rest of the system. Upon reset, the 65c816 starts in 6502 emulation mode, in which m and x are set to 1 and cannot be changed. Hence the registers appear to the rest of the system as 8 bits. The most significant byte (MSB) of the accumulator (the B-accumulator) is not directly accessible but can be swapped with the least significant byte (LSB) of the accumulator (the A-accumulator) by using the XBA instruction. There is no corresponding operation for the index registers (X and Y). Upon being switched to native mode, the MSB of X and Y will be zero, and the B-accumulator will be unchanged. If the m bit in P is cleared, the B-accumulator is "ganged" to the A-accumulator to form a 16-bit register (called the C-accumulator). A load/store or arithmetic/logical operation involving the accumulator and/or memory will be a 16-bit operation—two bus cycles are required to fetch/store a 16-bit value. If the x bit in P is cleared, both index registers will be set to 16 bits. If used to index an address, e.g., LDA SOMEWHERE,X, the 16-bit value in the index register will be added to the base address to form the effective address. If the m bit in P is set the accumulator will return to being an 8-bit register and subsequent operations on the accumulator, with a few exceptions, will be 8-bit operations. The B-accumulator will retain the value it had when the accumulator was operating in 16-bit mode. The exceptions are the instructions that transfer the direct page register (D) and stack pointer (S) to/from the accumulator. These operations are always 16 bits wide in native mode, regardless of the condition of the m bit in the status register. If the x bit in P is set, not only will the index registers return to being 8 bits, whatever was in the MSB while in 16-bit mode will be lost, something an assembly language programmer cannot afford to forget.


Applications

Systems based on 65c816 variants: * Acorn Communicator *
Apple IIGS The Apple IIGS (styled as II), the fifth and most powerful of the Apple II family, is a 16-bit personal computer produced by Apple Computer. While featuring the Macintosh look and feel, and resolution and color similar to the Amiga and Atari ST ...
*
C-One The C-One is a single-board computer (SBC) created in 2002 as an enhanced version of the Commodore 64, a home computer popular in the 1980s. Designed by Jeri Ellsworth and Jens Schönfeld from Individual Computers, who manufactured the boards t ...
and SuperCPU enhancements for the Commodore 64 * Super Nintendo Entertainment System: the
console Console may refer to: Computing and video games * System console, a physical device to operate a computer ** Virtual console, a user interface for multiple computer consoles on one device ** Command-line interface, a method of interacting with ...
's
Ricoh 5A22 The Ricoh 5A22 is an 8/16-bit microprocessor produced by Ricoh for the Super Nintendo Entertainment System (SNES) video game console. It is based on the 8/16-bit Western Design Center, WDC WDC 65816, 65C816, which was developed between 1982 and ...
CPU is based on the 65c816. ** Additionally, 30+ Super NES games include the Nintendo SA1, a 65c816-based co-processor chip, in each cartridge.


See also

*
Interrupts in 65xx processors The 65xx family of microprocessors, consisting of the MOS Technology 6502 and its derivatives, the WDC 65C02, WDC 65C802 and WDC 65C816, and CSG 65CE02, all handle interrupts in a similar fashion. There are three hardware interrupt signals com ...


References


Citations


Bibliography

*


Further reading

*
65C816 Datasheet
'; Western Design Center; 55 pages; 2018.


External links


65C816 webpage
- Western Design Center



- zophar.net
A 6502 Programmer's Introduction to the 65816
– A ''Commodore World'' article by Brett Tabke; includes CMD's instruction set summary
Investigating 65C816 Interrupts
– An extensive discussion of interrupt processing on the 65C816 {{DEFAULTSORT:WDC 65816 65802 65xx microprocessors Computer-related introductions in 1983 16-bit microprocessors