Gigatron fully open source

The Gigatron TTL computer is now fully open source! The source code had been open source (BSD license) since the beginning of course. A while ago, we published the design files for the printed circuit boards, both for the Gigatron and for Pluggy McPlugface, the PS/2 adapter.

We have now also made the full Assembly and User manual available online, under a CC-BY-SA license. The assembly manual contains the list of components, which is now also available separately as a Bill of Materials under the same license.

These files should enable to you make your own Gigatron. The only part that is no longer available is the custom made wooden enclosure.

If you decide to build your own Gigatron, we won’t provide support. But we do encourage people to go down the rabbit hole 🙂

1000!

Almost a year ago, we had sold over 500 Gigatrons, much to our own surprise. Since then, a lot has happened. We now have 6502 emulation and the Gigatron can run Apple-1 code, such as WozMon. We have BASIC running and there’s a great BASIC compiler, opening the way to create great games. Looking back on the original goal to play tic-tac-toe on a LED matrix, we are super chuffed that we have a system running BASIC that feels like an actual homecomputer from decennia ago – still without a microprocessor.

And today, Gigatron #1000 has found a new owner! Thanks to everybody for making happen what we could not have dreamt of when we started!

Future of the Gigatron

We are nearing the end of our current stock of Gigatrons. I suspect stock will last for a few months from now. We have decided to stop selling kits once our current stock has been sold. For us, the Gigatron was always about inventing new things, understanding technology, designing, fine tuning, tinkering, and also about meeting like minded people. Making it into a kit had its own charmes. Packaging and sending out kits resembles a plain job too much, but was needed to create a community of people that would also want to design, understand and tinker.

That community now exists, and wonderful things have already come from it, both hardware and software. So we will stop selling and providing support in a few months. Does that mean you can no longer get a Gigatron? No, you still can, because the PCB layout, the schematics and the software have all been open sourced. The only thing you probably cannot get is the wooden case that we had tailor made for the Gigatron. Somewhere in July or August, the assembly manual and more will published on an open source license as well. We hope the Gigatron will live on!

More about the ROM

After 360 commits my coding frenzy has reached a conclusion: ROM v1 is feature complete! The kit will ship not with one but two fast paced games: Snake and Racer. Sound improved and the serial loader is reliable, which is great for hacking and making more games. The fractal program now doubles as a clock, to give a valid excuse for keeping a unit on permanent display in the living room.

The unused ROM space is filled with three classic hires images from my previous projects. By packing 4 pixels in 3 bytes I got three images in where the ROM otherwise would only have space left for two.

This doesn’t mean the to do list is empty, far from that: “make todo” lists 90 ideas I apparently still have in mind. But after 6 months of breadboard prototyping, 3 months of PCB design and 4 months of software hacking, this is a good point to shift focus again. For example, towards demonstrations, tutorials and documentation. Keep you posted.

– Marcel

ROM, videos and lecture

Lots has happened. Yesterday evening, the software has reached the alfa testing stage. You can find the source in Github. (You can use the visualizer that Martin Sedlák made to run it on your PC while you are waiting for your own Gigatron.)

The assembly videos are now available on YouTube. It is a series, in which I go through all the steps to build a Gigatron. These steps are also explained in detail in the assembly manual that comes with the kit.

At the Hacker Hotel conference, I talked about the Gigatron and people were excited about it! We are excited too, as we are reaching the point where we can actually sell a batch of Gigatron kits. If you want to be informed, subscribe to our mailing list.

– Walter

Instruction video

While Marcel is busy with the software, meanwhile I am working on over an hour of video footage on how to build the Gigatron. Actually, the 48-page assembly manual that is supplied with the kit already contains all that is needed to understand the electronic components and how to place them, how to solder and how to test the Gigatron during the build process, but we like to make this system as easy as possible to build.

– Walter

Wrapping up the software for ROM v1

The software to be included with the kit release later this month is nearly done. Just in time as we’re now also waiting for the last parts shipment to arrive, expected in two weeks. When those are good we know if we can meet our target selling price and will announce it to those interested on the mailing list. All other parts are in house already, manuals printed, packaging ready and beta tests successfully completed. Our living rooms look like a warehouse now.

