Sunday, 21 August 2016

Atari 65XE USB Keyboard and Joystick with Raspberry Pi 3

Trying out a few new ideas on another Raspberry Pi / USB keyboard / USB joystick case mod.This is an Atari 65XE, the replacement for the good old 800XL, with the styling that led to the ST.
This is quite a nice case but unfortunately has one of the pegs on the cartridge port has snapped with mean cartridges do not fit properly. There is also a memory fault and some of the keys aren't working, so I'll put the board aside to repair later.
I started with the cartridge port and removed the other side and sanded both smooth. No particular reason, just like things to look tidy.
Next came the question of what to fit where. I knew I needed to fit in a Raspberry Pi 3, with access to power and HDMI, a USB hub, a USB keyboard controller and a dual USB joystick board.
The Pi worked out quite well, I found it fitted through three existing holes, if mounted upside down. This also give easy access to the microSD card when the cover was removed. I had to extend the round power connector into an oval to fit the HDMI connector, but the others lined up.
I've found on Atari computers before that the SIO connector cutout is the ideal size for a 4 port USB hub, so I fitted one there.
That limited the options for the joystick though, I do have a dual USB joystick PCB which would fit the two joystick port cutouts, but it would clash with the USB hub board.
I did consider fitting the USB hub board upside down, it would then have fitted, but the USB joystick board would have clashed with the case mounting pillar. Another option, I considered was the new version of my USB joystick adapter board.
I upgraded the processor in this to give some analogue inputs for paddles etc. There were sufficient spare pins so I designed it so it could be used as a dual USB joystick with a detachable second port. Useful for things like the Atari 800XL where the spacing is different.
This also would clash with the USB hub, so back to the drawing board. I ended up using two of the extension boards from this and a USB keyboard controller board to make a dual USB joystick.
Those boards all now fitted in the case without blocking each other or the mounting holes. As usual, I'll add a load of hotmelt glue to hold those firmly in place.
The final piece was the USB keyboard controller. That fits under the keyboard as the membrane ribbon the the 65XE is quite short, and in this case I had to cut it even shorter as there were a couple of damaged traces on the membrane (which is why some of the keys weren't working when I tried it on a working 65XE board).
I have been unable to locate a supply of the 24 way 0.1" membrane connector, so I have to make these by cutting down two shorter ones and joining them. The additional resistor is for the power LED on the front of the keyboard.
This sits on the back of the keyboard, the placement is important, to avoid a support pillar half way up on the bottom of the case which can clash with the USB connector.
Everything fits together, so time to bolt in the Raspberry Pi 3. This covers one of the mounting holes, so I had to cut off the post that sticks down from the top of the case. The three USB cables plug into Pi, leaving one free port available. I've not wired up the LAN jack as the Pi 3 has built in Wi Fi.
There is still space for the mounting pillar at the other side, between the ribbon cables of the joystick boards.
With the lid fitted, time for some testing.
Power and HDMI or composite video on the left, USB devices plug in on the right.
Joysticks plug in at the side, any Atari or Commodore style 9 way D joystick will do, other than the 7800 and the Spectrum +2 / Amstrad. I can modify the firmware to use these if required, let me know when ordering.
I supply these with the official Raspberry Pi 3 power supply, 5V @ 2.5A with UK/US/EU plugs. I prefer these as there are still lots of rubbish USB phone chargers and under rated microUSB cables around, so I know these work well with the Pi 3.
The Atari 65XE USB keyboard with and without Pi and with and without joysticks ports can be found on my Etsy Store. If you are interested in another configuration or another computer, contact me.

Sunday, 14 August 2016

PET LCD

This is something I've been working on for a while, and have finally put it all together.
The top half is a 6502 socket, with pass through, a GAL chip, some DIP switches, 32K RAM and a ROM chip with various ROM images on. The RAM and data bus buffer/switch are hidden under the chips. So far it is basically a squashed up version of my 6502 ROM/RAM boards.
The large chip is a 1K dual port RAM chip. That is 1K of RAM which can be independently read and written from two different address and data busses. One side is attached to the PET bus, where it sits at 0x8000-0x8400, the screen RAM. It is configured as write only, so whenever anything is written to the PET screen RAM, it is written to the board, and to this copy of the RAM.  This is the result of writing 0,1,2,3,4 etc. to the video RAM.
The PET video system is a fairly simple character based 40x25 display, you write characters to the 1K screen RAM buffer and they appear on the screen. No pixel based graphics or custom characters can be shown, it is limited to the 256 characters in the PETSCII character set. Well, sort of, there are two character sets, normal and graphics, which can be selected by an IO line which drives an address line on the ROM. It's actually 128 characters, plus those 128 again but inverted.
There is almost an isolation gap between to top and bottom halves of the board, with only power, and reset joining them, Yes, there are a couple of bodge wires, and an annoying bodge resistor. I had one pin pulled low on the schematic that should have been pulled high, so it was attached to the ground plane. I ended up drilling out the pad and wiring the bodge resistor directly to the pin.
The other side of the RAM chip is attached to an ATmega1284P microcontroller running at 20MHz. This is connected via a 3.3V level shift to a 2.2" 240x320 LCD module.
What does all this do then? Well, if you plug this into the CPU socket of a PET, whenever the PET writes to it's video RAM, it will also be written to the dual port RAM chip. The microcontroller is continually polling this RAM via the other port and converts that to a display on the LCD.
You effectively get a copy of what is on the PET screen on the LCD, updating in real time. To generate this, I have converted the PET character ROM into a data array and draw each character pixel by pixel on the display. The 240x320 layout fits well with the 40 character, 25 row display, each character is 8x8, so 40x8 = 320, 25x8=200, with 20 pixels space top and bottom. This gives a very clear, pixel perfect version of the screen.
 In business graphics mode, the PET introduced two pixels gap between the lines, so this can be fitted in to 225 pixels. I've fixed it in the graphics character set for the moment, as it needs to tap off a one of the pins on the VIA line to change font, I'll be adding that to a later revision, probably by duplicating the port with a single 8 bit register or even just a single flip flop.
This opens up a lot of interesting potential. This is really proof of concept stage. The initial idea was this would be a diagnostics tool. You can plug this into any PET and see if it is running, even if the video output on the PET itself isn't working, as long as it is writing to screen RAM, this will show the state of the system.
It can also be used in conjunction with my 6502 diagnostics board, and will show the results of ROM and RAM testing on it's LCD. So even if the ROM, RAM and video display are all faulty, it should be possible to diagnose this and fix it bit by bit.
Since this is a 40 column display, it's also a potential way to add a 40 column display (albeit a small one) onto an 80 column PET. The board has various ROM sets on there, so the 40 column editor ROM can be selected and the PET will run in 40 column mode. The actual monitor will show the wrong thing, but the LCD will show the correct output.
The update rate is reasonable, fast enough to play space invaders anyway. I tried a few demos, and they all ran OK. This is just the first testing, I imagine I can streamline the code to make updating a bit faster.
Another thing to consider is now that I have a way of collecting the screen data, it could be used to drive something larger than this LCD. It could instead be sent to an HDMI monitor or even generate a video signal for the PET monitor or a composite output, although I think I would need an external shift register to handle the pixel clock rate. Lots of potential though.
One final thought, this is a 6502 CPU, ROM, RAM and a display. Stick in clock, reset and some IO, and you've got yourself an SBC. Add the appropriate ROMs and IO and you've got yourself a mini PET........

Tuesday, 9 August 2016

Commodore 64C USB Keyboard Kits

I've had a few questions about my Commodore 64 USB Keyboard kits, and whether they are suitable for the later shape C64C. The answer if yes.
The controller board and firmware is exactly the same, mounted in the same location.
The only change is on the mode switch version of the kit, which is provided with a rectangular tri-colour LED, rather than the usual round one for the breadbin case.
I also supply grey / cream USB cables to better match the case, rather than the black ones supplied with the C64 / VIC20 / C16 version of the kits.
The complete kit comes with the cable and mounting feet. The mode switch version also includes the replacement power LED to show the mapping mode.
This lights up green in normal mode, where the keys are mapped to make best use of the keyboard for normal use like web browsing on writing blog articles. When a key is pressed in this mode, the symbol marked on the key will appear on the PC (or Mac or Raspberry Pi etc.). The arrow keys work as the original. down and right, or left and up if you press shift.
In this mode the keys give the right symbols with and without shift (i.e. shift + 6 gives & as marked, not ^ as on a PC keyboard). The left shift key and right shift key work differently on some keys to give more options (e.g. F1, + left shift = F2, F1 + right shift = F9 and / + left = ?, / + right = \). This means F7 + right shift gives F12 which is the menu key in the Vice emulator. Full key mappings shown here.
When you press the mode button, it changes to red for emulator mode where all the keys are mapped so they will work with emulators such as Vice which use a positional mapping.
In this mode each key works directly in the emulator as if it were a real Commodore 64, seen here in this handy Commodore 64 keyboard tester.
When doing these USB keyboard conversions, I occasionally end up with a C64C without the keyboard support brackets. These normally screw to the base over the mainboard, and the keyboard rests on them. An alternative solution that seems to work quite well is to use 30mm M3 pillars, screwed to the four holes on the top of the keyboard.
The keyboard sites in a groove at the front which hols it firmly in place so the pillars just provide support at the top. I usually add a little hot melt glue to where they sit to hold them in place, although they don't seem to need it.
The kits can be ordered below.


Standard USB keyboard kit.

The standard kit version comes with the controller, adhesive pillars and a USB lead (black C64 version shown). This can be installed on the back of the keyboard, with the original power LED cable connected to this board to light up when the USB is connected.
It can also be mounted in a few places inside the case so the USB connector is externally accessible.
The kit can be purchased using the button below, select the appropriate keyboard mapping and postage option (first class signed for within the UK or international tracked and signed). This is suitable for Commodore 64 and VIC20, Commodore 16 and Commodore 64C.

Keyboard Model
Keyboard Mapping
Postage option

USB Keyboard kit with mode switch

If you are planning to use you converted Commodore 64 / 64C / VIC20 / C16 with an emulator such as Vice or CCS64, go for the version with the mode switch (black C64 version shown).
The kit for this includes the controller, mounting pillars, USB lead and a replacement power LED which will indicate the mode.
This is best fitted where the mode switch can be pressed, either through the IEC and video ports, or the expansion port. The replacement LED fits where the original was.
The kit can be ordered below, select the appropriate model and postage option (first class signed for within the UK or international tracked and signed). This is suitable for Commodore 64 and VIC20, Commodore 16 and Commodore 64C.

Keyboard Model
Postage option

USB Keyboard and dual joystick kit with mode switch

There is also a version with dual USB joystick ports that can fit in the C64C case. C64 version shown, the C64C version has the rectangular LED.
The USB connector can be supplied to exit externally from the square hole where the power connector was, or internally to be trailed out the back, or connected to an internally mounted Raspberry Pi etc. This can also be used with the Commodore 64C, although the keyboard support brackets may need slight modification to fit over the joystick connector.
This is available as a kit, containing the USB keyboard and dual joystick controller, mounting pillars, replacement LED and USB lead.
The kit can be ordered below, select the appropriate model and postage option (first class signed for within the UK or international tracked and signed). This is suitable for Commodore 64 and VIC20, Commodore 16 and Commodore 64C. Note this is designed for the Commodore 64 end plates, so the VIC20 and C16 metal end plates will not fit. You can either remove these or use one from a C64. (yes 9 way D joysticks on a Commodore 16!)

Keyboard Model
USB connector
Postage option

If you want to support this blog, you can donate via Patreon or Paypal, or buy something from my store.