1 /*****************************************************************************/
5 /* Internal include file, do not use directly */
7 /* The Peripheral Interface Adapter (PIA) chip provides parallel I/O */
8 /* interfacing; it was used in Atari 400/800 and Commodore PET family of */
9 /* computers, for joystick and interrupts. */
10 /* - Sources; various + Wikpedia article on "Peripheral Interface Adapter" */
13 /* (C) 2000 Freddy Offenga <taf_offenga@yahoo.com> */
14 /* 2019-01-13: Bill Kendrick <nbs@sonic.net>: Defines for registers */
17 /* This software is provided 'as-is', without any expressed or implied */
18 /* warranty. In no event will the authors be held liable for any damages */
19 /* arising from the use of this software. */
21 /* Permission is granted to anyone to use this software for any purpose, */
22 /* including commercial applications, and to alter it and redistribute it */
23 /* freely, subject to the following restrictions: */
25 /* 1. The origin of this software must not be misrepresented; you must not */
26 /* claim that you wrote the original software. If you use this software */
27 /* in a product, an acknowledgment in the product documentation would be */
28 /* appreciated but is not required. */
29 /* 2. Altered source versions must be plainly marked as such, and must not */
30 /* be misrepresented as being the original software. */
31 /* 3. This notice may not be removed or altered from any source */
34 /*****************************************************************************/
42 /* Define a structure with the PIA register offsets */
44 unsigned char porta; /* port A data r/w */
45 /* Paddle 0-3 triggers (per PORTA bits) */
46 #define PORTA_PTRIG3 0x80
47 #define PORTA_PTRIG2 0x40
48 #define PORTA_PTRIG1 0x08
49 #define PORTA_PTRIG0 0x04
52 unsigned char portb; /* port B data r/w */
53 /* Paddle 4-7 triggers (per PORTB bits); only 400/800 had four controller ports */
54 #define PORTB_PTRIG7 0x80
55 #define PORTB_PTRIG6 0x40
56 #define PORTB_PTRIG5 0x08
57 #define PORTB_PTRIG4 0x04
59 /* See also: "JOY_xxx_MASK" in "atari.h" */
61 unsigned char pactl; /* port A control */
62 unsigned char pbctl; /* port B control */
64 #define PxCTL_IRQ_ENABLE 0x01 /* (W) Peripheral A interrupt (IRQ) enable. */
65 /* One equals enable. Set by the OS but available to the user;
67 #define PxCTL_BIT1 0x02 /* "Set to zero" */
68 #define PxCTL_ADDRESSING 0x04 /* (W) Controls PORTA addressing */
69 /* One equals PORTA register; zero equals direction control register */
70 #define PACTL_MOTOR_CONTROL 0x08 /* (W) Peripheral motor control line (turn the cassette on
71 or off; zero equals on) */
72 #define PBCTL_PERIPH_CMD_IDENT 0x08 /* Peripheral command identification (serial bus command) */
73 #define PxCTL_BIT4 0x10 /* "Set to one" */
74 #define PxCTL_BIT5 0x20 /* "Set to one" */
75 #define PxCTL_BIT6 0x40 /* "Set to zero" */
76 #define PxCTL_IRQ_STATUS 0x80 /* Peripheral interrupt (IRQ) status bit. */
77 /* Set by Peripherals (PORTA / PORTB). Reset by reading PORTA / PORTB*/