MOS Technology CIA

Last updated
Pin configuration of the 6526 CIA 6526 CIA Pinout.svg
Pin configuration of the 6526 CIA
Early 6526 CIA were still in costly ceramic package with gold contacts. Later versions were produced in cheaper plastic package. MOS 6526 2983 top.jpg
Early 6526 CIA were still in costly ceramic package with gold contacts. Later versions were produced in cheaper plastic package.
CIA MOS 6526A in plastic package CIA MOS 6526A.jpg
CIA MOS 6526A in plastic package
MOS 8520A in an Amiga 1000 Commodore Amiga 1000 - main board - MOS 8520A-1-7820.jpg
MOS 8520A in an Amiga 1000

The 6526/8520 Complex Interface Adapter (CIA) was an integrated circuit made by MOS Technology. It served as an I/O port controller for the 6502 family of microprocessors, providing for parallel and serial I/O capabilities as well as timers and a Time-of-Day (TOD) clock. The device's most prominent use was in the Commodore 64 and Commodore 128(D), each of which included two CIA chips. The Commodore 1570 and Commodore 1571 floppy disk drives contained one CIA each. Furthermore, the Amiga home computers and the Commodore 1581 floppy disk drive employed a modified variant of the CIA circuit called 8520. 8520 is functionally equivalent to the 6526 except for the simplified TOD circuitry. Predecessor to CIA was PIA.

Contents

Parallel I/O

The CIA had two 8-bit bidirectional parallel I/O ports. Each port had a corresponding Data Direction Register, which allowed each data line to be individually set to input or output mode. A read of these ports always returned the status of the individual lines, regardless of the data direction that had been set.

Serial I/O

An internal bidirectional 8-bit shift register enabled the CIA to handle serial I/O. The chip could accept serial input clocked from an external source, and could send serial output clocked with one of the built-in programmable timers. An interrupt was generated whenever an 8-bit serial transfer had completed. It was possible to implement a simple "network" by connecting the shift register and clock outputs of several computers together. The maximum bitrate is 500 kbit/s for the 2 MHz version.

The CIA incorporates a fix to a bug in the serial-shift register in the earlier 6522 VIA. The CIA was originally intended to allow fast communication with a disk drive, but in the end couldn't be used because of a desire to keep disk drive compatibility with the VIC-20; in practice the firmware of 1541 drive had to be made even slower than its VIC-20 predecessor to workaround a behaviour of the C64's video processor, that, when drawing the screen, turned off the CPU for 40 microseconds every 512 microseconds and in that timeslice can't listen to the bus, risking to miss some bit . [1] [2]

Interval timers

Two programmable interval timers were available, each with sub-microsecond precision. Each timer consisted of a 16-bit read-only presettable down counter and a corresponding 16-bit write-only latch. Whenever a timer was started, the timer's latch was automatically copied into its counter, and the counter would then decrement with each clock cycle until underflow, at which an interrupt would be generated if the CIA was configured to do so.

The timer could run in either "one-shot" mode, halting after underflowing, or "continuous" mode, reloading the latch value and starting the timer cycle anew. In addition to generating interrupts, the timer output could also be gated to the second I/O port.

As configured in the Commodore 64 and Commodore 128, the CIA's timing was controlled by the Ø2 system clock, nominally one MHz. This meant that the timers decremented at approximately one microsecond intervals, the exact time period being determined by whether the system used the NTSC or PAL video standard. In the C-128, clock stretching was employed so the CIA's timing was unaffected by whether the system was running in SLOW or FAST mode.

It was possible to generate relatively long timing intervals by programming timer B to count timer A underflows. If both timers were loaded with the maximum interval value of 65,535, a timing interval of one hour, 11 minutes, 34 seconds would result.

Time-of-Day (TOD) Clock

A real-time clock is incorporated in the CIA, providing a timekeeping device more conducive to human needs than the microsecond precision of the interval timers. Time is kept in the American 12-hour AM/PM format. The TOD clock consists of four read/write registers: hours (with bit 7 acting as the AM/PM flag), minutes, seconds and tenths of a second. All registers read out in BCD format, thus simplifying the encoding/decoding process.

