Jump to content

Joystick Hardware Emulation on the TK-II


Recommended Posts

First let me start off by saying this will eventually cover 3 distinct upgrades, with the first one being what is called the ARROW2JOY-XLD. As the name implies this is meant for use with a 1088XLD. So what's this all about? Well first let me tell you a small story (I promise I'll keep it short and sweet).


I was looking at the various Atari 8-bit emulators the other day, and noticed that one in-particular supported a joystick mode via the arrow keys on the keyboard. My first reaction was "Hey that's Cool!", and so it began.


Now how could I do something like that with the TK-II hardware? Well it turns out I first had to steal a page from the AKI (Atari Keyboard Interface). The AKI syncs up with the Pokey chip on the Atari using only 2 bits of Pokey's 6-bit key scan counter and then builds a copy in software running inside the PIC chip that drives it. In retrospect my design was using all 6-bits of the Pokey counter as a reference. So in order for me to free up some I/O for other uses (i.e., Joystick mode), I decided to mimic what the AKI was doing. This freed up four I/O lines which I was able to decode into 9 states. That being JOY-Up, JOY-Down, JOY-Left, JOY-Right, Aux1, Aux2, Aux3, standby (IDLE), and finally JOY-Trigger. The trigger function had to be kept separate, so that it could be initiated independently of direction. Since I was addressing a 74LS156 decoder with 3 of the I/O lines, that gave me 8 possible decoded outputs, with one as I already mentioned being a 'do nothing' state. So as part of the decode process I automatically got 3 extra outputs beyond the 4 direction bits I required, which I called AUX 1-3. I decided to terminate these 3 outputs on an independent 3-pin header. They are open collector and momentary in nature, so would work fine for something like a disk swap button, something the XLD already has implemented for its built-in IDE. Anyway they were free, and are available for whatever the user wants.


Getting back to the Joystick aspect, here is how that's been applied in a new version of the TK-II firmware (V2.5J).


Basic Keyboard Commands

  • PS/2 ALT+J toggles into and out of the Joystick Mode*
  • PS/2 Arrow Keys produce Joystick X/Y direction switching
  • PS/2 Left-Windows Key = Joystick Trigger Button
  • PS/2 ALT+1-3 = AUX outputs 1-3


*Note: The Joystick Mode is volatile, and will go back to the arrows navigation mode (default) on a power cycle.


So here's what the new TK-II piggyback upgrade board looks like (plugs right into the TK-II chip socket on the 1088XLD motherboard).



And it has a small companion interface board to connect up with the joystick signals on the 1088XLD.




Here's the complete system in use.

There were other changes in the 2.5J TK-II firmware which will need to be documented, and there is a new version coming of the TK-II Pokey piggyback board for use in standard Atari systems that will integrate the joystick functions. So stay tuned for more info to come :) .
  • Like 6
Link to comment
Share on other sites

This is the next upgrade on the horizon, and is designed to drop into anything from a 400/800 to an XL/XE.


TK-II-PBJ: TransKey - 2nd Generation - Pokey PiggyBack - with Joystick Functionality


Board Top View



Board Bottom View



Schematic: TK-II-PBJ_schema.pdf


This one board will most likely take the place of the two existing Pokey piggyback boards on my TK-II page (shown below).


Standard Orientation


Reverse Orientation



  • Like 6
Link to comment
Share on other sites

Besides the Arrows to Joystick aspect, the new 2.5J TK-II firmware now provides for two different F-Key mapping schemes for HELP, Start, Select, Option, Reset.


Standard TK-II F-Key mapping



DarkAKI F-Key mapping



CTRL+ALT+E will toggle between the two F-Key Emulation schemes. This is a non-volatile selection and will be restored after each power cycle.


ALT+E will show you what the present setting is without disturbing it.


The DarkAKI setting mimics some of the F-Key assignments of the AKI keyboard adapter that Lotharek produces, and thus is a more Altirra-like layout concerning the console and reset keys. If you tend to use that emulator, or you plan on mixing TK-II's with AKI's this will make you feel right at home.


So if you are interested in having this aspect, irrelevant of whether you have the Arrow to Joystick hardware, download and flash the new V2.5J firmware to your TK-II PIC chip. the firmware is available at: https://ataribits.weebly.com/arrow2joy-xld.html

However please keep in mind that certain features were removed to make space for these new ones. The removed features are listed next to the download link.


  • Like 3
Link to comment
Share on other sites

I've decided to do a very minor update of the 2.5J firmware for the TK-II. Basically I'm adding one more Trigger Button hot key. It kind of bugged me that my IBM Model M keyboard didn't have any Windows keys, so that would have excluded it from being able to fully use the Joystick emulation mode due to missing a trigger button. So I decided to also make the #5 key on the Numpad a trigger button as well. With people that do have a keyboard with a Left-Win key, this will now give them the choice of either a left or a right trigger button.


I'll be updating the PIC flashing file in a few minutes. The firmware version number will remain unchanged, but the date that shows up when pressing ALT+F1 will be today's date 1-17-2020.


