MOS 6502
维基百科,自由的百科全书
MOS 6502是1975年由MOS Technology公司所研創的8位元微處理器。當年6502剛問世時是當時功效最強的CPU,且價格只有大型業者(如Motorola、Intel)相近產品的六分之一甚至更低,且除了Zilog公司的Z80外,6502幾乎快過多數業者的相近產品,進而激起一系列的的電腦專案[1],並在之後的1980年代帶來一場家用電腦的革命。MOS Technology公司僅授權允許兩家業者能相容研製6502,即是所謂的第二供貨源,此分別是洛克威爾國際公司(Rockwell International)與Synertek公司,更之後才有更多的業者獲得相容研製的授權,並仍持續在嵌入式系統的市場中供貨。
目录 |
[编辑] 以6502系列為cpu的設備
因為Apple II而廣為人知的中央處理器 後來俗稱紅白機的任天堂遊戲機也用上了, 及其後的超級任天堂也使用了65C816
[编辑] 6502的歷史與運用
The 6502 was designed primarily by the same engineering team that had designed the Motorola 6800. After quitting Motorola en masse, they quickly designed the 6501, a completely new processor that was pin-compatible with the 6800 (that is, it could be plugged into motherboards designed for the Motorola processor, although its instruction set was different). Motorola sued immediately, and although today the case would have been dismissed out of hand, MOS agreed to stop producing the 6501 and went back to the drawing board.
The result was the "lawsuit-compatible" 6502, which was by design unusable in a 6800 motherboard; Motorola, apparently no longer feeling threatened, did not object. However, this left MOS with the problem of getting new developers to try their processor, so engineer Chuck Peddle designed the KIM-1 single-board computer. Much to their surprise, the KIM-1 sold in huge numbers to hobbyists and tinkerers as well as to the engineers it was intended for. The related Rockwell AIM 65 control/training/development system also did well. Another roughly similar product was the Synertek SYM-1.
The 6502 was released in September 1975 at $25, when the 6800 and Intel 8080 were selling for $179. At first many people thought it was some sort of a scam, but shortly both Motorola and Intel had dropped their chips to $79. But instead of saving Intel and Motorola from the upstart MOS, the price reductions legitimized the 6502, which started selling by the hundreds.
One of the first "public" uses for the design was the Atari 2600 videogame console. The 2600 used an offshoot of the 6502 called the 6507, which had fewer pins and, as a result, could address only 8 KB of RAM. Millions of the Atari consoles would be sold, each with a MOS processor. The 6502 was next used in the Apple II family, and then appeared in various Commodore and Atari home computers, the BBC Micro family, and a huge number of other designs now lost to history such as Ohio Scientific. The 6510, a direct successor of the 6502 with a digital I/O port and a three-state bus, was the CPU utilized in the extremely popular Commodore 64 home computer. (Commodore's disk drive, the 1541, had a processor of its own—it too was a 6502.)
Another important use of the 6502 was in the Nintendo Famicom, a Japanese video game console. Its North American and European equivalent, the Nintendo Entertainment System, also used the processor. The 6502 used in the NES was a modified version, a partial system-on-a-chip, that lacked a binary-coded decimal mode but added 22 memory-mapped registers for sound generation, joypad reading, and sprite list DMA. Called 2A03 in NTSC consoles and 2A07 in PAL consoles (the difference being the clock divider ratio and a lookup table for audio sample rates), this processor was produced exclusively for Nintendo.
The efficient design of the 6502 also inspired the principal designers of the ARM RISC processor, and so the legacy of the 6502 may be said to transcend the original processor family. Its spirit lives on in the ARM design, which is used in several desktop computers as well as a plethora of handheld and other embedded systems and is sold as an IP block to be used in system-on-chip products.
[编辑] 描述
The 6502 is an 8-bit processor with a 16-bit address bus. The internal logic runs at the same speed as the external clock rate, but despite the slow clock speeds (typically in the neighborhood of 1 or 2 MHz), the 6502 was actually competitive with other CPUs using significantly faster clocks. This is partly due to a simplistic state machine implemented by combinatorial (clockless) logic to a greater extent than in many other designs; the two phase clock (supplying two syncronizations per cycle) can thereby control the whole machine-cycle directly. Like most simple CPUs of the era, the dynamic NMOS 6502 chip was not sequenced by a microcode ROM but nevertheless used a "small"* PLA for instruction decode and sequencing; and like most contemporary microprocessors, some execute/fetch overlap is done.
The low clock frequency moderated the speed requirement of memory and peripherals attached to the CPU as only about 50% of the clock cycle (this varied somewhat among chip versions) was available for memory access; critical at a time when (affordable) memory had access times in the range 450-250ns. The original NMOS 6502 was minimalisticly engineered and efficiently manufacured and therefore cheap; an important factor in getting design wins in the very price sensitive game console and home computer markets.Like its precursor, the Motorola 6800 (but unlike Intel 8080 and similar microprocessors) the 6502 has very few registers**. Inside was one 8-bit accumulator register (A), two 8-bit index registers (X and Y), an 8-bit processor status register (P), an 8-bit stack pointer (S), and a 16-bit program counter (PC). The subroutine call/scratchpad stack's address space was hardwired to memory page $01, i.e. the address range $0100–$01FF (256–511). Software access to the stack was done via four implied addressing mode instructions whose function were to push or pop (pull) the accumulator or the processor status register. The same stack was also used for subroutine calls via the JSR (Jump to Subroutine) and RTS (Return from Subroutine) instructions.
The chip used the index and stack registers effectively with several addressing modes, including a fast "direct page" or "zero page" mode that accessed memory locations from address 0 to 255 with a single 8-bit address (saving the cycle normally required to fetch the second byte of the address) – code for the 6502 used the zero page much as code for other processors would have used registers. In most 6502-based microcomputers with an operating system, the OS itself used almost the entire zero page, leaving perhaps a handful of locations for the user.
Addressing modes also included implied (1 byte instructions); absolute (3 bytes); indexed absolute (3 bytes); indexed zero-page (2 bytes); relative (2 bytes); accumulator (1); indirect,x and indirect,y (2); and immediate (2). Absolute mode was a general-purpose mode. Branch instructions uses a signed 8-bit offset to modify the program counter as it would appear if the branch were not taken (i.e. two bytes past the branch instruction itself); the numerical range -128..127 therefore translates to 126 bytes backwards and 129 bytes forward from the branch instruction. Accumulator mode used the accumulator as an effective address, and did not need any operand data. Immediate mode used an 8-bit literal operand.
The indirect modes were useful for array processing and other looping. With the 5/6 cycle "(indirect),y" mode, the 8-bit Y register was added to a 16-bit base address in zero page, located by a single byte following the opcode; incrementing Y in order to walk the array (byte wise) took only two additional cycles. The Y register was thus an index register in a true sense, and the 6502's specifications, saying 8-bit index registers***, may be taken literally; it is about 8-bit indexing, not 8-bit addressing. With the less frequently used "(indirect,x)" mode the effective address for the operation was found at the zero page address formed by adding the second byte of the instruction to the contents of the X register. Using the indexed modes, the zero page effectively acted as a set of 128 additional (though very slow) address registers.
See the Hello world! article for a simple but characteristic example of 6502 assembly language.
* About 15% of the chip area actually!
** The 6800 was designed around 1973 at a time when (small bipolar) memories was relatively fast. It therefore made sense to use RAM instead of wasting expensive NMOS chip area on CPU-registers (then a significant part of the CPU)
*** This is where the 6502 differs most from the Motorola 6800, which has one 16 bits address/index register instead of two eight bits index registers.
[编辑] 見仁見智的功效特點
- 6502s are almost notorious for having a variety of undocumented instructions, which vary from one chip manufacturer to the next. The 6502's instruction decoding is implemented in a hardwired logic array (similar to a programmable logic array) which is only defined for 151 of the 256 available opcodes. The remaining 105 trigger strange and hard-to-predict actions (like crashing the processor immediately; performing several valid instructions at once; or as far as has been discovered simply doing nothing at all). All of the undefined opcodes were eventually replaced by NOP instructions in the subsequent 65C02 CMOS version (although with varying byte sizes and execution times).
- The 6502's memory indirect jump instruction, JMP (<address low-word>), was broken. If <address low-word> was hex xxFF (i.e. any word ending in FF), the processor would not jump to the address stored in xxFF and xxFF+1, but rather the one in xxFF and xx00. The 6510 did not fix this bug, nor was it fixed in any of the other NMOS versions of the 6502 such as the 8502 and the 2A03. The CMOS 65C02 fixed it, as did various of the CMOS derivatives.
- Simultaneous appearance of NMI (non-maskable) and IRQ (maskable) interrupts caused the latter to be ignored.
- Three of the status flags (N - negative, V - overflow and Z - zero) were invalid after performing arithmetic operation in BCD mode. This was also fixed in CMOS derivatives.
[编辑] 6502的16位元衍生版
Synertek published a data sheet and application notes on the SY6516, a 16-bit derivative of the 6502, but the part was never introduced.
The Western Design Center designed and produced the 65816 processor, a 16-bit successor to the 65C02 as well as a hybrid offshoot called the 65802 which was a 65816 with a 64 KB address space in a 65(C)02 pin-compatible package.
Mitsubishi (now Renesas Technology) made a line of 16-bit microcontrollers with an architecture very similar to the 65816, though it was not 100% compatible.
[编辑] 執行加速
Many users of 1 MHz 6502-based systems soon wished their computers could go faster. A number of companies sold replacement hardware to speed up those systems. Generally, 6502 system accelerators were based on:
- 6502 or 65C02 chips running at a faster clock rate
- 65C816 chips in 6502 emulation mode, running at a much faster clock rate (up to 20 MHz)
- 4 MHz and 8 MHz Zip Chip processors, made by Zip Technology, and 10 MHz Rocket Chips, made by Bits and Pieces, all using onboard cache RAM and proprietary glue logic to speed up processing while remaining compatible with a 1 MHz motherboard. Zip Technology's patent #4,794,523 eventually forced Bits and Pieces to cease manufacturing of the Rocket Chip.
[编辑] 6502的瑣碎關連
- In the science fiction movie The Terminator (1984), starring Arnold Schwarzenegger, the audience at one point is treated to a view through the T-800 Model-101 robot character's eye/camera display with some 6502 assembly/machine code program fragments scrolling down the screen. Also shown is the output from a run of an Apple II checksum program called KEY PERFECT 4.0, published in Nibble magazine.
- Bender, a fictional android "industrial robot" manufactured in 2998 AD, and a main character in the animated TV series Futurama, was revealed to have a 6502 as his "brain", in the episode "Fry and the Slurm Factory."
- Even today, 31 years after the 6502's introduction, some Universities, including the University of Tasmania, the University of Applied Sciences in Cologne, Germany, and Hull University still use the processor to teach assembly language and computer architecture.
[编辑] 附註
- ^ - 請參見家用電腦分類列表(list of home computers by category,該份列表清楚顯示在市場上6502與Z80的對立、對峙態勢。
[编辑] 相關參見
- Lisa assembler(英文)(Lisa組譯器)
- List of home computers by category#MOS Technology 6502-based(英文)(家用電腦分類列表,MOS 6502類)
[编辑] 參考依據
- Bagnall, Brian (2005). On the Edge: The Spectacular Rise and Fall of Commodore. Variant Press. ISBN 0973864907.
- Leventhal, Lance A. (1986). 6502 Assembly Language Programming 2nd Edition. Osborne/McGraw-Hill. ISBN 007881216X.
- Leventhal, Lance A. (1982). 6502 Assembly Language Subroutines. Osborne/McGraw-Hill. ISBN 0931988594.
- Mansfield, Richard (1983). Machine Language For Beginners. Personal Computer Machine Language Programming For The Atari, VIC, Apple, Commodore 64, And PET/CBM Computers (or, Machine Language Programming For BASIC Language Programmers). Greensboro, North Carolina: Compute! Publications, Inc. Copyright © 1983, Small System Services, Inc. ISBN 0-942386-11-6.
- Zaks, Rodnay (1983). Programming the 6502 (Fourth Edition). Sybex, Inc. ISBN 0-89588-135-7.
- Zaks, Rodnay (1982). Advanced 6502 Programming. Sybex, Inc. ISBN 0-89588-089-X.
[编辑] 外部連結
- www.6502.org
- 6502 images and description at cpu-collection.de
- List of 6502 software emulators
- 6502 simulator for Windows
- Apple I Owners Club
- KIM-1 schematics
- Adding 64 user-defined opcodes to the 6502
- 6502 accelerator information (apple2history.org)
- 6502 acceleration article (C=Hacking)
- History of 6502 used by The Digital Group.
- DigiBarn Systems reference to The Digital Group Systems.
本文參考素材源自「FOLDOC」,在GFDL下授權。 This article was originally based on material from the Free On-line Dictionary of Computing and is used under the GFDL. |
MOS科技公司的65xx系列處理器,另有第二供貨源/翻製-{A|zh-cn:兼容;zh-tw:相容}-品的業者:西方設計中心公司 |
MOS 4510●MOS 6501●MOS 6502●WDC 65C02●Hudson HuC6280●Ricoh 2A03●MOS 6507●MOS 6508●MOS 6509 |
页面分类: 翻譯請求 | MOS科技公司的積體電路 | 65xx系列處理器 | 微處理器