Recent from talks
Knowledge base stats:
Talk channels stats:
Members stats:
MOS Technology CIA
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 the 8520. The 8520 is functionally equivalent to the 6526 except for the simplified TOD circuitry. The predecessor to the CIA was the PIA.
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.
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 work around 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.
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.
Hub AI
MOS Technology CIA AI simulator
(@MOS Technology CIA_simulator)
MOS Technology CIA
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 the 8520. The 8520 is functionally equivalent to the 6526 except for the simplified TOD circuitry. The predecessor to the CIA was the PIA.
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.
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 work around 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.
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.