Saturday 30 September 2017

Assembler

I've written a Python assembler for the COP444. I think there might be one in Alfred Arnold's AS assembler, but it's not clear, and anyway it's not very long winded and it's harder to hack it the way I want.

It's a one pass back-wiring assembler, which means that it just saves all the Jump and Call routines and patches them back in at the end when all the labels are defined.

It's mostly fairly straightforward though the Jumps and Calls are a bit peculiar. Outside $80-$FF the opcodes $80-$FE are jump in page, and call in page 2 - so very regular calls can be reduced to a single byte opcode, but in that range it is a jump within pages 2 + 3.  Like most 4 bit microcontrollers it works in 64 byte pages, though unlike many it does allow code to just run from one page to another. A TMS1000 only has a 6 bit program counter and a 4 bit latch, rather than a full 10 bit program counter.

I've also started on an emulator for the COP444 ; this again is fairly straightforward apart from this Jump/Call peculiarity.  Hopefully in a couple of days there will be some actual working code up.

Thursday 21 September 2017

The Keypad.

So, as far as is possible from the available information, I've got a fair idea how the display, game select and sound works.

We're left with the keypad. We have three unused input lines IN1,2 and 3 and several output lines.

So obviously there's going to be some sort of matrix using the input lines ?

Well, nope, there isn't. If you look at the PCB you will see the IN 0 1 2 and 3 tracks. They are the 5th and 6th from the left. IN0 , which is the 5th from the left on the top, is connected to the display connector and a pull down resistor.

The other three form a "mini bus" of three lines, which head up the right side of the board - you can see them between the two connections of the ground line for the display connector, to the right of "REV 0 3".

This had me baffled for a while. There's a connector up there, which looks to be about four pins, which isn't used for anything. The keyboard connector is the seven pin one roughly dead centre, this is below the MCU chip. If those lines ended up there you'd see it on the component side.

What I noticed when reading the COP444 database is this chip has two serial interfaces. The second one is called "Microbus" and uses the IN1,2 and 3 lines. In this mode these become the strobe lines and data is passed in and out using the L-lines. I'm guessing here, that this is some sort of debugging, or testing system, or even maybe an expansion system ?

This still leaves us with the inputs. By a process of elimination, the only thing that the keyboard can be connected to is L ; D + G just aren't available electronically - physically on the PCB. L is handily placed and there are some resistors which look like they might handily connect to the keyboard connector (more obviously in the prototype).

There is a problem though. L lines are either inputs or outputs, but they are all inputs or outputs - so INL (input L) appears to switch everything to inputs. To put a matrix keypad on L we need some inputs and some outputs.

The trick is I think that it is possible to use the outputs as pullups for the inputs, but only if you use the Low current Tri-State "L" output (type e). The output types are set at ordering time.

EN2 needs to be set and importantly the Q latch lines need to be set to logic '1'. So I think these are controlled individually - the pull ups are connected through a matrix to high impedance inputs  which are a type of output that doesn't operate as a pull up so it reads the pull up or pull down, depending on the connections through the matrix, this gives us a 4x4 matrix, which we can read by only putting one pull up on. The resistors may well provide a pull down for the lines where the pull ups are not activated, but a pull up will override a pull down voltage level wise ; it is a sort of output.

There are seven connectors on the keyboard cable. There are four directions, numbered 1-4 a fire button, a skill button and a 1/2 player button.

There appear to be no diodes, so the usual keypad problem of pressing 2 keys at once can create spurious inputs will occur.

I'm presuming therefore that there are four seperate input lines for 1-4 which take up one pull up line, three seperate lines for start, skill, and 1/2 player detected by a second and one on its own for fire. Because fire is the only button connected to an input, it operates independently.



So , completely arbitrarily really (mapping 1-4 onto bits 0..3 is kinda logical), but the rest .... well it's an educated guess.

L7 set to pull up

Key 1 (Up) : L0
Key 2 (Right) : L1
Key 3 (Down) : L2
Key 4 (Left) : L3

L6 set to pull up

Start : L0
Skill : L1
Players : L2

L5 set to pull up

Fire : L0

Wednesday 20 September 2017

Selecting the game

Top and Bottom PCB, low resolution, probably final version
The Atari Cosmos actually has all the games built into it, so a method is required of actually selecting which game to play. The solution is on the top left of the display board, shown here on the left, the five pads are contact pads for wiring on the "cartridge" - which is actually just the holographic dual image in some kind of box.

There are four potential Input lines IN0..IN3 remaining on. If you look at the PCB picture from the last post you will see the fifth from the left on top goes up to the display connector via a resistor - this is the far left connection on the display connector on the PCB track side. This is pin 19, IN0. I conclude this line is the game selector feedback and there are four outputs, each of which are interrogated in turn by raising an output line. If a signal comes back in IN0 that pad is connected, giving us a 4 bit binary number.

It is probable, no more, that this is the D line, because there are 4 D bits going to the display card and 3 bits on the G line, it's easier again on code space. It is possible that one line is 'on' when a cartridge is plugged in and the other three game select. In which case it might well be 3 G and one D line, who knows.

Of course, without either cartridges or a ROM dump there is no way of figuring out which game is which bit pattern, but we'll get round this with equates or something.

Tuesday 19 September 2017

The display interface

Note : if anyone reads this and thinks I've done something obviously wrong, please tell me - I'm not really an electronics guy.
Atari Cosmos PCB, track side
This is probably the single most useful image I have. It not only shows some of the connections and wiring but gives hints as to others. This is a single layer single sided PCB, so tracks must go in the direction of things that use them - or there needs to be a corresponding wire on the top side of the PCB.

COP444 Pinout
So, the first and most obvious thing is this is the flipside of the COP444. It's pinout is on the left (hopefully ....).  Bearing in mind it is upside down - e.g pin 1 is the lower right pin (you can see the 1) we can see the lines D0-D3 and G0-G3 on the top right of this PCB.

Seven of them, representing the seven columns (or seven segments) are connected to resistors (that go over the ATARI INC label) and straight into the Display Connector.

It is highly likely that these are the connectors to the display columns (think of it as a 7x6 array + the 7 segment displays). Nothing else makes sense.

I don't know how the wiring is done, but for the sake of programming sanity it is likely to be G2 G1 G0 D3 D2 D1 D0. It might not be - sometimes designs are done for ease of wiring and it's sorted out in the software - but there are so many complex wires in the display board it doesn't seem like it would matter and when you are cramming 8 games into 2k of 4 bit code then that's your low resource.

G3 is not connected in the same way - this is the track that heads off to the top left corner for a bit, and I think, connects to the track between the words www and atari (I must give references for these pics), after which it heads off left.

This, I think has to be the line that selects which of the two holographic displays to be used (the Cosmos has an overlay for the LEDs and can programmatically display one or the other). It's off in the right direction, and it is not the same functionality as the other G and D ports.


On the bottom side, mostly are the L-lines. These are bidirectional I/O lines. The
LED Driver circuitry using transistors
first two L0 and L1 which are the two most extreme left pins are connected to 0V via pull down resistors. The rest of the L lines seem to head off left and top left.  This direction, and some resistors, and the fact that there are conveniently 8 of them, suggests that these are the row drivers - there are 6 rows plus two seven segment displays. There are 8 transistors in the top right of the board (looking at the component side) and resistors and transistors that suggest this arrangement shown on the right (hopefully) where A0-A6 are G + D and B0-B7 are L0-L7.  Again, I do not know which row or display is connected to which L-line.  I am working on the principle that the 6 LED Rows are L0-L5, L6 is the left digit and L7 the right digit, and the segments are in standard form, but actually this doesn't matter as it'll be driven from two lookup tables.

This doesn't leave much. The two clock inputs, RESET, the power lines,  the four input lines IN0-3 and the Serial I/O connections to the Sound Microcontroller. (SK SO SI).

There's two outstanding issues. First is the game selector , and second is the keypad layout. This latter is, well .... interesting.

Irrelevancy: The COP444 has an "OMG" instruction, which is coincidential (it's too old) - it outputs a Memory Nibble to the G port, which belongs with HCF and SEX. I'm sure they weren't accidents :-)

Monday 18 September 2017

Hardware Introduction


A nice pic of a disassembled prototype / development Cosmos. I'm going to run through the hardware in outline and then do a bit more detail .... what I think is the detail anyway.

Some of it I just don't know at all, without being psychic, but much of it can be deduced to the extent where you can code for it if you use constants in the assembler code. (Except for the sound ... other than it uses the serial interface I have no idea how it works at all)

As an example, it's impossible to deduce which bits are up down left right on the keyboard without either a ROM dump (and nobody's going to do this !) or access to the PCB and a multimeter (and they're not going to do that either). I sacrificed a cartridge for the Microvision archiving effort (you have to destroy them) but with Cosmos systems going into 5 figures .... not going to happen.

Sometimes this is ropey. I have occasionally made deductions on other machines based on the concept that the designers weren't idiots, and sometimes they've been ... idiots. However, there are some top brains behind this machine, so I suspect it is intelligently designed. Assuming this helps :)

I do have some close ups of bits of the PCB. It is single sided which is quite handy, because you can deduce some things from the single-sidedness - if a signal can't get to the keyboard connector, it can't actually be part of the keyboard circuitry.

The processor. Now virtually everything on the Cosmos gets this wrong ; it isn't a COP411, it's a COP444. You can see it left/centre on the main circuit board with the gold square. It's a 28 pin chip, and a COP411 is a 24 pin chip. The close ups also have "COP444" on it ;-)

I'm not surprised because even a COP444 only has 2k of ROM built in and you have to fit 7 or 8 games (can't remember) into that. Even at a low level of complexity that's not easy.

There is actually a COP411 on the board though. You can't see it in this picture (it's underneath the orange toggle switches on the right/centre. It's an arrangement like the Entex Adventurevision, the little MCU generates sound effects. The two are connected by a protocol "Microwire" which uses the Serial I/O pins on the processors.

Just below the processor, in the middle, is a 7 pin connector that loops round via the ribbon cable and connects to the keypad on the front of the unit.

Below that is the Power Supply unit (most of the left hand side, (and presumably the two capacitors !), and there's a plug on the lower right (which is soldered here but is another connector on the production board) which is connections for the odds and sods - speaker, image selector.

Immediately above the main MCU there is a seven resistor array which connects directly to the display connector (it's the red thing you can just see peeking out from the bottom corner of the display board) and on the top right of the circuit board are the current drivers for the rows. There's 7 across and 8 down (actually 6 down and two seven segment displays).

The thing with the LEDs is the display board, with its 7 x 6 grid and two 7 segment displays (the white box). Directly above this you can see 5 circular pads. These are the contacts for the "cartridges" (actually just the holographic images). Connecting one or more of these pads to the input line (probably the rightmost) selects the game to play - the games are already built into the processor.

This is the purpose of the orange toggle switches - they are a development hack so you can 'select a game' (e.g. connect the pads to the input) without actually having to have different cartridges ; the push button is probably connected to Reset.

The connector is the 16 way ribbon cable that goes round the back of the PCB and plugs into the just visible display connector.

On the right hand side, the grey box is - maybe - the hardware for selecting the 3D Holographic image - the Cosmos can display one of two images. These vary - sometimes it's a game and a game over screen, sometimes it's two ends of a football field.

Below that, obviously, is the speaker.

The other connector that you can't see is a little one immediately above the display connector. This one had me baffled for ages..... more on that later.

Saturday 9 September 2017

Introduction.

This is my Retrochallenge for October 2017 ; to try and recreate a version of the Atari Cosmos. The picture is of a dismantled ones.

There is not a great deal of information available about this console to put it mildly, and there isn't likely to be anything like a ROM Dump, because there are something like 5 of them in the world, only 2 of which have actual electronic bits in them.

The going rate on eBay was something like £20,000 ..... so I can't see anyone handing over a COP444 so Sean or Kevtris can decap it. If I'm lucky I might get a high res scan of the main board (I have a highish res scan of the bit around the MCU which is quite useful)

It comes from the LED games era - the screen resolution is 7 across by 6 down, the unusual feature of this machine is that it had a holographic display which was superimposed on the LEDs.