For a computer to be useful, it needs a means of providing input(s). I will do this by adding a 6522. The 6522 is known as a VIA, Versatile Interface adapter. As well as the 6502, the 6522 was manufactured by MOS Technology. It has been designed as an I/O port controller for the 6502, so it is an ideal choice for this project. It has a history of being used for 6502 based computers, as it was used by many big names. These include Commodore, Apple and BBC.

The 6522 contains 20 I/O lines, organised into two 8-bit bidirectional ports and four control lines. The direction of the 16 lines can be independently programmed.

I wish to use the 6522 to allow me to have an input and an output device. Because the 6522 has two bi-directional ports, I plan to use one port for my input device and the other for my output device. Also, because the ports are bi-directional, they can be used as either inputs or outputs.

Memory map

I will be using 0x6000 for port B and 0x6001 for port A.


The 6522 requires a clock signal, which will be provided by connecting to pin 39 of the 65C02. Pin 39 is the phase two clock. The reason that this connection is used is because data transfer between the 6502 and the 6522 occur when the phase two clock is high.

Input or output

The ports contain a data direction register, DDRA and DDRB. I plan on using port A for my input device and port B for my output device. To set the pins to inputs, a 0 must be placed into DDRA. To set the pins to outputs, a 1 must be placed into DDRB.