Orwell joystick.

February 15th, 2015

As well as the railway table I also finished Orwell’s joystick. Actually I made several since the first one I muffed up a bit. The DA15s I ordered arrived a few days apart so during the week I wired up the Orwell end. I used the same pinout as a PC gameport. Well, the top half as I only need one stick. I was hoping I could use an old PC stick on Orwell but I found that won’t work. I’d forgotten over the years that PC joysticks don’t have the pots wired as voltage dividers as Orwell does. Instead one end of the pot is floating.

I went for a walk to Surplustronics and got a small thumbstick and a couple of buttons. I did a temporary wire up and it all worked so I put it all in a box. The thumbstick module was mounted on metal board spacers. They were a little too long so I machined them down on the lathe a little.

IMG_3099_1 IMG_3101_1 IMG_3102_1

I went for a vertical format. Awkward but that was the way things were in the 80s! It reminds me of Boilerplate. It all worked but with a few small issues. Mainly that I misunderstood the way around the axes went. I wanted the 0,0 point to be in the top left so that the stick mirrors the screen co-ordinates. That makes it much easier to do things like drawing on the screen with the stick in BASIC as you don’t need to flip co-ordinates. I couldn’t just rotate the thumbstick as the mounting holes aren’t square and it wouldn’t fit anyway. So I made a new one.

IMG_3153_1

Actually I made several. The first with black jiffy boxes. They were really cheap and nasty though and the plastic was rubbish. You couldn’t drill it without it chipping or tearing. So in the end I used a blue box. And I turned it sideways to be more useable. I also mounted the stick lower down (more machining of the spacers) because I found with these sticks the useable range isn’t across the full movement of the stick. If you make the hole in the box just larger than the mushroom on the stick (well, it has to be larger or you can’t get the stick through!) and mount it with a minimal clearance between the curved part and the bottom of the hole you get the full range almost matching the full travel. That’s hard to explain but easy to understand if you see it in action.

Another trick is on the VIA port B at the lowest memory location ($4400 or 17408 decimal). Port A is one address up ($4401). So I wired the stick and port so that the X axis goes to port B and the Y to port A. So now in the code you PEEK the two locations in sequence to get X and Y in that order. It just makes the coding a little easier. After doing all that it works really well!

This is the code that you use to read the axes:

IMG_3158_1

A simple PEEK on each location to read the axes. Running you get this:

IMG_3161_1

That was with the second button pressed hence the odd number on X and the even number on Y. I can then do my (X and 1) trick to test for the button press. Unfortunately you do have to reverse the button logic since a 1 means the button isn’t pressed and a 0 means it is!

I did various test programs. One lights up the debug LEDS, another played silly sounds depending on the position of the stick. Another draws a dot on the screen at a point corresponding to the stick position.  I actually went back to one of the old games, Death Valley,  I had already typed in and made it joystick enabled. That worked well too. So we can call that done!

The other thing I did was replace my LM7805 regulator with a more modern module using a LM2576 from Surplustonics. These are much more efficient than the old linear regulator. As long as the input voltage is a couple above the output it works well. It is set for 5 volts by the trimmer. It definitely gets far less warm. I probably won’t even need a heatsink on it (but one won’t hurt).

IMG_3156_1

You can just see on the end I attached a small bridge rectifier. That’s because I want to be able to plug in different DC supplies but not have to worry about polarity. I hate having to try to work out which way around a power supply should be wired!

Next is to start finishing Orwell off with a nice case.

 

One Response to “Orwell joystick.”

  1. Austin 7 Special » Blog Archives » Very small update. Says:

    […] new job, trying to finish my railway table (as I need that to work at!) and messing about with my Orwell computer. I’ve been on a roll with that and didn’t want to stop. He’s now ready to have a […]