MediaWiki:Sitenotice
2026-03-12: Cocopedia.com is now using a new caching system that should make things faster. Please let me know if you encounter any new issues.

2026-03-15: MediaWiki has been reinstalled and the old database and files restored. It was pretty clogged up from being upgraded so many times since 2004. I am also testing out Cloudflare to see if it can prevent the 'bot assaults that took the site down last year.

2026-03-16: Special thanks to Don Barber for hosting a backup mirror of CoCopedia: https://cocopedia.dgb3.net

PIA

From CoCopedia - The Tandy/Radio Shack Color Computer Wiki
Revision as of 10:46, 18 May 2026 by TomHarte (talk | contribs) (Keyboard: These are columns, not rows.)
Jump to navigationJump to search

The Peripheral Interface Adapter, formally the Motorola 6821, is a chip that provides two ports of parallel input and output plus control lines and interrupts. There are two in your CoCo, usually referred to as PIA0 and PIA1, and they're responsible for keyboard and joystick input, sound output and video mode selection and interrupt generation, amongst other tasks.

Keyboard

The keyboard can be scanned through PIA0 via addresses $FF00 and $FF02. The first address ($FF00) represents keyboard rows as well as joystick buttons, and the second address ($FF02) keyboard columns; programs will normally set one of these as output and one of these as inputs, most normatively configuring $FF02 as output and using it to select which columns to scan and then reading $FF00 as input to very which rows on those selected columns had keys pressed. Color Basic, when running a prompt, converts these to ASCII values to be printed to the screen at cursor position.

These two value correspond to ASCII values according to the following table:

0 1 2 3 4 5 6 7
0 @ H P X 0 8 Enter
1 A I Q Y 1 9 Clear
2 B J R Z 2 : Break
3 C K S Up 3 ;
4 D L T Down 4 ,
5 E M U Left 5 -
6 F N V Right 6 .
7 G O W Space 7 / Shift

Keyboard layout is one of the few areas of hardware difference between a CoCo and a Dragon, other than video standard; the Dragon has the same physical layout as the CoCo but changes the column numbering — columns 6 and 7 are the same as the CoCo but everything else is off by 2. E.g. the CoCo's column 0 is the Dragon's column 2, the Coco's column 4 is the Dragon's column 6 and the CoCo's column 5 is the Dragon's column 0.

(under construction)