M6821 PIA Atapter Register Reference
From Extended Color Basic Unravelled

M6821 PIA Adapter Register Reference

$FF00 - PIA0 : I/O Port A
Bit 0Keyboard row 1 and right joystick switch 1
Bit 1Keyboard row 2 and left joystick switch 1
Bit 2Keyboard row 3 and right joystick switch 2
Bit 3Keyboard row 4 and left joystick switch 2
Bit 4Keyboard row 5
Bit 5Keyboard row 6
Bit 6Keyboard row 7
Bit 7Jotstick comparison input




$FF01 - PIA0 : I/O Control A
bit0 Control of HSync (63.5ps)
0 = IRQ* to CPU disabled interrupt
1 = IRQ* to CPU enabled
bit1 Control of interrupt
0 = flag set on falling edge of HSync polarity
1 = flag set on rising edge of HSync
bit2Normally 1. 0 = changes $FF00 to data direction
bit3Sel 1 LSB of two analog MUX select lines
bit4Always 1
bit5Always 1
bit6Not used
bit7Horizontal Sync interrupt flag




$FF02 - PIA0 : I/O Port B
bit0Keyboard column 1
bit1Keyboard column 2
bit2Keyboard column 3
bit3Keyboard column 4
bit4Keyboard column 5
bit5Keyboard column 6
bit6Keyboard column 7 / RAM size output
bit7Keyboard column 8




$FF03 - PIA0 : I/O Control B
bit-0 Control of VSync (16.667ms)
0 = IRQ* to CPU disabled interrupt
1 = IRQ* to CPU enabled
bit-1 Control of interrupt
0 = flag set on falling edge of FS polarity
1 = flag set on rising edge of FS
bit2Normally 1 0 = changes $FF02 to data direction
bit3Sel 2 MSB of two analog MUX select lines
bit4Always 1
bit5Always 1
bit6Not used
bit7Field Sync interrupt flag