Reading from the registers will always return the time of day. In order to avoid a carry error while fetching the time, reading the hours register will immediately halt register updating, with no effect on internal timekeeping accuracy. Once the tenths register has been read, updating will resume. It is possible to read any register other than the hours register "on the fly," making the use of a running TOD clock as a timer a practical application. If the hours register is read, however, it is essential to subsequently read the tenths register. Otherwise, all TOD registers will remain "frozen."

Setting the time involves writing the appropriate BCD values into the registers. A write access to the hours register will completely halt the clock. The clock will not start again until a value has been written into the tenths register. Owing to the order in which the registers appear in the system's memory map, a simple loop is all that is required to write the registers in the correct order. It is permissible to write to only the tenths register to "nudge" the clock into action, in which following a hardware reset, the clock will start at 1:00:00.0.

In addition to its timekeeping features, the TOD can be configured to act as an alarm clock, by arranging for it to generate an interrupt request at any desired time. Due to a bug in many 6526s (see also errata below), the alarm IRQ would not always occur when the seconds component of the alarm time is exactly zero. The workaround is to set the alarm's tenths value to 0.1 seconds.

The TOD clock's internal circuitry is designed to be driven by either a 50 or 60 Hz sine wave signal. As used in the C-64 and C-128(D), the computer's power supply supplied such a signal from the mains, resulting in a stable timekeeper with little long-term drift. The ability to work with both power line frequencies allowed a single version of the 6526 to be used in computers operated in countries with either 50 or 60 Hz power. It is important to note that contrary to the popular belief, NTSC or PAL video standards are not directly linked to mains power frequency. Additionally, some computers did not derive their TOD clock frequency from the mains power source. For example, both NTSC and PAL variants of Commodore SX-64 use 60 Hz TOD clock supplied by a dedicated crystal. KERNAL operating system in Commodore 64 for example will determine the video standard during system startup, but tries neither to identify the supplied TOD clock frequency nor to initialise the CIAs correctly on 50 Hz driven machines. Thus, it is the responsibility of any application software that wants to use either CIA's TOD function to determine the supplied frequency and set the CIA(s) flag accordingly itself. Failure to do so may cause the clock to deviate quickly from the correct time.

The 8520 revision of the CIA, as used in the Amiga and the Commodore 1581 disk drive, modified the time-of-day clock to be a 24-bit binary counter, replacing the BCD format of the 6526. Other behavior was similar, however.

Versions

The CIA was available in 1 MHz (6526), 2 MHz (6526A) and 3 MHz (6526B) versions. The package was a JEDEC-standard 40-pin ceramic or plastic DIP. The 8520 CIA, with its modified time-of-day clock, was used in the Amiga computers.

Commodore embedded reduced (just 4 registers) CIA-like logic for the cost reduced Commodore 1571 inside the C128DCR (See Commodore 128) in a gate array called 5710 which also contains other functions. The 5710 CIA has the serial clock for the fast serial interface hardwired to a CIA6526 equivalent Timer A value of 5, leading to a per-bit time of 5μs on transmission. This is different from what used to be a Timer A value of 6 in the 6526 CIA in the original Commodore 1571. The 5710 CIA does not contain timer or timer control registers. It only contains two port registers and the register to control the serial shifter and its event.

Errata

In addition to the aforementioned alarm clock interrupt bug, many CIAs exhibited a defect in which the part would fail to generate a timer B hardware interrupt if the interrupt control register (ICR) was read one or two clock cycles before the time when the interrupt should have actually occurred. This defect, as well as logic errors in the Commodore provided (8 bit) operating system, caused frequent pseudo-RS-232 errors in the Commodore 64 and Commodore 128 computers when running at higher baud rates.

Related Research Articles

<span class="mw-page-title-main">Amiga 500</span> Personal computer by Commodore

