litwr (litwr) wrote,
litwr
litwr

Emotional stories about processors for first computers: part 10 (MOS Technology 6502)

6502 and 65816



This is a processor with a very dramatic fate. No other processor can compare with it. Its appearance and introduction were accompanied by very large events in scope and consequences. I will list some of them:


  1. the weakening of the giant Motorola, which for some time exceeded the capabilities of Intel;

  2. the destruction of the independent company MOS Technology;

  3. cessation of development 6502 and its stagnation release with little or no modernization.


It all started with the fact that Motorola, for unknown reasons, refused to support the initiative of young engineers, offering to improve the overall rather mediocre processor 6800. They had to leave the company and continue their work in a small but promising company MOS Technology, where they soon prepared two processors (6501 and 6502) made by NMOS technology. The first one was pin-compatible with the 6800, but otherwise they were identical. The 6501/6502 team was able to successfully introduce a new chip production technology, which radically reduced the cost of new processors. In 1975, MOS Technology could offer 6502 for $25, while the starting price for the Intel 8080 and Motorola 6800 was $360 in 1974. In 1975, Motorola and Intel lowered prices, but they were still close to $100. MOS Technology specialists claimed that their processor is up to 4 times faster than 6800. I find this questionable: the 6502 can work much faster with memory, but the 6800's second accumulator greatly accelerated many calculations. Estimated I can assume that the 6502 was on average faster no more than 2 times. Motorola launched a lawsuit against its former employees – they allegedly used many of the company's technological secrets. During the trial, it was possible to establish that one of the engineers who had left Motorola took some confidential documents on the 6800, acting contrary to the attitudes of his colleagues. Whether it was his own act or there were still some guiding forces behind him is still unknown. For this and other unclear reasons, Motorola indirectly won the process and MOS Technology, whose financial capabilities were very small, was forced to pay a substantial amount of $200,000 and to abandon production of 6501. Intel in a similar situation with Zilog acted quite differently. Although it must be admitted that MOS Technology was sometimes too risky when trying to use the big money that Motorola spent on promoting the 6800 for its own purposes.

Further, the legendary Commodore firm and its no less legendary founder Jack Tramiel appear in the story, in the shadow of whom was the figure of the chief financier of the company determining its policy – a man named Irving Gould. Jack got a loan from Irving and with this money, using a few, to put it mildly, unscrupulous tactics, forced MOS Technology to become a part of the Commodore. After that, possibly against the wishes of Tramel, who was forced to give in to Gould, the development of the 6502 almost stopped, despite the fact that even in 1976 it was possible to produce prototypes of the 6502 with operating frequencies up to 10 MHz. Although the message about this appeared only many years later from a man named Bill Mensch (he was with the team that left Motorola), who sometimes made loud, but by and large empty statements and played a rather ambiguous role in the fate of 6502. The main developer of the 6502 Chuck Peddle was forever removed from the development of processors. 6502 continued to be produced not only at Commodore but also at the Western Design Center (WDC) created by Bill Mensch. It is fascinating that none of the former 6502 team worked with him in the future.

On this drama around the 6502 is not over. In 1980, a short, anonymous article appeared in Rockwell's AIM65 Interactive magazine stating that all 6502 carry a dangerous bug called the JMP (xxFF). The tone of the article suggests something completely out of the ordinary. Subsequently, this attitude moved to the position of Apple on this issue and became a kind of mainstream. Although a "bug" strictly speaking was not. Of course, a specialist accustomed to the comfortable processors of large systems of those years, one of the features that are quite relevant and even useful among microprocessors, could seem something annoying, a bug. But in fact, this hurting someone's feelings behavior was described in the official documentation from 1976 and in the textbooks on programming, published before the appearance of the mentioned article. The "bug" was eliminated by Bill Mensch, who made 65С02 (CMOS 6502) supposedly by 1983, i.e. after the release of 65816. While Intel, Motorola and others had already made 16-bit processors of new generations, the 6502 was only microscopically improved and made artificially partially incompatible with itself. In addition to eliminating the "bug," a number of changes were made, which, in particular, led to a change in the course of executing several instructions, which became slower in a tact, but at the same time they became more correct in some far-fetched academic sense. But, it must be admitted that several new instructions turned out to be expected and useful. On the other hand, the absolute majority of the new instructions only occupied the code space, adding almost nothing to the capabilities of the 6502, which left fewer new codes for possible further upgrades. Commodore and Japanese Ricoh (manufacturer of the very popular game consoles NES) did not accept these changes. The author of this material himself has encountered several times the problem of this “bug”. Knowing nothing about it, he was writing programs for the Commodores. There was an incompatibility, he had to change the codes, do a conditional assembly. The code for the 65C02 turned out to be more cumbersome and slower. Then I raised this question on the forum 6502.org, where some participants have connections to Apple's computers. I asked if anyone could give an example when the aforementioned "bug" crashed the program. I received only emotional and general comments, a specific example was never offered.



