On the Commodore SX 64 there is no pullup resistor on the SRQ line.
This can couse some problems with speed loaders.
You can solve this by adding a 3k3 Ohm resistor between the SRQ line and a 5 Volt line.
The Joystick ports are connected to CIA 1 in parallel to the keyboard matrix.
To read the direction from the joystick you can read the memory locations 56321/DC01 for port 1 and 56320/DC00 for port 2.
The userport PB0-PB7 is connected to the CIA 2 port B and is controllable by setting the right direction bits in the Data Direction Register Byte (DDRB) on address 56579 ($DD03).
And writing or reading the port on address 56577 ($DD01).
Note, when using the RS-232 functions (open 2,2,2) will change the DDRB.
On the Commodore SX 64 there is a connection between pin 11 and pin 12, this can couse some problems when using certain expansions.
Solution is easy, cut the trace between pin 11 and pin 12.
This connection is even not in the scematics.
A schematic of the keyboard can be found here.