Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

WDC 65C816: Difference between revisions

Content deleted Content added
making it possible for a user text-searching the page for "65802" to find the info on the WDC65C802
 
(33 intermediate revisions by 19 users not shown)
Line 15:
* 8 (external)
* 16 (internal)}}
|address-width = 24 bits
|pack1 = 40-pin [[Dual in-line package|DIP]]
|pack2 = 44-pin [[Plastic leaded chip carrier|PLCC]], others
|variant = {{plainlist|
* W65C802 (pin-compatible with W65C02)
* W65C265 (MCU)}}
|predecessor = {{plainlist|
* MOS 6502
* [[WDC 65C02]]}}
|successor = WDC 65C832<ref>{{Cite web |last=Mensch |first=William D. |title=A Report on the 65c832 |url=https://mirrors.apple2.org.za/apple2.caltech.edu/miscinfo/65xxx.chronology |url-status=live |archive-url=https://web.archive.org/web/20240407125418/https://mirrors.apple2.org.za/apple2.caltech.edu/miscinfo/65xxx.chronology | archive-date=7 Apr 2024 |access-date=7 Apr 2024}}</ref><ref>{{Cite web |date=6 Sep 2010 |orig-date=Mar 1990 |title=W65C832 Information, Specification, and Data Sheet (March 1990) |url=https://downloads.reactivemicro.com/Electronics/CPU/W65C832%20CPU%20Datasheet%20v2.0.pdf |url-status=live |archive-url=https://web.archive.org/web/20240407125548/https://downloads.reactivemicro.com/Electronics/CPU/W65C832%20CPU%20Datasheet%20v2.0.pdf |archive-date= 7 Apr 2024 |access-date=7 Apr 2024 |website=ReActive Micro }}</ref><ref>{{Cite web |orig-date=Mar 1991 |title=W65C832 Information, Specification, and Data Sheet |url=http://6502.org/documents/datasheets/wdc/wdc_w65c832_preliminary_mar_1991.pdf |url-status=dead |archive-url=https://web.archive.org/web/20230630173006/http://archive.6502.org/datasheets/wdc_w65c832_preliminary_mar_1991.pdf |archive-date=30 Jun 2023 |access-date=7 Apr 2024 |website=6502.org }}</ref> (never released)
|successor =
}}
 
