10

The VIC-20 used a 6522 VIA chip with a couple of 8-bit PIO ports, a couple of timers and a (buggy) shift register. (The bug in the shift register could be worked around with external hardware or in other ways.)

The Commodore 64 used what appears to be basically a new and improved version of the VIA, the 6526 CIA. This fixed the shift register bug, but the shift register went unused anyway because it had to be compatible with older diskette drives using the VIA. (See p.56, "The albatross of the C-64," in that article.)

The only other feature added by the 6526 appears to have been a time-of-day (TOD) clock. This presumably replaced other means of running the clock used for TIME$ in BASIC, but doesn't appear to have been particularly necessary, since it worked before.

Was there anything that the CIA offered over the VIA that was fairly essential to the operation of the C64, or could it reasonably have been designed with a VIA instead? Or in other words, what was the advantage of spending the money to design and use the CIA over the VIA in the C64?

1
  • 1
    The CIAs also replaced the two PIA chips that the Pet used. Not only that but, just because the disk interface didn't use the shift register doesn't mean nobody used it.
    – JeremyP
    Sep 20, 2019 at 9:07

1 Answer 1

8

Preface: Speculations of an alternate history are unfit for RC.SE, so this answer is restricted to fact checking.

TL;DR;

From a software (Kernal) PoV there is no reason for using a 6526, but there are two indicators from the hurried design case and business case: Volume. The new 652x family member (*1) was designated to be the base I/O chip for all upcoming machines needing the most complex functions. Thus it will most certainly fit whatever will come up during design with little chance for reselection need, which would cost time not available (*2).

In addition, it was available and as designated part, using it as often as possible will decrease per unit cost and increase profit - over all, not just the meagre C64 run (as planned).


6522 VIA chip with [...] a (broken) shift register. (The bug in the shift register could be worked around with external hardware.)

The Shift register is not broken per se. There are many applications using it without any issue - for example the SPI implementation of the Steckschwein.

This fixed the shift register bug, but the shift register went unused anyway because it had to be compatible with older diskette drives using the VIA.

That may be s light misinterpretation here. Compatibility with the VIC 20 was regarding speed, not used hardware er se. The Floppy doesn't care what device creates the serial signal. Using Port A of CIA2 is a direct result of using the VIC20 Kernal with as little changes as possible.


At that point it's, as so often when it comes to the C64 design, quite important to keep in mind, that it was designed in a great hurry, meant to be a stop gap measure against the imagined 64 KiB Atari. Development speed was the only goal here. In hardware and software. So new chips like the 6526 were used, and use of their features may have been intended, but it got all pushed back to make it for the 1982 Winter CES. To cut on software development time, the use of the VIC-20 Kernal was decided, with as little modifications as possible. As a result several of the advanced features full memory use for of the C64 were not or only barely supported.

This wasn't so much seen as a problem, as for one, the C64 was meant to be a only available for a short time, but more important, the engineers planned to add a better adapted Kernal/BASIC (*2) soon after ... which in typical Tramiel style got cut out to save the investment. After all, it got sold, so why invest more than the bare minimum?


So it wasn't a general VIC-20 compatibility issue, and especially not the floppy, but rather the result of using the VIC-20 Kernal.

The Commodore 64 used what appears to be basically a new and improved version of the VIA, the 6526 CIA.

That was the intention. Creating an improved 6522 - most notably the steamlined handshake mode, intended to simplify an IEEE-488 style interface as well. The 6526 was meant to replace the 6522 on all future designs.

The only other feature added by the 6526 appears to have been a time-of-day (TOD) clock. This did allow them to add the TIME$ function to BASIC, giving the time since power-up/reset (or any other time the programmer cared to set it to),

TI and TI$ have been with Commodore BASIC since the very first PET. Since VIC-20 times even as stable Kernal call ($FFDB/SETIM & $FFDE/RETIM).

More important here, the C64 BASIC/Kernal (original BASIC 2.0) didn't use the TOD clock(s) at all. The Jiffy Clock ($A0/1/2) was driven by an interrupt issued by CIA1 60 times a second. Using the TOD funcionality would have improved handling a lot by removing all lag.

