Monday 31 December 2012

Sega SC-3000 (And Panasonic, again)

Sega SC-3000 (1983) is one of those gaming computers that do not have a built-in BASIC. I have some stuff lying around for it so it's not a complete waste of space. I enjoyed trying out Sindbad Mystery, one of the more decent games for the platform, a sort of Pac-Man with elements from Pengo. 

Pretty good looking for a 1983 game. The music makes me 
think of Sega's later Wonder Boy, especially when Sindbad reaches the third level.
Given that the SC-3000 does not have a built-in BASIC, it is a bit strange that there are BASIC keywords on the keyboard. Fiddling with the BASIC cart I have, I've found the speed to be reasonable, but it's a bit hard to guess what keywords there might be besides the ones on the keyboard. Apparently the higher level BASIC cartridges have more commands than the smaller ones, possibly for graphics and sound. The keyboard in my unit works so poorly that it's impossible to do anything but a few lines of code.
But what the hell are diereses?

The computer accepts good old Atari joysticks, which is good for games, as the Sega joysticks from the time are atrocious. Some games make use of the Sega second fire button, not available on all joysticks. The computer has tape connectors, a mysterious DIN-5 "video" output and a TV out. All in all, the black case is quite pretty, very flat and sci-fi. The sleek lines are greatly augmented by the flat rubber keyboard which has BASIC keywords imprinted above each key, and...

Wait a minute, haven't we seen something like this before?

JR200U keyboard
SC3000 keyboard
The rubber keyboard is suspiciously similar to the one in Panasonic JR200U. Ever since I got my Sega, I have been wondering about this feature. No, the layout is not identical, but there are enough similarities to make it certain there was some common origin for the two. I may never know the story behind this, but at least I can try to find out how similar the keyboards really are. Could they even be interchangeable?

The ribbon cable in front of JR200U. Connecting the red pins with the blue ones produces key presses.
I started the task with mapping the keyboard input of the Panasonic JR200. From the circuit board it is visually obvious how to start figuring out the columns and rows for the keyboard matrix, and after a little while of poking the connections with a short cable, I could map it for the most parts. (This way I could avoid breaking down the actual keyboard element, which might ruin it.)

Some keys, such as shift and control are left out for now, and I'm unsure about what some of the keys do. Here I have only included the keyboard-relevant parts for the table, as the rest of the 22 cables relate to the power LED, speaker and reset button.

Panasonic JR200U keyboard matrix (incomplete).
Connecting a blue pin with a red pin produces the desired key input.
Now, let's see the conditions under the hood of the Sega. The case top comes off in two parts. As the keyboard part is removed the backside of the case top can be kicked out. The insides are a bit crude, what with the bent, amorphous metal/folio covering most of the motherboard, but luckily the keyboard connectors are immediately visible. There is similar number of cables between the keyboard and the motherboard. This looks promising enough...

Removing the cover from Sega. The black wires connect the keyboard to the motherboard.
Here I found no need to examine the Sega keyboard connector, as the keyboard matrix (and a neat mod) can be found from here. I only rapidly checked that it holds true, poking a cable into the connector while running the BASIC cartridge. The table below is built using that information, assuming a running pin number from left to right, reading from the front of the machine.

SEGA SC3000 Keyboard matrix
The matrix has similarities with the JR200, especially when looking at the top half of my table. However there the similarities end. Compared to JR200 I'd say the Sega version is the messy one. Instead of the neat 8x8 matrix there is a 12x7 grid. It still might be possible to wire the Panasonic keyboard to the SC-3000, but it is not as straightforward as I had hoped. Then again, I'm not going to break my Panasonic anyway.

Sunday 23 December 2012

Texas Adios

Just a quick peek at the computer called Texas Instruments TI99/4A. It's pretty old, from 1981, based on the earlier TI99/4 from '79. This makes it something of a contemporary to Sinclair ZX81 and Commodore VIC-20.

From what I had seen from pictures, I assumed this to be a more fun-sized computer. Possibly the TI brand made me expect something a bit more calculator-like. But really, it's huge, easily MSX-sized. The appearance is quite polished and the keyboard is very solid. It seems to me that quite a few US computers went for the "aluminum/black" look, don't know what is the origin for that. (TRS-80 and Timex Sinclair spring to mind.)

Despite the good physical quality, the keyboard lacks some crucial editing keys, like backspace and arrow keys. These are hidden behind FUNC-combinations. Curiously, the " character is via FUNC+P and not SHIFT+P, inconsistent with other characters. My unit is somewhat prone to double-type, but this could be the keyboard showing its age.

For a company that is renowned for its calculators, the TI calculation keys are surprisingly not very prominent. On the right side, in front of the front-loading cartridge port, there is a flat surface which to modern eyes might look like some kind of trackpad, but is really just a flat surface. There could have been some room for a keypad, who knows. I've read on the net people call it lovingly the "cup warmer" for the heat it gives, which is good to know because otherwise I might have been worried about the warmth.

