Prev: 45219 Up: Map Next: 45273
45233: Controls: Interface II Joystick
Reads an Interface II joystick, which is mapped onto the keys "6" to "0".
Output
A Joystick controls
C Joystick controls
Initialise the controls as "none" in C.
ReadInterfaceIIJoystick 45233 LD C,0 Clear the controls in C.
45235 LD A,239 Read from the keyboard;
Port Number Bit
0 1 2 3 4
239 0 9 8 7 6
45237 OUT (253),A
45239 IN A,(254)
Check joystick "FIRE".
ReadInterfaceIIJoystick_Fire 45241 BIT 0,A Jump to ReadInterfaceIIJoystick_Up if "FIRE" (key "0") is not being pressed.
45243 JR NZ,ReadInterfaceIIJoystick_Up
45245 SET 4,C Set the "FIRE" bit (bit 4) of the controls in C.
Check joystick "UP".
ReadInterfaceIIJoystick_Up 45247 BIT 1,A Jump to ReadInterfaceIIJoystick_Down if "UP" (key "9") is not being pressed.
45249 JR NZ,ReadInterfaceIIJoystick_Down
45251 SET 2,C Set the "UP" bit (bit 2) of the controls in C.
Check joystick "DOWN".
ReadInterfaceIIJoystick_Down 45253 BIT 2,A Jump to ReadInterfaceIIJoystick_Right if "DOWN" (key "8") is not being pressed.
45255 JR NZ,ReadInterfaceIIJoystick_Right
45257 SET 3,C Set the "DOWN" bit (bit 3) of the controls in C.
Check joystick "RIGHT".
ReadInterfaceIIJoystick_Right 45259 BIT 3,A Jump to ReadInterfaceIIJoystick_Left if "RIGHT" (key "7") is not being pressed.
45261 JR NZ,ReadInterfaceIIJoystick_Left
45263 SET 1,C Set the "RIGHT" bit (bit 1) of the controls in C.
Check joystick "LEFT".
ReadInterfaceIIJoystick_Left 45265 BIT 4,A Jump to HandlerInterfaceIIJoystick if "LEFT" (key "6") is not being pressed.
45267 JR NZ,HandlerInterfaceIIJoystick
45269 SET 0,C Set the "LEFT" bit (bit 0) of the controls in C.
HandlerInterfaceIIJoystick 45271 LD A,C Fetch the controls.
45272 RET Return.
Prev: 45219 Up: Map Next: 45273