I'm thrilled to introduce a new project I've been working on: an Atari 2600 Keyboard and Joystick Interface! This project aims to bring keyboard input to the Atari 2600 while allowing parallel connection of joysticks and other input devices, opening up exciting possibilities for games, utilities, and creative experiments. I've already discussed the idea with Thomas Jentzsch, who has been incredibly helpful in getting this project off the ground by contributing some great ideas for the protocol. Now, I'm looking for testers, developers, and feedback to help bring this project to life.
Project Overview
The goal is to create a hardware interface that allows a PS/2 or USB keyboard and other input devices like joysticks and paddles to be connected to the Atari 2600 in parallel. This interface will enable developers to create games and applications that use both keyboard and joystick input simultaneously. Here are some key features:
The project is built around an ATmega328P microcontroller that manages communication between the joysticks, keyboard, and the Atari 2600's RIOT (6532) chip. Here's a breakdown of the system:
There are still some open questions and decisions to make, and I'd love your input:
Protocol
How You Can Help
Next Steps
YouTube Videos
Project Overview
The goal is to create a hardware interface that allows a PS/2 or USB keyboard and other input devices like joysticks and paddles to be connected to the Atari 2600 in parallel. This interface will enable developers to create games and applications that use both keyboard and joystick input simultaneously. Here are some key features:
- Keyboard Support: The board will include a PS/2 and a USB connector, but only USB keyboards that support the PS/2 protocol over USB will work (most keyboards should do, but I haven't tested).
- Parallel Connection of Input Devices: You can connect joysticks, paddles and keypads in parallel with the keyboard, allowing for versatile input options.
- No PlusCart Required: This project is designed to work with a normal ROM cartridge, so you don't need a PlusCart to use it.
- Free Test Boards: Thanks to a potential PCBway sponsorship, we might have some free boards available for testers and developers involved in the project!
- SaveKey and AtariVox Compatibility: Unfortunately, the SaveKey and AtariVox and other devices that need the RIOT in output mode will most likely not work with this interface due to hardware and protocol conflicts. This is something to keep in mind for developers and users.
The project is built around an ATmega328P microcontroller that manages communication between the joysticks, keyboard, and the Atari 2600's RIOT (6532) chip. Here's a breakdown of the system:
- ATmega328P and Bus Transceiver:
- The ATmega328P controls the communication between the joysticks and the RIOT via an 8-bit bus transceiver (SN74LVC245AN).
- The SN74LVC245AN acts as a bidirectional buffer, allowing the ATmega328P to selectively "block" or "enable" the joysticks and keyboard.
- Direct TIA Connections:
- The TIA connections on the Atari 2600 joystick ports (e.g., trigger buttons and paddle potentiometers) are wired directly to the joystick ports of the device. These connections are not controlled by the ATmega328P and remain active at all times.
- Keyboard Input Handling:
- When a key on the keyboard is pressed, the ATmega328P:
- Blocks the joysticks by disabling their communication with the RIOT.
- Sets the RIOT's data bus to the corresponding keycode value (8-bit, allowing for 255 different keys; $ff represents "no key pressed").
- When the key is released, the ATmega328P:
- Disconnects itself from the data bus.
- Re-enables the joysticks, allowing them to communicate with the RIOT again.
- When a key on the keyboard is pressed, the ATmega328P:
- Reading Keycodes on the 2600:
- On the Atari 2600 side, reading the keycode is as simple as reading the RIOT's SWCHA register.
- Here's an example of the code used to handle key presses in my demo:
lda SWCHA ; Load the value from SWCHA (keyboard input)
cmp #$ff ; Compare to $FF (no key pressed)
beq skipNewChar ; If no key is pressed, skip
cmp last_char ; Compare to the last key pressed
beq skipNewChar ; If the key hasn't changed, skip
ldx ActiveChar ; Load the index for the active character
sta w000,x ; Store the keycode in memory
inx ; Increment the index
stx ActiveChar ; Store the updated index
skipNewChar
sta last_char ; Store the current keycode as the last key pressed
- In this example, the keycode sent by the ATmega328P directly corresponds to the value needed by the 24-character display kernel I'm using. This simplifies the process of displaying characters on the screen.
- Future Protocol Improvements:
- The current implementation uses a simple keycode system, but we're open to exploring other protocols in the future, such as:
- ASCII: For better compatibility with text-based applications.
- Real PS/2 Keycodes: To support a wider range of keyboards and key combinations.
- Custom Protocol: To allow simultaneous use of keyboard and joystick inputs (e.g., using arrow keys as joystick directions).
- The current implementation uses a simple keycode system, but we're open to exploring other protocols in the future, such as:
There are still some open questions and decisions to make, and I'd love your input:
Protocol
- Should we use ASCII, keycodes, or a custom protocol to allow simultaneous use of the keyboard and joystick in the same kernel?
- For example, could we use the arrow keys as a joystick? (Diagonals are still unclear.)
- We'll need to decide which ASCII codes to omit to avoid conflicts with joystick inputs.
- Keyboard Layout Selection: Should this be done via DIP switches on the board or configured in the 2600 software?
- Power Supply: Should the keyboard have a separate power supply, or can it share power with the Atari 2600?
- Capacitors: Do we need additional capacitors for the SN74LVC245AN buffer to ensure stable operation?
- Project Name: We need a cool name for the project/board! Any suggestions?
How You Can Help
- Testers: If you're interested in testing the hardware and providing feedback, let me know!
- Developers: If you're a developer interested in creating software (games, utilities, etc.) for this interface, your input will be invaluable.
- Feedback: Share your thoughts on the protocol, hardware design, and any other ideas you have.
Next Steps
- I'll be finalizing the hardware design and ordering test boards soon.
- Once the boards are ready, I'll distribute them to testers and developers.
- We'll work together to refine the design and create some awesome software for the Atari 2600!
YouTube Videos