TK-II Firmware V2.5J PS/2 Keyboard Map





EDIT1: Updated Firmware now available at: https://ataribits.weebly.com/arrow2joy-xld.html

EDIT2: Ok so I changed my mind after using it. Instead of Numpad #5 being the 2nd trigger Button, I chose the Numpad Enter key instead. It just felt like it was in a better position, and more comfortable to use.

EDIT3: Changes have now been incorporated into the manual.


  • Like 2
Link to comment
Share on other sites

Unfortunately something isn't quite right with the latest 2.5J TK-II firmware. I'll have to investigate, and see where I F__ked up :? .


First I need to figure out a consistent way to make it break, and then I'll have a test for when it's fixed.


Edit: I think I figured out what was happening. If it checks out over several days tests, then I'll put the download back on my site.


  • Like 2
Link to comment
Share on other sites

  • 2 weeks later...

New TK-II-PBJ boards have arrived from China.






I did these via slow post leading up to the Chinese New Year, and wasn't expecting them for another week. They came so fast, that they beat out my Digi-Key parts order, which has the SOIC version of the PIC16F1847 that I'll need. At only $1 per board, you can't beat the pricing that I get from JLCpcb. They also offer DHL shipping with a 'production to your door' turn-around of no more than 5 days, but that can get a bit costly.



  • Like 4
Link to comment
Share on other sites

Unfortunately I made a mistake on the CNC drill file that went out with the gerbers for the TK-II-PBJ boards that I just received. Due to the limitations of my PCB layout software, I wasn't able to spec a .056" diameter drill for the machine pin holes in the source file. This is normally not a problem, since I can just edit the file with something like notepad, and change the dummy hole size (.052) to .056 on the tool call-out line (see example below).

T04C.056 <---- changed from .052 to .056

So after I made this small change I sent the file off to have another set of boards made.




And while I was at it, I also made some modifications to an existing PS/2 connector interface board, making it more specific to this application.





The original PS/2 connector board made for the previous TK-II-PB series boards, will still work if only one half of the DIL header is used. So if you have one of those mounted in your A8, it can still be used if you decide to update from the TK-II-PB to this new TK-II-PBJ. I still plan to keep all the original boards available for that series since they can be used for dual PS/2 keyboard connection with firmware prior to V2.5J.


When I sent off the order at the JLCpcb site I saw this new notice on the top of the website...

Latest Announcements!

Due to coronavirus outbreak, production of Multi-layer PCBs, SMT assembly and stencils was postponed to February 10.
DHL announced that their service will temporarily be suspended till February 6. 

Please view the notice for lastest information and thank you for your understanding and support during this time. 

This gave me some concern, so I decided to check for transmission of the virus through inanimate objects being shipped, and apparently that is very unlikely due to the virus not being able to survive for long outside of a host body. I'm pretty sure that the delay as noted in the announcement, is to allow those production and shipping portals to put into place safety procedures to better protect their own personal.


  • Like 2
Link to comment
Share on other sites

  • 2 weeks later...

There were some mistakes on the ARROW2JOY Bill of Materials shown on my website. I discovered this when making a test order utilizing the embedded part number links. Below is the corrected BOM for items 4 and 5.


This is only a photo capture from the ARROW2JOY page, so these links will not be functional.




For the time being I chose alternative vendors for these corrected items, since I have direct experience ordering these particular items from them and I know that they will work. Later if I find suitable Digi-Key alternatives I'll update the BOM based on that.


If someone has already ordered from the previous BOM, please send me a PM and your address, and I'll be sure you get the right parts to complete your assembly.


  • Like 1
Link to comment
Share on other sites

TK-II-PBJ Assembled, Flashed, and Tested


After an additional 2 weeks of waiting due to the Corona Virus, the corrected boards finally arrived for the newest TK-II iteration from JLCPCB in China.


Assembly Step 1: mount SMD and inner socket components (without the socket in the way, its easy to fix solder bridges with solder wick)



Assembly Step 2: after removing the socket's inner cross supports, it's time to mount the Pokey IC socket and a 40-pin connection header



Let's flip it over and see what it looks like  underneath



Time to Flash the Firmware

Connecting to JOY2PIC for In Circuit Serial Programming of the PIC



Using SIO2PC, load the V2.5 Flashing ATR and you should see this screen on your Atari



Begin flashing process






Assemble PS/2 connector interface board





Installation into 1200XL (not that it needs it ;-) )

Mount PS/2 connector interface board in place of removed RF modulator (ream out the RF jack hole)



install Pokey piggyback board into Pokey's socket and connect cables (lots of cable work required)



The Joystick connections are optional, but required if you want to use the NEW Arrow-to-Joystick mode.






It works ? :)



A size comparison to Lotharek's similar product the AKI PS/2 Keyboard Interface




Board fabrication and schematic downloads now available at: https://ataribits.weebly.com/tk-ii.html



  • Like 1
  • Thanks 1
Link to comment
Share on other sites

  • 3 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...