The BASIC shows numbers "as they are" up to 9999999999, which is nice.

To my liking, this computer is bit too much like a video game console with an added keyboard and a BASIC added for a good measure. The BASIC does not integrate with the computer in the way it would do in most other home computers, so it seems more like an add-on that just happens to be included with the machine. Although the expandability of the machine is apparently very good, the built-in facilities and connectors are poor, really almost nothing. For these various reasons I've not been inspired to explore this computer too much, even if it is something of a minor classic.

If I've understood correctly, the computer uses the video chip memory as its main memory. From what I've read, the central processing unit can really only access 256 bytes of memory, and the processor is - get this - 16 bit, a first in home computers! Although the setup makes it sound like TI could be potentially a fast computer, as it happens this does not seem to be the case at all. I don't have any games but at least the BASIC is extremely slow, possibly the slowest I've yet encountered. It takes virtually seconds to print a bunch of numbers in a FOR-NEXT loop. LISTings are almost like teletyped.

Using CALL CHAR to re-edit the empty character.

The command affords quite nice pixel graphics, but this was all I could bother to do for now.
I'm usually quite intrigued to explore various BASIC dialects in the old computers, and I was lucky enough to get the computer with the BASIC manual. Curiously enough the manual is a Finnish version published by Salora, who also branded Laser 200 as Salora Fellow in Finland at around the same time, but that is another story.

I was eager to find out whether the BASIC had some similarities with the "TI BASIC" included in their later calculator lines. Alas, there does not seem to be any meaningful relation. This BASIC is not really geared towards calculation any more than other similar languages back in the day. The BASIC displays large numbers in somewhat more user friendly format but that's about it.

Looking at the manual and trying out the commands it strikes as weird that there are no PEEK or POKE commands that could access the memory directly. So, the programmer can forget about inserting machine code statements via BASIC. Also, as the video chip is the famous VDP as used in MSX and the like, there's no straightforward "character memory" to mess with either. Instead, there are CALL commands for doing various helpful things that would otherwise be far too slow to do in TI Basic, such as filling portions of the screen and re-editing the character set.

As a separate product, there was some kind of "extended" BASIC and an assembler too, which presumably give more freedom to the programmer. As it is, the access to the hardware is very limited, and it's even a bit uncertain how much memory there even is. The manual boasts of the 16k memory available to the user in addition to the memory used by the TI BASIC, which really cannot be the 256 bytes the processor uses? So, what is that memory about? Also, one part in the manual warns that the memory upgrades available do not extend the available memory for the BASIC, but are instead used for the other (separately sold) extensions. Wow.

TI 99/4a is a kind of a neat kit, but allows for very little exploration and experimentation. This makes it somewhat dull, even if the BASIC command set is quite potent for its time. Although the TI is in some ways superior to both ZX81 and VIC-20 I mentioned early on, the available potential to the user is clearly inferior, at least from out of the box. To assess the gaming potential, I'd have to see some actual games. Due to the VDP chip I expect them to be quite close to MSX and Colecovision in visual appearance.

Saturday 8 December 2012

Night of the living dead Spectrum keyboards

I have started to do some groundwork for some simple 8-bit keyboard projects. The first goal is to connect an original Spectrum keyboard to the ZX Evolution computer I discussed previously. The Evolution has pins for connecting the original keyboard, and this way, a Spectrum keyboard could be used for an authentic gaming experience.
ZX evolution keyboard input pins.
1-8 for rows, 10-14 for columns. (9 is for Reset) The rest are for Joysticks.
The figure is borrowed from the ZX Evolution manual.

Spectrum keyboard membrane, colour coded for columns and rows. 
Each of the 40 keys completes an unique connection between the 5-lane and 8-lane pathways.

With the original Spectrum, the 40 key switches are connected to the motherboard with two pathways, one with 5 lanes and the other with 8. Crossing these forms a matrix that the computer can use to decipher which of the 40 switches are pressed at a time. For those interested in the Spectrum keyboard matrix and the membrane logic, I can refer to this blog post.

Yes, it's a bit crude.
The 20 pins in the ZXevo port handle both joystick input and the Spectrum keyboard inputs. For example, my first joystick adapter is pictured above. The thirteen not-yet connected wires ought to be continued to the membrane. My approach is to do this Franken-adapter first, and if it works, do a better and more interesting solution.

My perhaps biggest concern is how to continue the fragile membrane material with wires. This could be easier with the proper parts, but I usually go first to my existing collection of junk parts. (As can be seen from my joystick adapter.) There is a certain type of connector inside the ZX Spectrum that does the job, but I do not have those kind of parts available. So, I used the two connectors I happened to have:

This image shows the piece of balsawood that fastens the membrane to the connector.