The Amiga 500, also known as the A500, was the first popular version of the Amiga home computer, "redefining the home computer market and making so-called luxury features such as multitasking and colour a standard long before Microsoft or Apple sold these to the masses". It contains the same Motorola 68000 as the Amiga 1000, as well as the same graphics and sound coprocessors, but is in a smaller case similar to that of the Commodore 128.

<span class="mw-page-title-main">Commodore 64</span> 8-bit home computer introduced in 1982

The Commodore 64, also known as the C64, is an 8-bit home computer introduced in January 1982 by Commodore International. It has been listed in the Guinness World Records as the highest-selling single computer model of all time, with independent estimates placing the number sold between 12.5 and 17 million units. Volume production started in early 1982, marketing in August for US$595. Preceded by the VIC-20 and Commodore PET, the C64 took its name from its 64 kilobytes(65,536 bytes) of RAM. With support for multicolor sprites and a custom chip for waveform generation, the C64 could create superior visuals and audio compared to systems without such custom hardware.

<span class="mw-page-title-main">Commodore 1571</span> Floppy disk drive

The Commodore 1571 is Commodore's high-end 5¼" floppy disk drive, announced in the summer of 1985. With its double-sided drive mechanism, it has the ability to use double-sided, double-density (DS/DD) floppy disks, storing a total of 360 kB per floppy. It also implemented a "burst mode" that improved transfer speeds, helping address the very slow performance of previous Commodore drives.

<span class="mw-page-title-main">Industry Standard Architecture</span> Internal expansion bus in early PC compatibles

Industry Standard Architecture (ISA) is the 16-bit internal bus of IBM PC/AT and similar computers based on the Intel 80286 and its immediate successors during the 1980s. The bus was (largely) backward compatible with the 8-bit bus of the 8088-based IBM PC, including the IBM PC/XT as well as IBM PC compatibles.

<span class="mw-page-title-main">MOS Technology 6510</span> 8-bit microprocessor

The MOS Technology 6510 is an 8-bit microprocessor designed by MOS Technology. It is a modified form of the very successful 6502. The 6510 is widely used in the Commodore 64 (C64) home computer and its variants.

<span class="mw-page-title-main">MOS Technology</span> Semiconductor company based in Pennsylvania, U.S.

MOS Technology, Inc. ("MOS" being short for Metal Oxide Semiconductor), later known as CSG (Commodore Semiconductor Group) and GMT Microelectronics, was a semiconductor design and fabrication company based in Audubon, Pennsylvania. It is most famous for its 6502 microprocessor and various designs for Commodore International's range of home computers.

<span class="mw-page-title-main">Commodore 128</span> Home computer released in 1985

The Commodore 128, also known as the C128, C-128, or C= 128, is the last 8-bit home computer that was commercially released by Commodore Business Machines (CBM). Introduced in January 1985 at the CES in Las Vegas, it appeared three years after its predecessor, the Commodore 64, the bestselling computer of the 1980s. Approximately 2.5 million C128s were sold during its four year production run.

<span class="mw-page-title-main">Intel 8085</span> 8-bit microprocessor by Intel

The Intel 8085 ("eighty-eighty-five") is an 8-bit microprocessor produced by Intel and introduced in March 1976. It is the last 8-bit microprocessor developed by Intel.

<span class="mw-page-title-main">Commodore Plus/4</span> 1984 home computer by Commodore International

The Commodore Plus/4 is a home computer released by Commodore International in 1984. The "Plus/4" name refers to the four-application ROM-resident office suite ; it was billed as "the productivity computer with software built in".

<span class="mw-page-title-main">MOS Technology VIC-II</span> Video microchip in the Commodore 64 and C128 home computers

The VIC-II, specifically known as the MOS Technology 6567/6566/8562/8564, 6569/8565/8566 (PAL), is the microchip tasked with generating Y/C video signals and DRAM refresh signals in the Commodore 64 and Commodore 128 home computers.

<span class="mw-page-title-main">POKEY</span>

