Keyboard interface for the Atari 2600

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Al_Nafuur

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:
  • 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 JLCPCB sponsorship, we will have some free boards available for testers and developers involved in the project!
One Limitation
  • 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.
How It Works
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.
  • 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).
Things to Discuss and To-Do
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.
Hardware
  • 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?
Miscellaneous
  • 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





JetSetIlly

Superb! I'd be interested in giving my rough port of Adventureland full keyboard support
https://github.com/JetSetIlly/Gopher2600
@JetSetIlly@mastodon.gamedev.place
@jetsetilly.bsky.social

Al_Nafuur


Al_Nafuur

3D render of the PCB:

radventure


Andrew Davie

A nice 3D case would be pretty cool!  Top work!

Al_Nafuur

Quote from: Andrew Davie on 16 Apr 2025, 02:24 PMA nice 3D case would be pretty cool!  Top work!
Initial I also thought of an 3D case as they only option to encase the device. But as I started finishing the routing and positioning of the parts it occurred to me that a when I switch to a "standard" size for the PCB, people can also use standard cases for enclosing.


6*8 cm would be the next bigger size to choose. But it would need some rearrangments of the parts for the mounting holes.


Al_Nafuur

On the other hand..

I just checked the size of the Raspberry Pi 4/5 and accidental my current board is nearly the same size..

There are a lot of Pi cases out there, but I am not sure we can make them fit with our connectors..


Al_Nafuur

Routing is done. The current state of the KiCad (8.0) project is pushed to the Git repository
https://github.com/Al-Nafuur/Keyboard-2600


Andrew Davie


Al_Nafuur

KeyPortari – First Prototype PCBs Now in Production! 

I'm happy to share that the first prototype run of my project KeyPortari is now officially in production! 🎉
Thanks to generous support from JLCPCB, we've produced 15 partially assembled test boards, which will be ready for hands-on testing in about 2 to 3 weeks.

📦 GitHub repository (code, schematics, layout, etc.):
🔗 https://github.com/Al-Nafuur/Keyboard-2600

💡 Looking for testers and developers!
If you're interested in experimenting, writing code, or helping test the hardware, feel free to reach out to me directly. I'd be happy to provide you with a test board - while supplies last!

Excited to see what we can build together.