Of course the kit will ship with some demo applications built-in. My focus is for a part still on those, but equally important is that the programming core is stable and tested. For me it is crucial that the memory map is well-defined and the 16-bit interpreter is fully tested and useful. After all, the vCPU opcodes are jump offsets, so it will be impossible to fix any of that later while maintaining compatibility as well. Last week I found I had some unused space in the interpreter code page, so I added some new bit-wise logic instructions and support stack variables. Surprisingly, none of the applications I wrote so far needed those.

To test, I ported my old n-Queens solver. It exercises bitwise logic and recursion, so it is a good test for these new instructions. On the screenshot above you can see it gets the correct answers for the sequence. The solver uses 5 stack variables. That, plus one for the the return address, gives 12 bytes per invocation. With the stack living in the top half of the zero page, this means we can go 10 levels deep. The solver needs less than a minute to compute the list, or at about 850 recursions per second. [Edit: I just figured that it should be easy to go down to using 4 variables or 10 bytes, and with that up to 12 levels deep.]

Although 8-bit assembly programs must be programmed in the EPROM, interpreted programs run from RAM. The built-in applications are of course stored in ROM also, but they are loaded into RAM first, so they use the ROM merely as a disk. Interpreted programs can also be loaded into RAM directly over the input port, and this is how you can program the Gigatron without using an EPROM eraser and programmer. For this I hook up the input port pins, that normally go to the game controller, to a simple Arduino. The Arduino can send data at the same rate as the horizontal sync. With some checksumming overhead, this boils down to exactly 28k8 payload bits per second. Much faster than loading C64 programs from tape back in the day… (3000 baud with speed loaders!)

The loader was the last part of the software that needed debugging with a scope.

– Marcel

Mandelbrot from TTL

I got a bit stuck with the work I was planning for today, so I wrote something else to regain motivation: a fractal! Rendering takes a while, being fully interpreted and lacking multiplication, and even without the “right-shift” operation you badly need for this. All those must be mimicked with slow high-level code using just addition and subtraction.

It should be easy to speed the whole thing up a lot just by adding a right-shift assembly function. Next time… GCL source code:

{-----------------------------------------------------------------------+
|                                                                       |
|       Mandelbrot fractal                                              |
|                                                                       |
+-----------------------------------------------------------------------}

gcl0x

{
  Plot the Mandelbrot set

  - 160x120 pixels and 64 colors
  - Faithful translation of mandelbrot.c pre-study
  - Use 16-bit vCPU math as 7-bit fixed point arithmetic (1.00 -> 128)
  - Implement multiplication in interpreter
  - Implement shift-right in interpreter as well
  - A bit slow (8242.655 seconds)

  XXX At the end change all to grey tones and redo
  XXX Redo at different sections
  XXX Tone for every pixel value
}

{-----------------------------------------------------------------------+
|                       RAM page 3                                      |
+-----------------------------------------------------------------------}
$0300:

{ Pretty accurate multiply-shift ((A*B)>>7), but it can be off by one }
[def
  push

  {Extract sign and absolute values}
  0 sign= C=
 {0}A- [if>0 A= 1 sign=]
  0 B- [if>0 B= sign 1^ sign=]

  {Multiply}
  7 shift= {Pending shift}
  $200
  [do
    bit=
    -$4000 C+ [if<0 C C+ C= else {Shift prematurely in an attempt to avoid overflow} B ShiftRight! B= shift 1- shift=] {Add partial product} A bit- [if>=0
      A=
      C B+ C=]

    bit ShiftRight! if<>0loop]

  {Shift}
  [do
    C ShiftRight! C=
    shift 1- shift= if>0loop]

  {Apply sign to return value}
  sign [if<>0 0 C- else C]

  pop ret
] MulShift7=