Like the not-use of the serial register it's a direct result of the hurried adaption of the VIC-20 BASIC 2.0 for the C64 (See before).

but I don't know how much TOD clock was ever used, from either BASIC or machine language.

Many useful (aka non game) offered it to handle time and date. Though, most using the Jiffy Clock.

(This could have perhaps have been emulated to some degree in software, such as by using VIA timer or video interrupts, though a hardware change routing one of these to NMI would have been needed to avoid loss of time should interrupts be disabled for too long.)

As said, TI($) was based on such a clock, driven by IRQ and notorious lagging depending on Video/Interrupt use.

Was there anything that the CIA offered over the VIA that was fairly essential to the operation of the C64,

Nop. At least not the way the Kernal was made.

or could it reasonably have been designed with a VIA instead?

The way it was delivered yes, for what was planned: no.

Or in other words, what was the advantage of spending the money to design

The CIA was designed independently of the C64. No chip was designed for the C64. The whole C64 design was made up from components already available before. See above, it was a quick solution to a marketing problem, not a planned development

and use the CIA over the VIA in the C64?

Simply the combination of availability and using the most capable chip to avoid short comings and possible redesign, all geared toward making it in time.


*1 - It was a whole group of chips modelled as 6522 follow up so serve various purpose, like 6523/25 TPI, 6526 CIA, 6529 SPI or variations of these building block like 8520 CIA or 7360 TED.

*2 - That case changed with the 264 series, weras the TED did include the most complex functions in one chip, so a more simple TPI could be used to extend available ports - also, being less time pressured helped as well

*3 - BASIC 3.5 delivered for the TED machines what what was intended for the C65. Native TOD support, BASIC commands for graphics, sound and input (joysick) and quite important, memory management to allow use of all RAM for BASIC.

16
  • 1
    To add another to the pile of successful users of the 6522 shift register: the pre-ADB Macintosh uses it for serial keyboard communications. It even lets the keyboard run the clock, which is exactly the case that can trigger its race condition bug. But communications are relatively rare — routinely once per frame, plus the number of key events it discovers, each as an individual byte out and then a byte in — and the OS has a retry mechanism, so everything works fine. I don't recall anybody ever complaining about dropped keypresses on that era of Macs.
    – Tommy
    Sep 20, 2019 at 14:27
  • 1
    Thanks for explaining that TIME$ was there before; I've updated the question to take this into account. I've also noted that there were other means besides the Wilson one to work around the SIO bug, though I have to say that the Steckschwein folks don't seem entirely confident in their solution. ("We rather rely on the fact, that we create the SPI clock using the processor and hereby have the SPI clock locked to the system clock, so the signal slopes have a fixed delay. This should take care of the bug not to occur. Hopefully.")
    – cjs
    Sep 20, 2019 at 14:40
  • 1
    @Raffzahn I'm surprised by your phrase "No chip was designed for the C64. The whole C64 design was made up from components already available before." For example, on the documentary "The Commodore wars" it is seems clear that SID and VIC2 were designed for the C64. Do you have sources to share? Sep 20, 2019 at 19:14
  • 1
    @ValentinoMiazzo To start with, check the article Curt cites. It states that the VIC II design was started in January 1981, designated for a planed but never made state of the art gaming system. Similar the SID design was started in June 1981 by Bob Yannes, for the same system. The decision to use them in a desisign for a 64 KiB computer was made by Tramiel in November 1981, as he expected Atari to present a 64 KiB computer. ...
    – Raffzahn
    Sep 20, 2019 at 20:05
  • 1
    @ValentinoMiazzo ... The first to come, in mid 1982 was the PET-II series, as the professional market was seen as more important (basically the same misconception Apple did 20 years later with the Newton 2000). The new home computer family was planned for Christmas 1982. Except, all of that was canceled when Tramiel learned that a half finished machine like the C64 could outsell everything his engineers proposed for way more sophisticated machines, which woudl cost a lot more investment. The result was clear Tramiel logic: Stop everything els and crank out C64 as many as possible.
    – Raffzahn
    Sep 20, 2019 at 20:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .