!!!For 400, 800 (OS A)
||ADR||HEXADR||NAME||Description||shadow||OS
|54017|$D301|PORTB| | [STICK2] [STICK3] [PTRIG4] [PTRIG5] [PTRIG6] [PTRIG7]| 400/800

Read or write data from the control ports (joystick ports), depending on how the data direction is set (default: 0 "read/input"). To set the direction, set Bit 2 of [PACTL] to "0" and define the direction by setting the bits of PORTA (0=read, 1=write) for each input/output line. Then set Bit 2 of [PACTL] to "1" again.

Example:
{{{
PACTL=PACTL && %11111011 ;set Bit 2 to 0
PORTA=%11110000          ;set Port 2 to output/write, Port 1 is input/read
PACTL=PACTL %% %00000100 ;set Bit 2 to 1
}}}

||Bit||Function||Description||Joystick direction||Paddletrigger
|7|PA7|Joystick Port 4 Pin 4|Right|Paddle 8 [PTRIG7]
|6|PA6|Joystick Port 4 Pin 3|Left|Paddle 7 [PTRIG6]
|5|PA5|Joystick Port 4 Pin 2|Down|not used
|4|PA4|Joystick Port 4 Pin 1|Up |not used
|3|PA3|Joystick Port 3 Pin 4|Right|Paddle 6 [PTRIG5]
|2|PA2|Joystick Port 3 Pin 3|Left|Paddle 5 [PTRIG4]
|1|PA1|Joystick Port 3 Pin 2|Down|not used
|0|PA0|Joystick Port 3 Pin 1|Up|not used

Joystick direction sets Bit=0 when pushed in that direction

Paddletrigger Bit=0 when pressed

!!!For 600XL, 800XL, 1200XL, 130XE

||ADR||HEXADR||NAME||Description||OS
|54017|$D301|PORTB| Memory Management | XL/XE

1200XL
||Bit||Function||Description
|7|$5000-$57FF|0=Self test, 1=RAM
|6|not used|
|5|not used|
|4|not used|
|3|LED2|0=off, 1=on
|2|LED1|0=off, 1=on
|1|not used
|0|$C000-$FFFF|0=RAM, 1=OS-ROM

600XL/800XL
||Bit||Function||Description
|7|$5000-$57FF|0=Self test, 1=RAM
|6|not used|
|5|not used|
|4|not used|
|3|not used|
|2|not used|
|1|$A000-$BFFF|0=ATARI BASIC ROM, 1=RAM
|0|$C000-$FFFF|0=RAM, 1=OS-ROM

130XE
||Bit||Function||Description
|7|$5000-$57FF|0=Self test, 1=RAM
|6|not used|
|5|ANTIC|0=ANTIC has access to extra RAM, 1=ANTIC has access to normal RAM
|4|CPU|0=CPU has access to extra RAM, 1=CPU has access to normal RAM
|3|Bank select|see below
|2|Bank select|see below
|1|$A000-$BFFF|0=ATARI BASIC ROM, 1=RAM
|0|$C000-$FFFF|0=RAM, 1=OS-ROM

Bank select
||Bit 2||Bit 3||Bank
|0|0|Bank 0
|0|1|Bank 1
|1|0|Bank 2
|1|1|Bank 3

----
see also: [Controller topics|Controller_topics]