{ Calculate color for (X0,Y0) }
[def
  push
  0 X= XX= Y= YY= i=
  [do
    i 1+ i= 64^ if<>0           {Break after 64 iterations}

                                {Mandelbrot function: z' := z^2 + c}
    X A= Y Y+ B= MulShift7! Y0+ Y= {Y = 2*X*Y + Y0}
    XX YY- X0+                  X= {X = X^2 - Y^2 + X0}

                                {Calculate squares}
   {X}A= B= MulShift7!          XX=
    Y A= B= MulShift7!          YY=

    -$200 XX+ YY+ if<0loop] {Also break when X^2 + Y^2 >= 4}
  i
  pop ret
] CalcPixel=

{-----------------------------------------------------------------------+
|}\vLR>++ ret{          RAM page 4                                      |
+-----------------------------------------------------------------------}
$0400:

[def
  push

  $7ff p= {Start of video (minus 1 to compensate for 1st step)}

  -323 X0= 3 DX= 161 Width=  {Horizontal parameters}
  -180 Y0= 0 DY= 120 Height= {Vertical parameters}

  [do
    {Length of next segment, either horizontal or vertical}
    DX [if<>0 Width 1- Width= else Height 1- Height=] if>0
    [do
      len=

      {Step in the fractal plane}
      X0 DX+ X0=
      Y0 DY+ Y0=

      {Matching step in video frame}
      DX [if<0 p 1- p=] DX [if>0 p 1+     p=]
      DY [if<0 -$100 p+ p=] DY [if>0  $100 p+ p=]

      63 p. {White while busy here}

      {First check if we are inside one of the main bulbs for
       a quick bailout (Wikipedia)
       (x+1)^ + y^2 < 1/16}
      Y0 A= B= MulShift7! YY=
      X0 128+ A= B= MulShift7! YY+ 8- [if<0 0
      else

      {q*(q + x - 1/4) < 1/4*y^2, where q = (x - 1/4)^2 + y^2}
      X0 32- A= B= MulShift7! YY+ {q}
      A= X0+ 32- B= MulShift7! tmp=
      tmp+ tmp= tmp+ tmp= {*4} YY- [if<0 0 else {Otherwise run the escape algorithm} CalcPixel! ]] p. {Plot pixel} len 1- if>0loop]

    DY tmp= DX DY= 0 tmp- DX= {Turn right}
    loop]
  pop ret
] CalcSet=

{-----------------------------------------------------------------------+
|}\vLR>++ ret{          RAM page 5                                      |
+-----------------------------------------------------------------------}
$0500:

{ Stupid shift-right function }
{ XXX Better make a SYS extension for this }
[def
  a= 0 b=
  $8000 a+ [if>=0 a= $4000 b+ b=]
  $c000 a+ [if>=0 a= $2000 b+ b=]
  $e000 a+ [if>=0 a= $1000 b+ b=]
  $f000 a+ [if>=0 a= $0800 b+ b=]
  $f800 a+ [if>=0 a= $0400 b+ b=]
  $fc00 a+ [if>=0 a= $0200 b+ b=]
  $fe00 a+ [if>=0 a= $0100 b+ b=]
  $ff00 a+ [if>=0 a= $0080 b+ b=]
  $ff80 a+ [if>=0 a= $0040 b+ b=]
  $ffc0 a+ [if>=0 a= $0020 b+ b=]
  $ffe0 a+ [if>=0 a= $0010 b+ b=]
  $fff0 a+ [if>=0 a= $0008 b+ b=]
  $fff8 a+ [if>=0 a= $0004 b+ b=]
  $fffc a+ [if>=0 a= $0002 b+ b=]
      a 2& [if<>0          b<++ ] b ret ] ShiftRight= {-----------------------------------------------------------------------+ |}\vLR>++ ret{          RAM page 6                                      |
+-----------------------------------------------------------------------}
$0600:

{ Main }
[do
  CalcSet!
  60 \soundTimer. {For debugging}
  loop]

{-----------------------------------------------------------------------+
|       End                                                             |
+-----------------------------------------------------------------------}

– Marcel

CBA Podcast

As I mentioned in the previous post, I did a talk about the Gigatron at the RevSpace hackerspace. One of the people there was Michai, who has a podcast called CBA podcast, about software, electronics and mechanics. He mentioned the talk in his latest podcast (from 6’41).

– Walter

Another hackerspace lecture

Last friday, I gave another lecture about the Gigatron at a hackerspace, this time at Revspace. We got some really good feedback and it was very nice to talk to people that have been working on building their own processor or computer.

The lecture was not recorded, but an earlier version of the talk, that was given a month ago at the Hack42 hackerspace, is. It is included here.

– Walter