POKEY, an acronym for Pot Keyboard Integrated Circuit, is a digital I/O chip designed by Doug Neubauer at Atari, Inc. for the Atari 8-bit family of home computers. It was first released with the Atari 400 and Atari 800 in 1979 and is included in all later models and the Atari 5200 console. POKEY combines functions for reading paddle controllers (potentiometers) and computer keyboards as well as sound generation and a source for pseudorandom numbers. It produces four voices of distinctive square wave audio, either as clear tones or modified with distortion settings. Neubauer also developed the Atari 8-bit killer application Star Raiders which makes use of POKEY features.

<span class="mw-page-title-main">Commodore 65</span> Prototype computer

The Commodore 65 is a prototype computer created at Commodore Business Machines in 1990–1991. It is an improved version of the Commodore 64, and it was meant to be backwards-compatible with the older computer, while still providing a number of advanced features close to those of the Amiga.

<span class="mw-page-title-main">Commodore CBM-II</span> Series of 8-bit personal computers released in 1982

The Commodore CBM-II series is a short-lived range of 8-bit personal computers from Commodore Business Machines (CBM), released in 1982 and intended as a follow-on to the Commodore PET series.

<span class="mw-page-title-main">MOS Technology 6522</span> Microprocessor I/O port controller IC

The MOS Technology 6522 Versatile Interface Adapter (VIA) is an integrated circuit that was designed and manufactured by MOS Technology as an I/O port controller for the 6502 family of microprocessors. It provides two bidirectional 8-bit parallel I/O ports, two 16-bit timers, and an 8-bit shift register for serial communications or data conversion between serial and parallel forms. The direction of each bit of the two I/O ports can be individually programmed. In addition to being manufactured by MOS Technology, the 6522 was second sourced by other companies including Rockwell and Synertek.

In computing, a non-maskable interrupt (NMI) is a hardware interrupt that standard interrupt-masking techniques in the system cannot ignore. It typically occurs to signal attention for non-recoverable hardware errors. Some NMIs may be masked, but only by using proprietary methods specific to the particular NMI. With regard to SPARC, the non-maskable interrupt (NMI), despite having the highest priority among interrupts, can be prevented from occurring through the use of an interrupt mask.

The High Precision Event Timer (HPET) is a hardware timer available in modern x86-compatible personal computers. Compared to older types of timers available in the x86 architecture, HPET allows more efficient processing of highly timing-sensitive applications, such as multimedia playback and OS task switching. It was developed jointly by Intel and Microsoft and has been incorporated in PC chipsets since 2005. Formerly referred to by Intel as a Multimedia Timer, the term HPET was selected to avoid confusion with the software multimedia timers introduced in the MultiMedia Extensions to Windows 3.0.

The original Macintosh was a relatively simple machine, now of interest for its simplicity and for the fact that it was the first computer produced by Apple under the name Macintosh. The Macintosh used standard off-the-shelf components to the greatest extent possible, achieving a moderate price point by mixing complex LSI chips, readily customizable programmable array logic, and off-the-shelf components.

The AA+ chipset was a planned Amiga-compatible chipset that Commodore International announced in 1992. There were two separate projects: the next generation Advanced Amiga Architecture chipset and the lower cost, more pragmatic AA+ chipset. The former was in development when Commodore declared bankruptcy; the latter existed only on paper. Both were cancelled when Commodore folded.

In addition to the Amiga chipsets, various specially designed chips have been used in Commodore Amiga computers that do not belong to the 'Amiga chipset' in a tight sense.

<span class="mw-page-title-main">Commodore bus</span> Serial bus of the home computers series of Commodore

The Commodore serial bus, is Commodore's interface for primarily magnetic disk data storage and printers for Commodore 8-bit home computers: the VIC-20, Commodore 64, Commodore 128, Plus/4, Commodore 16, and Commodore 65.

References

  1. Perry, Tekla S.; Wallich, Paul (March 1985). "Design case history: the Commodore 64" (PDF). IEEE Spectrum. 22 (3): 48–58. doi:10.1109/MSPEC.1985.6370590. ISSN   0018-9235. S2CID   11900865. Archived from the original (PDF) on 2012-05-13. Retrieved 2011-11-12.
  2. articles on c64-wiki.com