Both port addresses, 37151 and 37137, work for fire and the directions left, up and down.Richard James wrote:looking at the PDF version 1.2 the joystick section seems to have errors [...]
37137 ($9111) and 37151 ($911F) both contain the ORA, i.e. the port A data register, with the same meaning of the port bits. Their difference is that $9111 controls the data handshake, whereas $911F has no effect on the data handshake. For more details, please refer to one of the original data sheets.
I prefer the use of 37151 in a joystick routine simply because it is in closer proximity to the other two necessary registers in VIA #2, 37152 (ORB, $9120, contains the joystick right direction) and 37154 (DDRB, $9122, bit 7 - value 128 - temporarily set to input).
However, as you correctly found out, the small block "JOYSTICK $911F $9120 $9122" indeed is in error. It should read:
Code: Select all
JOYSTICK $911F $9120 $9122
$911F 37151 VIA #1 Port A --FLDU-- Joystick Fire, Left, Down, Up
$9120 37152 VIA #2 Port B R------- Joystick Right *)
*) enclose between POKE37154,127 and POKE37154,255
Below that, the more verbose block with the Boolean predicates - those expressions with (PEEK(%)AND%)=0 -, is correct.
...
P.S. Welcome back! It's been a long time since.