The '''W65C816S''' (also '''65C816''' or '''65816''') is a 16-bit [[microprocessor]] (MPU) developed and sold by the [[Western Design Center]] (WDC). Introduced in 1983,<ref>[https://web.archive.org/web/20100206192831/http://processortimeline.info/proc1980.htm Chronology of Microprocessors (1980–1989)]</ref> the W65C816S is an enhanced version of the [[WDC 65C02]] [[8-bit computing|8-bit]] MPU, itself a [[CMOS]] enhancement of the venerable [[MOS Technology]] [[MOS Technology 6502|6502]] [[NMOS logic|NMOS]] MPU. The 65C816 is the CPU for the [[Apple IIGS]] 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 computing|16-bit]] [[processor register|register]] sizes. In addition to the availability of 16-bit registers, the W65C816S extends [[memory address]]ing to [[24-bit computing|24 bit]]s, supporting up to 16 [[megabyte]]s of [[random-access memory]]. It has an enhanced instruction set and a 16-bit [[StackCall (data structure)stack|stack pointer]], as well as several new electrical signals for improved system hardware management.
 
At [[reset (computing)|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]] with most 65C02 software. However, unlike the [[PDIP|PDIP40]] version of the 65C02, which is a [[pin-compatible]] replacement for its NMOS ancestor, the PDIP40 W65C816S is not pin-compatible with any other 6502 family MPU.
Line 40 ⟶ 43:
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&nbsp;KB of external memory.{{sfn|Eyes|Lichty|1986|p=45}} 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]] computer. The basic 65C816 design was [[second source|second-sourced]] by [[VLSI Technology]],<ref name="vti_65816">{{ cite book | url=https://archive.org/details/1988vlsidatabookocrbm/page/n263/mode/2up | title=Application Specific Logic Products Data Book 1988 | publisher=VLSI Technology Inc. | date=1988 | access-date=18 March 2024 | pages=257–279 }}</ref> [[GTE]], [[Sanyo]] 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]], which made it possible to completely stop the [[clock signal|processor's Ø2 clock]] without loss of register contents. This feature, along with the use of [[static RAM|asynchronous static RAM]], made it possible to produce designs that used minimal power when in a standby state.
 
{{As of|April 2024}}, the W65C816S is available from WDC in 40 pin [[PDIP]], [[plastic leaded chip carrier|PLCC44]], or 44-pin [[Quad flat package#PQFP|TQFP]] packaging, as an [[microcontroller|MCU]] through the W65C265,<ref>{{Cite web |date=5 Jan 2021 |title=W65C265S 16-bit Microcontroller |url=https://www.westerndesigncenter.com/wdc/w65c265s-chip.php |url-status=live |archive-url=https://web.archive.org/web/20240402205917/https://www.westerndesigncenter.com/wdc/w65c265s-chip.php |archive-date=2 Apr 2024 |access-date=7 Apr 2024 |website=The Western Design Center, Inc.}}</ref> and as IP cores for [[Application-specific integrated circuit|ASIC]] integration<ref>{{Cite web |date=5 Jan 2021 |title=W65C816 8/16-bit Microprocessor |url=https://www.westerndesigncenter.com/wdc/w65c816s-core.php |url-status=live |archive-url=https://web.archive.org/web/20231115050721/https://www.westerndesigncenter.com/wdc/w65c816s-core.php |archive-date=15 Nov 2023 |access-date=7 Apr 2024 |website=The Western Design Center, Inc.}}</ref><ref>{{Cite web |date=5 Jan 2021 |title=W65C265S 8/16-bit Microcontroller |url=https://www.westerndesigncenter.com/wdc/w65c265s-core.php |url-status=live |archive-url=https://web.archive.org/web/20240407131630/https://www.westerndesigncenter.com/wdc/w65c265s-core.php |archive-date=7 Apr 2024 |access-date=7 Apr 2024 |website=The Western Design Center, Inc.}}</ref> (for example [[Winbond]]'s W55V9x series of TV [[Edutainment]] [[integrated circuit|IC]]s<ref>{{Cite web |date=2 May 2006 |title=W55V92 TV-toy Controller Data Sheet |url=https://static6.arrow.com/aropdfconversion/5557b1c0d4895012527b1add354b861f938e4daa/w55v92a1.7.pdf |access-date=12 June 2024 |website=Arrow Electronics}}</ref>).
{{As of|2023}}, the W65C816S is available from WDC in 40 pin [[PDIP]], [[plastic leaded chip carrier|PLCC44]], or 44-pin [[Quad_flat_package#PQFP|TQFP]] packaging, as well as a core for [[Application-specific integrated circuit|ASIC]] integration (for example [[Winbond]]'s W55V9x series of TV [[Edutainment]] [[integrated circuit|IC]]s). WDC, itself a [[fabless semiconductor company]], works with various [[semiconductor fabrication plant|foundries]] 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 [[Application-specific integrated circuit|ASIC]], WDC offers RTL ([[register-transfer level]]) code in [[Verilog]].
 
[[File:WDC W65C802P 4 1.jpg|thumb|W65C802P]]
Line 108 ⟶ 111:
| style="text-align:center; background:white"| 0
| colspan="16" style="text-align:center; background:silver" | '''DP'''
| style="background:white; color:black;"| [[Zero_pageZero page#Computers_with_few_CPU_registersComputers with few CPU registers|'''D'''irect '''P'''age pointer]]
|- style="background:silver;color:black"
| style="text-align:center; background:white"| 0
Line 155 ⟶ 158:
| style="text-align:center;"| '''z'''
| style="text-align:center;"| '''c'''
| style="background:white; color:black" | [[Status register|'''SP'''tatusrogram '''R'''egisterstatus register]]
|- style="background:silver;color:black"
| style="text-align:center; background:white" colspan="23" |
| style="text-align:center;"| '''e'''
| style="background:white; color:black" | '''SP'''tatusrogram '''R'''egisterstatus register [[WDC_65C816WDC 65C816#Switching_between_modesSwitching between modes|mode flag]]
|}
|}
Line 166 ⟶ 169:
* Fully static [[CMOS]] design offers low power consumption (300&nbsp;[[micro-|µ]][[amperes|A]] at 1&nbsp;[[megahertz|MHz]]) and increased noise immunity.
* Wide operating [[voltage]] range: 1.8&nbsp;V to 5.0&nbsp;V ± 5%.
* Wide [[clock rate|operating frequency]] range, officially 14&nbsp;MHz maximum at 5 volts (20Mhz in [[SuperCPU]]), using a single-phase clock source (hobbyists have successfully operated the 65C816 well beyond 20&nbsp;MHz).
* Emulation mode allows substantial software compatibility with the NMOS 6502 and CMOS 65C02, excepting undocumented [[opcode]]s. All 256 opcodes in the 65C816 are functional in both operating modes.
* 24-bit memory addressing provides access to 16&nbsp;MB of [[Memory space (computational resource)|memory space]].
Line 183 ⟶ 186:
 
==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.{{sfn|Eyes|Lichty|1986|p=42}}
 
 
===16-bit registers===
Line 194 ⟶ 195:
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 (<code>A</code>), the <code>X</code> and <code>Y</code> [[index register]]s, and the [[stack pointer]] (<code>SP</code>). It does not affect the [[program counter]] (<code>PC</code>), which has always been 16-bit.{{sfn|Eyes|Lichty|1986|p=46}}
 
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 (<code>b</code>) flag. In native mode, bit 4 becomes the <code>x</code> flag and bit 5 becomes the <code>m</code> flag. These bits control whether or not the [[index register]]s (<code>x</code>) and/or accumulator/memory (<code>m</code>) are 8-bit or 16-bit in size. Zeros in these bits set 16-bit sizes, ones set 8-bit sizes. These bits are locked at ones when the processor is powered on or reset, but become changeable when the processor is switched to native mode.{{sfn|Eyes|Lichty|1986|p=46}}
 
In native mode operation, the accumulator and index registers may be set to 16- or 8-bit sizes at the programmer’s discretion by using the <code>REP</code> and <code>SEP</code> instructions to manipulate the <code>m</code> and <code>x</code> status register bits. This feature gives the programmer the ability to perform operations on either word- and byte-size data. As the accumulator and index register sizes are independently settable, it is possible, for example, to have the accumulator set to eight bits and the index registers set to 16 bits, giving the programmer the ability to manipulate individual bytes over a 64KB range without having to perform pointer arithmetic.
Line 216 ⟶ 217:
Internally, the 65c816 is a fully 16-bit design. The <code>m</code> and <code>x</code> bits in <code>SR</code> 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 <code>m</code> and <code>x</code> are locked to <code>1</code>. Hence the registers are locked to eight-bit size. The most significant byte (MSB) of the accumulator (the <code>B</code>-accumulator) is not directly accessible but can be swapped with the least significant byte (LSB) of the accumulator (the <code>A</code>-accumulator) by using the <code>XBA</code> instruction. There is no corresponding operation for the index registers (<code>X</code> and <code>Y</code>), whose MSBs are locked at <code>$00</code>.
 
Upon being switched to native mode, the MSB of <code>X</code> and <code>Y</code> will be zero, and the <code>B</code>-accumulator will be unchanged. If the <code>m</code> bit in <code>SR</code> is cleared, the <code>B</code>-accumulator will be “ganged”"ganged" to the <code>A</code>-accumulator to form a 16-bit register (called the <code>C</code>-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 <code>x</code> bit in <code>SR</code> is cleared, both index registers will be set to 16 bits. If used to index an address, e.g., <code>LDA SOMEWHERE,X</code>, the 16-bit value in the index register will be added to the base address to form the effective address.
 
If the <code>m</code> bit in <code>SR</code> 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 <code>B</code>-accumulator will retain the value it had when the accumulator was operatingset into 16-bit modebits. The exceptions are the instructions that transfer the direct page register (<code>DP</code>) and stack pointer (<code>SP</code>) to/from the accumulator. These operations are always 16- bits wide in native mode, regardless of the condition of the <code>m</code> bit in <code>SR</code>.
 
If the <code>x</code> bit in <code>SR</code> is set, not only will the index registers return to being 8 bits, whatever was in the MSB while they were 16- bits wide will be lost, something an assembly language programmer cannot afford to forget.{{sfn|Eyes|Lichty|1986|p=51}}
 
==Applications==
Line 233 ⟶ 234:
* [[Super Nintendo Entertainment System]]: the [[video game console|console]]'s [[Ricoh 5A22]] CPU is based on the 65c816.
** Additionally, 30+ Super NES games include the [[Nintendo SA-1|Nintendo SA1]], a 65c816-based co-processor chip, in each cartridge.
* C256 Foenix's Retro Systems C256 U/U+ model<ref>{{cite web |url=https://c256foenix.com/16bits-new-retro-computers/?v=7516fd43adaa |title=16bits CPU – New Retro Computers |website=Foenix Retro Systems}}</ref> and F256K model<ref>{{cite web |url=https://c256foenix.com/f256k/?v=7516fd43adaa |title=F256K |website=Foenix Retro Systems}}</ref>
 
==See also==
Line 248 ⟶ 249:
{{See also|MOS Technology 6502#Further reading|l1=List of books about 65xx microprocessor families}}
* ''[http://www.westerndesigncenter.com/wdc/documentation/w65c816s.pdf 65C816 Datasheet]''; Western Design Center; 55 pages; 2018.
* Eyes, David and Ron Lichty; ''Programming the 65816: Including the 6502, 65C02, and 65802''; Brady Publishing; 636 pg; 2015
* Fischer, Michael; ''65816/65802 assembly language programming''; Osborne/McGraw-Hill; 686 pg; 1986
 
==External links==
Line 254 ⟶ 257:
* [http://www.zophar.net/tech/65816.html 65816/65C816 Technical Documents] - zophar.net
* [http://www.defence-force.org/computing/oric/coding/annexe_2/ A 6502 Programmer's Introduction to the 65816] &ndash; A ''Commodore World'' article by Brett Tabke; includes [[Creative Micro Designs|CMD]]'s instruction set summary
* [http://sbc.bcstechnologysteggy.net/65c816interrupts.html Investigating 65C816 Interrupts] &ndash; An extensive discussion of interrupt processing on the 65C816
<!--- *[http://www.winbond-usa.com/mambo/content/view/286/523/#ProductSelectionGuide Winbond TV Edutainment IC Selection Guide] &ndash; ICs with 65816 CPU core --->