MOS 6500 microprocessor

MOS 6502 microprocessor

MOS 6500 and Zilog Z80 were the most popular microprocessors for 8-bit microcomputer systems. 6500 is considered a predecessor of RISC since its instruction set was minimal.

6500 was essentially a reduced Motorola 6800. 6800 was more powerful, 6809 had 16-bit arithmetic with MUL/multiply instruction. 6500 instruction set was minimal. 6500 didn't have ADD instruction, rather, it had ADC (Add with Carry), so normal add was done by first executing CLC (Clear Carry). 6500 didn't have any form of multiply/divide instructions, multiply on 6502 required binary version of shift/add arithmetic (this author discovered by himself after being puzzled for weeks).

6500 registers:
A : accumulator (8-bit)
X : index (8-bit)
Y : index (8-bit)
PC/IP : program counter (16-bit)
P/SR : processor status register (conditions/flags) (8-bit)
S/SP : stack register (8-bit)

6500 had only 3 computational registers: A, X, Y. How these registers could be used was limited. A was the accumulator where results of operations were stored. X and Y were index registers.

Programming in 6500 assembly language required "spilling registers". Values in registers had to be continually moved to other registers or memory. Worse, register transfer instructions were limited, some register combinations had no transfer instruction, transfer had to be done indirectly.

  LDA LDX LDY
  STA STX STY
  TAX TAY
  TXA TYA

6500 had a variety of addressing modes: direct index, indirect index, zero page, etc. A 6500 "page" was 256 bytes. Stack was hard-wired at page #1 (100...1FF hex) which was indexed by 8-bit stack pointer.


Commodore VIC-20

Commodore VIC-20 Commodore VIC-20 13KB running
VIC-20 running with expanded memory (8KB memory cartridge).

Commodore VIC-20 was so limited it was practically useless. But with a VIC-20, a person could learn computer programming, get insights to how computer hardware functioned. Commodore provided an instruction book that fully documented hardware at register-level and encouraged users to experiment with its hardware. Controlling a TV with a VIC-20 was fun, done by directly POKEing hardware registers to change colors and play sounds.

VIC-20 memory could be expanded by 8KB or 16KB RAM cartridges, but these cartridges cost near or more than VIC-20 itself. Memory limitation motivated this author to switch from BASIC to FORTH. More complex programs could be written in FORTH, as FORTH programs were more compact and faster than BASIC.

VIC chip really didn't have a graphics mode. Rather, it always rendered characters. Graphics programming was accomplished by enabling multi-color mode, displaying 256 characters ("...ABCDEF..."), then redefining character definitions. 256 character definitions formed a bitmap, but since a VIC screen shows 506 (22*23) characters, bitmap only covered half the screen. If entire screen must show graphics, programmers had to set a raster interrupt to reprogram character set at middle of screen. Actually, most programs bitmapped part of screen, since bitmapping entire screen used ~4KB of VIC-20's 5KB total memory. Designers of VIC chip were clever by combining programmable fonts and graphics mode. But bit-level graphics was so difficult that many VIC-20 games were programmed in text-mode fashion, only redefined a few characters which jumped character-cell-by-character-cell.

VIC-20 was built ad-hoc. Jack Tramiel, to find a use for VIC chips and a surplus of SRAM chips, asked engineers to build a computer system based on these chips.


Commodore 128

Commodore 128

Commodore 128 was a multi-mode 3-in-1 system, a hydra having 2 different CPUs: 6502 and Z80. CPUs weren't able to run concurrently though. C64 mode was entered by typing GO64. CP/M mode was entered by booting from a CP/M floppy disk.

C128 introduced BASIC 7, a huge improvement. ~122KB was available for BASIC programs. BASIC 7 replaced arcane POKE numbers with high-level commands: GRAPHICS, DRAW, PLAY, etc, even text-mode windows.

C128 was capable of outputting to two displays. Editing a BASIC program could be done in 80-column display, while program output in graphics mode to 40-column display.

Here's a simple BASIC 7 program to draw a line in bit-map graphics mode and play music notes:

10 GRAPHIC 1,1
20 DRAW 1, 0,0 TO 319,199  # C128 is so slow, can see line being drawn pixel-by-pixel
30 PLAY "ABCDEF"
40 GETKEY W$
50 GRAPHIC 0
RUN

C128 had a switched-mode power supply that was better than the type of power supply C64 had (C64 power supplies notoriously ran hot and failed after ~2 years). 1571 disk drive was fast but only in C128 mode. C128 was expensive, besides Z80 CPU, mainboard contained C64 chips since new C128 chips weren't backwards-compatible. CP/M mode could've been omitted, since 1970s-era CP/M was nearly obsolete in 1985.