Bug!!!



65C02 was licensed to many firms, in particular, NCR, GTE, Rockwell, Synertek and Sanyo. 6512 is a 65C02 variant. It was used in later BBC Micro models. Atari used NMOS 6502. Firms Synertek and Rockwell, in addition to CMOS 6502, also produced NMOS 6502. By the way, NMOS 6502 has its own set of undocumented instructions, the nature of which is completely different from the "secret" commands of 8085. In 6502, these instructions appeared as a side effect of the technology used, so most of them are rather useless. But several instructions, for example, loading or unloading two registers with one command at once, and some others can make the code faster and more compact.

There were other attempts to modernize the 6502. In 1979, an article appeared that for the Atari computers, the 6509 processor is being prepared for production (not to be confused with the later Commodore's processor with the same name), in which command execution acceleration by 25% and many new instructions were expected. For unknown reasons, the production of this processor never took place. Commodore conducted only microscopic upgrades. There, in particular, they switched to HMOS technology and the manufacture of static cores, which allowed slowing down the processors. From the point of view of programming, the most interesting is the processor 6509, which, albeit in a very primitive form, with the help of only two instructions specially allocated for this purpose allows addressing up to 1 MB of memory. In the super-popular Commodores 64 and 128, there are 6510/8510 processors, and in the less successful 264 series – 7501/8501. These processors have 6 and 7 embedded I/O bit-ports, respectively, while 7501/8501 do not support non-masked interrupts. Rockwell produced version 65C02 with its extended by 32 bit operations (similar to the z80 bit instructions) instruction set. However, as far as I know, such processors were not used in computers, and these bit instructions themselves were more likely to be used only in embedded systems. BTW this extension was made by Bill Mensch.

The last scene of the drama with the participation of 6502 was designated in the prevention of computers based on 6502 with a frequency of 2 MHz on the US market in the first half of the 80s. This affected English BBC Micro, their manufacturing company Acorn made a large batch of computers for the United States, but as it turned out, in vain. Some kind of lock was triggered and the computers had to be urgently redone to European standards. Semi-American, but formally Canadian computers Commodore CBM II, despite some problems (in particular, compliance with the standards for electrical equipment), were nevertheless admitted. Perhaps due to the fact that they did not have graphic modes and even color text – even the stylish Porsche design could not compensate for this. The latest in the list of losers was the 100% American Apple III – it is known that Steve Jobs did a lot to prevent this computer from being successful. He demanded obviously impracticable specifications. Do we ever know his motives? Only in 1985, when the era of 8-bit technology began to go away, did the Commodore 128 appear. It could use in one of its modes 6502 at 2 MHz clock. But even here it turned out to be more of a joke since this mode was practically not supported and there are practically no programs for it. Only in the second half of the 80s in the United States began to produce accelerators for the Apple II and since 1988 the Apple IIc+ model with a 4 MHz processor. Why did it happen so? Perhaps because 6502 at 2 or 3 MHz (and these were already produced at the very beginning of the 80s) could successfully compete with systems based on Intel 8088 or Motorola 68000 on a number of tasks and especially games. In 1991, the willful decision of Commodore closed an interesting, albeit belated project C65 based on the 4510 processor with a frequency of 3.54 MHz. 4510 is the fastest 6502, made only in 1988, it finally carried out the previously mentioned optimization of cycles, which gave a 25% increase in speed. Thus, the processor in C65 is close in speed to 6502 systems at 4.5 MHz. Surprisingly, this fastest 6502 with an extended set of instructions (in some detail this extension turned out to be more convenient than in 65816) has never been used anywhere else.




Anti-advertising – multiple Porsche PETs in the apartments of the villain of The Jewel of the Nile – The Apple Only era in Hollywood had not yet come



Now a few words about the instruction system of 6502. The main feature of this processor is that it was made almost as fast as possible, with almost no extra clock cycles, which are especially numerous in the 8080/8085/z80/8088/68000 processors. In fact, it was the ideology later appeared under the direct influence of the 6502 processor RISC architecture. The same ideology dominates, starting with the Pentium series, and among Intel processors. In addition, the 6502 responded very quickly to interrupts, which made it very useful in some embedded systems. 6502 has one accumulator and two index registers, in addition, the first 256 bytes of memory can be used in dedicated commands either as faster memory or as a set of 16-bit registers (which are almost identical in their functionality to the BC and DE registers in 8080/z80) for pretty powerful ways to address. Some arithmetic commands (shifts, rotation, increment, and decrement) can be used with memory directly, without using registers. There are no 16-bit instructions – this is a 100% 8-bit processor. It supports all the basic flags but the parity flag which is typical only for the Intel's architecture. There is some more special flag of the low-useful decimal mode. Intel and Motorola processors use special corrective instructions for working with decimal numbers, and 6502 can switch to decimal mode, which makes its speed advantage with decimal numbers even more significant than with binary ones. Very impressive is the presence for 6502 table multiplication of 8-bit operands with a 16-bit result in less than 30 cycles, with an auxiliary table size of 2048 bytes. One of the slowest 6502 operations is a block memory copy. It can take more than 14 clocks per byte.

65816 was released by WDC in 1983. Interestingly, that some specifications of the new processor Bill Mensch received from Apple. Of course, this was a big step forward, but clearly belated and with large architectural flaws. 65816 was not considered by anyone as a competitor for the main processors of Intel or Motorola – it was already a minor outsider, which was already somehow set to further loss of positions. 65816 had two important advantages – it was relatively cheap and almost compatible with the still very popular 6502. In subsequent years, Bill Mensch didn’t even try to somehow improve his brainchild, do cycle optimization, replace the zero page addressing by extended using Z register (this was done in 4510), add at least multiplication, ... WDC only increased the limiting clock speeds, reaching 14 MHz by the mid-90s (this processor was used in the popular accelerator for the C64, SuperCPU, at a frequency of 20 MHz). However, even now (2018!) WDC offers 65816 for some reason only at the same 14 MHz. 65816 can use up to 16 MB of memory, but the addressing methods used for this look far from optimal. For example, index registers can be only 8- or 16-bit, the stack can be placed only in the first 64 KB of memory, only there you can use the convenient short addressing of the direct page (the generalization of zero page addressing), working with memory above 64 KB is comparatively awkward, ... The 65816 has a 16-bit ALU but an 8-bit data bus, so it is only about 50% faster than the 6502 with arithmetic operations. Nevertheless, 65816 was released in more than a billion. Indeed, the number of commands 65816 clearly completes the gaps in the 6502 architecture, for example, the commands for block copying memory in 7 clock cycles per byte.

65802 is another version of 65816, which uses a 16-bit address bus and compatible with the 6502 pin layout. An upgrade for Apple II based on this processor was offered, but slight acceleration with such an upgrade can only be obtained on specially written programs.

6502 was used in a large number of computer systems, the most popular of which are 8-bit Commodore, Atari, Apple, NES. It is interesting that 6502 was also used in the keyboard controller of Commodore Amiga. 65816 was used in the rather popular Apple IIgs computer, in the Super NES gaming console, and also in the rare Acorn Communicator computer.

In 1984, an article about a bad copy of an Apple ][ computer, Agat, made in the USSR appeared on the background of pictures with red banners, Lenin and marching soldiers in Byte magazine. This article cited a curious price for this computer – $ 17,000 (it was an absurd number, the real price was about 4000 rubles) and ironically indicated that Soviet manufacturers would have to dramatically lower the price if they want to sell their product in the West. Agat was used mainly in school education. Older Agat models were almost 100% compatible with Apple ][ and had some pretty useful extensions.

One can only try to fantasize about what would have happened if 6502 could develop at the same pace as its competitors. It seems to me that the gradual moving of zero-page memory to registers and the gradual expansion of the command system with simultaneous optimization of cycles would allow The Terminator 6502 to remain in the lead in terms of performance until the early 90's. Introducing 16-bit mode and then 32-bit would allow more memory and faster commands to be used. Would its competitors have been able to oppose this?

I would like to finish with some general philosophical arguments. Why was the 6502 slowed down and lacking a much brighter future? Perhaps due to the fact that it really could very much press large companies and create a completely new reality. Was the 6502 team set up for this? Rather, no, they just wanted to make a better processor.

Tags: 4510, 6501, 6502, 65816, 65c02, 6800, 68000, 8080, 8088, apple, atari, commodore, computer, cpu, hardware, history, intel, motorola, processor, zilog
Subscribe
  • Post a new comment

    Error

    default userpic
    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.
  • 0 comments