These connectors are too wide so I insert the membrane pathways along with a piece of soft balsa wood. Notice also that the membranes are one-sided. There is also a possibility the connective material in the membrane wears off with too much inserting and removing. I used a broken membrane for practice so I would not ruin a working one. (It's very common for old Spectrum membranes to have some of the pathways broken.)

The "key" chosen for testing is marked with an arrow. This is the key "5" on the Spectrum.
The sharp-sighted might note that my connectors look like ZX Spectrum peripheral connector parts. Indeed they are cannibalized from old joystick adapters. Hopefully I do not need to waste both of the connectors for this project...

I have connected two chosen pins to a multimeter. This way, I can check one key on the membrane I want to use as a switch to complete the circuit.

Pictured from the other side, testing the connection. Give my creation life!

It's not so straightforward to understand how the 8-bit computer reads the keyboard. In this respect, the above test is a bit misleading, as there are no 40 inputs inside the Spectrum which could all be individually read. Thankfully, in this project, this does not need to be deciphered. My task is just to continue the membrane wires to the corresponding pins on the ZX Evolution motherboard. The test was only about the physical connection between the membrane and the electric cables. 

Connecting the keyboard membrane to the ZX Evolution

The test was promising enough so I went forward with building a complete keyboard connector. I cut one of the peripheral connectors in half, so I do not have to waste both of them. I am using a raster board for keeping the connectors in place, and some terminal blocks for joining the cables at the other end to the same plug. I did not want to solder anything at this stage. This turned out to be a good idea because the connections ended up wrong. My terminal blocks are a bit too large for this kind of work but I will eventually abandon them anyway so it does not matter.

A bit difficult to keep this all in position...
As the membrane is connected to the ZX evolution, it becomes apparent that something is wrong. Promisingly I can get some key reactions, but everything comes from the wrong place. At first I thought I might just have got the pathways in reverse order, but no.

I ended up checking the connections directly from the ZX evo pins, connecting each row pin with each column pin with a piece of wire to find out what letters are then displayed on the screen.

It turns out the ZX evolution manual could have been more helpful here. Although the five lanes are in a direct order, as implied by the manual, the eight lanes are really not. I clarified my findings on a piece of paper, tracing each connection explicitly to the motherboard pins. The order is shown below.

The ZX evolution keyboard input port. K1-K8 connect to the wide membrane pathway,
and the D0-D4 to the narrow. Pins 16-20 are for joystick.
As I rebuilt the connections, I could finally use a proper ZX Spectrum keyboard. Now, all the keys work. However, the keyboard can't be really used yet, as this version of the connector is so poorly built. The contraption now needs to be put inside the empty Spectrum case. 

I am already happy to note the Spectrum keyboard input does not disturb the PS/2 keyboard in any way. The Spectrum keyboard can be connected at all times, and all the Evo functions can be accessed from the PC keyboard if needed.

It looks slightly infernal...
Closing the case

I replaced the Spectrum motherboard with the electronics board. I also made sure I could screw the board in place if I want to. There is only one screw that connects the motherboard to the casing, so this whole thing is a very clean to do. I have in no way ruined the original Spectrum, and will probably return all the parts after I've toyed with this result.
The view from under the hood.

I soldered the connectors to the board. I turned the connectors sideways, because otherwise they would not fit inside the Spectrum casing. I had to bend the pins to do this. As the two membrane pathways have the contact surface on a different side, the connectors also face into different directions. I have removed the flat cable connectors and soldered wires directly using the board underside, and these wires now go to the screw terminal block that brings the wires to the ZX evolution. In some ways the setup is more comfortable for the membranes than in the original. These are a bit difficult to insert, though, but that's mostly because of the silly balsa wood solution.

Playing "Bruce Lee" on the ZX evolution with the rubber keyboard.
Carpal tunnel syndrome, I welcome thee!
Was it really worth it? I mean, back in the day people usually went through the trouble to replace the original keyboard with something else. But anyway, the keyboard works as intended. The squishy rubbery feeling is almost a part of the genuine Spectrum games. Playing with something else would be almost like cheating!

I still have some points to consider. If I really want an "authentic" experience, the sound ought to come from inside the case, too... I have assumed my board works with the Spectrum+ and 128 varieties, but I have not tried it out yet.

Eventually, I hope to understand the Spectrum keyboard for connecting some other keyboard to the original ZX Spectrum, or just generally swapping different 8-bit computer keyboards with each other. With computers such as Laser 200, Spectravideo and Spectrum this ought to be doable as the keyboard "modules" usually do not contain any electronic parts, just the connection matrix. The why of such a project might be a bit unclear, but at least in the case of Laser/Fellow it would improve the existing keyboard greatly, and it would be simpler to build than a PS/2 or USB adapter. Anyway, making such a swap would mean rewiring an entire keyboard matrix, so I am not going to do that just yet.