C128's 6502 and Z80 couldn't run concurrently, but sometimes both ran in a cooperative sequential way. In CP/M mode, 6502 was briefly enabled to run KERNAL routines which served as CP/M BIOS. Potentially, C128-specific software could've switched to Z80 for extra speed, after noticing that although 6502 was pipe-lined it continuously spilled its 3 registers to memory, Z80 had more registers plus a more powerful instruction set. But in practice, almost every software developer wrote for C64-compatibility, ignored C128's new capabilities.

Principle designer of C128 was Bil Herd who talks about its development, exposing dumb decisions by Commodore's management (post-Tramiel), such as trying to thwart the programmer who put improvements into BASIC 7 which became a selling feature.


Atari 800 vs Commodore 64

Atari 800 lid up
Commodore 64

Atari 800 was introduced in late 1979, Commodore 64 in mid 1982.

Atari 800 was faster, its 6502B ran at 1.7Mhz, C64's 6510 ran at 1.0Mhz. Atari 800 was internally expandable with multiple card slots (eliminated out of Atari XL/XE).

Atari's graphics had more colors, base colors plus luminance levels, with more graphics modes. Atari's ANTIC graphics chip was a coprocessor that executed "display lists" (similar to Amiga). Mixed graphics modes could be accomplished by writing "display list instructions" into RAM for ANTIC to execute.

Sprites was only area in graphics C64 was better. Atari's "player/missile" sprites had limitations in setting positions. C64's sprites could be set in any position and were larger. C64 had 8 sprites, but many more sprites could be displayed by reprogramming sprite registers before every sprite-high row of screen was displayed.

C64 stood out from other microcomputers by having a sound synthesizer chip named SID. By comparing ports of same games, C64's audio sounds nearly like real musical instruments, while Atari's audio sounds computerish.

Atari BASIC was far better (though C128's BASIC 7 became comparable), had Atari-specific commands, may have been faster. Atari had its own DOS, could boot into a useful notepad program. Commodore's 1541 disk drive was notorious for being glacially slow, instead of developing a DOS, Commodore hacked BASIC to send 1541 commands by strings.

Atari 6500 systems lasted long. This author saw an Atari at a business that was running continuously for >~15 years. Two C64 systems, often turned off, failed after ~1..~2 years.


other 6500 systems

Apple II, IIGS

A strength of Apple II was its internal expandability. A graphics card could be installed in an Apple II, whereas VIC-20 would forever have limited graphics. Apple II was surpassed in ~1980 by systems such as Atari 800. But then Apple leaped ahead in 1986 with Apple IIGS, surpassing Macintosh in having a color GUI, rivaling even Amiga. Incredibly, Apple itself sabotaged its own IIGS. Because IIGS could outperform Macintosh, Apple intentionally ran its 65816 CPU slower than its true speed.

Commodore Plus/4, C-16

Commodore Plus/4 flopped in late 1984's computer market. Commodore couldn't decide whether to build Plus/4 as a business computer or home computer; it had both office software and joystick ports. To buyers, it was neither. Businesses were buying IBM PCs, home users chose C-64s instead ($200 vs $300). Commodore's marketing had idiotic idea of offering buyers options for selecting software that a dealer would install as ROM chips. Commodore should've followed Jack Tramiel's original plan of building a $50 computer. (A picture shows Tramiel apparently holding a Plus/4 and 264 as if approving them, but those were prototypes, picture was taken in Jan 1984 day before he quit Commodore, Plus/4 went on sell at $~300 in Oct/Nov 1984.)

Until this time, Commodore had been able to sell new systems, despite being incompatible, as users wanted more advanced systems. But then C-64 had accumulated a huge software library that in itself became a selling feature. Commodore hadn't yet understood compatibility had become a requirement. Users would trade compatibility only if new system was far more advanced, but Plus/4 was a step backwards in many areas.

Plus/4 had ~128 colors, but didn't, couldn't, have sprites. Bil Herd explained color palette and sprite logic couldn't both fit in video chips Commodore/MOS was making. C-64 had its SID sound-synthesizer chip, but Plus/4's sound was less capable than VIC-20's. Plus/4's CPU ran at 1.7Mhz, but TED chip apparently stole cycles from CPU more frequently (?). For programming, a significant advantage was Plus/4's improved BASIC 3.5 and ML monitor. Plus/4 had a reset switch, and if RUN/STOP was pressed, it did a warm-reset, leaving a crashed program in memory.

C-16 was essentially a Plus/4 with 16KB RAM in a VIC-20 case minus office software ROMs. Intended to replace VIC-20, C-16 certainly was a better system. But C-16 was soon discontinued, one reason was price of C-64s had dropped.