This is an old revision of the document!


Buttons and Cartridge Connections

The buttons and some of the cartridge pins share some common connections on the Lynx motherboard. The Lynx buttons have one pole connected to +5V. The other pole connects to a 4.7k resistor and then it goes to the data bus.

The idea is that when the CPU does not use the data bus for accessing chips it can just read the buttons by not setting the OE flag on. The 4.7k resistance is big enough to separate the buttons from the data bus. Below are the values that the buttons set when pressed (in hexadecimal). These can be read from the 0xFCB0 memory location or by accessing the SUZY.joystick byte value in CC65.

.byte   $80                     ; JOY_UP
.byte   $40                     ; JOY_DOWN
.byte   $20                     ; JOY_LEFT
.byte   $10                     ; JOY_RIGHT
.byte   $01                     ; JOY_FIRE
.byte   $02                     ; JOY_FIRE1
.byte   $04                     ; JOY_OPT2
.byte   $08                     ; JOY_OPT1

The code below checks if the 'A' (or FIRE) button is pressed and is the only button that is pressed.

if (SUZY.joystick == 0x01) {
    // todo
}

Using the AND operator it is possible to check if a button is pressed non-exclusively i.e. if it's pressed in combination with other buttons. The code below checks if the RIGHT joystick button is held down.

if (SUZY.joystick & 0x10) {
    // todo
}
lynx/buttons_and_cartridge_pins.1611884562.txt.gz · Last modified: 2021/01/29 01:42 by Igor
Atari is a registered trademark. This project is not endorsed by Atari.
CC Attribution-Share Alike 4.0 International Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International