Retro Challenge 2017/10 Testing

The initial testing of the ESP8266 board with the RC2014 was pretty good, and fundamentally it worked.  However, it wasn’t quite right, and I suspected that the problem was to do with CR or LF.

The code I was using was found here; https://github.com/tzapu/WebSocketSerialMonitor (Thanks Tzapu!).  It uses web sockets, and allows an external web page to connect through to the ESP8266.  So, by going to http://tzapu.github.io/WebSocketSerialMonitor/ and connecting to ws://x.x.x.x:81/ws (where x.x.x.x is my external IP address and a firewall rule is set up to forward port 81 through to the internal address of the ESP) it will display everything the ESP receives on its Rx pin.  Well, almost everything, but not quie everything.

If, for example, I did a directory listing which was 2 full lines and a little bit more on the 3rd line, only the first 2 lines would show up.  If I’m playing Zork, sometimes it would show the whole chunk of text as it came in, other times it would miss the last line.

The code itself is fairly easy to read, although the complicated web sockets stuff is hidden away in libraries.  This is the part of the routine that reads the serial input until it detects a CR (the ‘\n’ part), where upon it then sends the line;

void serialEvent() {
  while (Serial.available()) {
    char inChar = (char)Serial.read();
    if (inChar == '\n') {
      stringComplete = true;
      return;
    } else {
      inputString += inChar;
    }
  }
}

I figured that adding a check for a LF would do the job;

if (inChar == '\n' || inChar == '\r') {

But, sadly, it didn’t.  If anything, it made it worse.  So, instead, I tried just reading a set amount of characters (10 initially) and sending them regardless of a CR or LF, but that didn’t work either.  When I got it to send every character without checking, it worked much much better, although if I sent a very large chunk of text it would miss random bits of it.

So, the problem seemed to be speed related.  The checking for CR was a nice idea by the original author, but it wasn’t something I needed, so time to strip out all the surplus code.  It went from this;

void serialEvent() {
  while (Serial.available()) {
    char inChar = (char)Serial.read();
    if (inChar == '\n') {
      stringComplete = true;
      return;
    } else {
      inputString += inChar;
    }
  }
}


void loop() {
  serialEvent();
  if (stringComplete) {
    
    String line = inputString;
       // clear the string:
    inputString = "";
    stringComplete = false;

    //line += '\n';
    webSocket.broadcastTXT(line);
    Serial.println(line);
  }
  webSocket.loop();
}

to this;

void serialEvent() {
  while (Serial.available()) {
    char inChar = (char)Serial.read();
    inputString += inChar;
  }
}

void loop(){
  serialEvent();
  webSocket.broadcastTXT(inputString);
  inputString="";
  webSocket.loop();
}

Much simpler, and it seemed to work perfectly!

All the testing up until this point was done either on my laptop or mobile.  Although they are on the same wifi network as the ESP, it’s connecting out to an external web page before coming back in, so it should be a reasonable test.  But there’s nothing like real people connecting in to really see if it works.  So, I put a shout out on Twitter, and on Saturday evening, 4 willing volunteers sat there watching me do random things on the RC2014.

Feedback was pretty good, and it all seemed to work as expected.  Thanks Thilo for this screenshot;

I messed about with simple programs in BASIC, directory listings, and the opening moves in Zork, with success.  In a moment of madness, I fired up Wordstar.  When the RC2014 is connected to a VT100 terminal, it works great by using escape codes to set where things are on the screen and what colours are used.  However, these escape codes don’t render at all well on the web sockets interface.  Thanks Dave for showing my just how bad it looked!

So, yes, I should have known that Wordstar would be pushing it a bit far.  But otherwise, I was very pleased with the performance.

The biggest problem I had, though, was that of feedback when interacting with the “audience”.  I could type short sentences in to Zork that the viewers would see and understand, even if the Zork engine couldn’t interpret it.  But, of course, there was no live feedback from the viewers.

I’m not sure what the solution to that will be, but it could be as simple as keeping Twitter open on my phone.  Alternatively, things like IRC or Slack could be used (although I don’t want viewers to have to jump through hoops to get connected to me).  Skype might be an option too, although, at the moment, I think it’s more likely I’ll set up a YouTube live stream and use the chat feature in that.

For those wondering about the set up that I’m using, it’s pretty much a stock RC2014 Pro with a Pi Serial Terminal and the ESP8266 prototype I built for this project.  The Pi Zero is connected via a HDMI > VGA adapter, and then to a 17″ monitor.  The keyboard is this Cherry keyboard from the last Retro Challenge.  Note that the key layout is sufficiently different from what I’m used to that typos aren’t too uncommon yet.

The laptop is there to program the ESP, and to monitor it’s output.

I am aiming to have a live run through on Friday, so that gives me a few days to look in to the feedback options.

Decoding ROM labels

Back in the earliest days of the RC2014, it came with a pre-programmed 64k ROM, with Microsoft BASIC on it in the first 8k, and it would work with 32k of RAM and a 68B50 ACIA.  One set up, one ROM, life was simple!

As time has gone on, and more options have become available, other ROM images, such as Microsoft BASIC for 56k RAM, or CP/M Monitor have been introduced.

Future possibilities, such as other UARTs, different CPUs or other variations will inevitably lead to more ROM images being needed.  So, in order to keep track of what is programmed where, ROMs are now being shipped out with a label on them.

Every ROM now has an 8 digit code on it.  Each digit, from left to right, refers to an 8k bank from 0x0000 to 0xD000.  This bank can be selected with the A13, A14, A15 jumpers;

Address A15 A14 A13 ROM Label
0000 0 0 0  Xooooooo
2000 0 0 1  oXoooooo
4000 0 1 0  ooXooooo
6000 0 1 1  oooXoooo
8000 1 0 0  ooooXooo
A000 1 0 1  oooooXoo
C000 1 1 0  ooooooXo
E000 1 1 1  oooooooX

 

The value of the digit represents the ROM image that sits in that particular 8k bank.  Currently, it will be one of the following;

0 – Empty bank, available for user to program

R – Microsoft BASIC, for 32k RAM, 68B50 ACIA, with origin 0x0000

K – Microsoft BASIC, for 56k RAM, 68B50 ACIA, with origin 0x0000

1 – CP/M Monitor, for pageable ROM, 64k RAM, 68B50 ACIA, CF Module at 0x10, with origin at 0x0000

2 – Microsoft BASIC, for 32k RAM, SIO/2, with origin 0x0000

4 – Microsoft BASIC, for 56k RAM, SIO/2, with origin 0x0000

5 – Microsoft BASIC, for CP/M installation,64k RAM, 68B50 ACIA, CF Module at 0x10, with origin at 0x2000

6 – CP/M Monitor, for pageable ROM, 64k RAM, SIO/2, CF Module at 0x10, with origin at 0x0000

 

As more ROM images are added, this list will be updated.

 

Standard factory ROM images can be downloaded from Github https://github.com/RC2014Z80/RC2014/tree/master/ROMs/Factory

Backplane Motherboard Lacing

Having the ability to isolate some slots on the Backplane 8 can be very handy at times, and putting some protection in between modules can be very worthwhile.  However, if you want to connect the outer slots, then soldering little links can be fiddly and time consuming.

 

Thankfully, there’s a quick and easy way to do it.

The photos are probably self explanatory, but get a length of 300-400mm of stripped solid core wire and solder it through one hole to hold the end in place.  Then lace it all the way down, going horizontally on the top of the board and diagonally underneath.  Don’t worry if it’s not too neat underneath.  Solder each joint (I find it easiest from the top before all the sockets are in place, or from underneath if they are already fitted).  Then simply cut all the diagonal links off of the underside.  Job done!

 

Peripheral Addressing

The RC2014 currently uses a very simple, although inefficient method of addressing peripherals.  Most of the expansion modules feature a 74HCT138 used to provide up to 8 enable lines from 3 address signals.  For the purposes of this document, I will mainly refer to the Digital I/O Module, but the principals apply to all modules with a 74HCT138 (generally referred to simply as ‘138)

It is worth noting that the Z80 CPU can address up to 255 Input or 155 output addresses.  These are selected by the first 8 address lines (A0 – A7), IORQ going low and either WR or RD going low.

The ’138 has 3 enable pins, G1, G2B, G2A, all of which need to be true (G1 needs to be high, and both G2B and G2A need to be low) for the ‘138 to be enabled.  When it is enabled, the 3 address lines, A0, A1, A2 are read.  These 3 addresses have 8 possible combinations (000, 001, 010, 011, 100, 101, 110, 111), which will activate one of the 8 outputs Y0 to Y7.

In the Digital I/O Module, the ‘138 is activated when M1 is high, IORQ is low and A7 is low.  This corresponds to any port from 0 to 127 (IORQ being low indicates the address bus represents port, and A7 being low indicates the address bus is lower than 127).  [Side note – Serial I/O Module uses addresses 128 and 129, which are indicated by A7 being high].

The Z80 address pins A0 and A1, along with WR are connected to the address pins A0, A1, A2 on the ‘138.  This gives 4 addresses (00, 01, 10, 11) with the write bit high, and 4 with it low.

In normal use, the ports are addressed as 0 (In 0 or Out 0) on the Digital I/O Module.  (Or port 0, 1, 2 on the Digital Input module, for example).  However, any address that has A0, A1 and A7 low will work; 0—–00.  So echoes of this will appear on 4, 8, 12… 124.  So, whilst this works, and is fine for a small system without much I/O requirements, it quickly becomes inefficient as you need more ports.  In particular, it will clash with the Compact Flash Storage Module, which can have an impact on running CP/M.

In an ideal world, every peripheral should have a unique address, and with a lot of digital logic, this is certainly possible to do.  However, it will add both complexity and cost as well as needing more board space.

The easy solution, however, involves just 6 diodes and a resistor.  By connecting address lines A2 – A7 to the anode of each diode and the cathode of each diode to the G2A enable pin on the ‘138, any address above 00000011 will prevent the ‘138 from being enabled.  Effectively all the diodes are acting as a very simple OR gate.  A 10k resistor will bias the output low.

So with this set up, it will give just 4 unique addresses; 00000000, 00000001, 00000010, 00000011 (ie 0, 1, 2, 3) which for the Digital I/O Module, or the Digital Input or Digital Output is ideal.

Other addresses can be selected by changing which address pin the diodes are connected to.  So, for example, if A1 was connected to a diode instead of A3, and A3 went to the ‘138, the addresses would be 00000000, 00000001, 00001000, 00001001 (ie 0, 1, 8, 9).  Whilst it cuts down on the echoes at higher addresses, it’s still not perfect – but much better and still very cheap with minimal extra board space needed.

The Digital I/O Module has now been updated to reflect this change.  As PCB stocks run low on other modules, they too will have similar updates.  If you already have a non-diode selectable module, and wish to implement this, it is actually very simple to do as shown below.

Retro Challenge 2017/4 – Rack Teardown and Wrap Up

Ok, firstly, apologies for the lateness of this post.  The stuff below was actually done a couple of weeks ago, but time has just got away from me.  Hence this is being written up 2 days past the closing date for RC2017/4.  Sorry

Anyway, this part of my challenge involves investigating a rack that came as part of the old stuff that I picked up.  Looks like a 3 bay x 12 slot Eurocard rack.  Lets take a closer look…

Continue Reading »

Retro Challenge 2017/4 – Keyboard Investigations

After a visual check of the keyboards (see this post), I had a couple of questions, which were do the keyboards work? and how do the keyboards work?

On the basis that neither of the Alphameric had their EPROM windows covered, and that one of the Cherry keyboards had already been modified, I chose the other Cherry one as the most likely to work.  After opening it up (again), I checked the 20 pin header.  It was quite easy to find out what the 5v and Ground pins were (traceable to the power pins on the logic chips and corresponds to red and black wires on pin 1 & 2!), but the others were going to need something more to diagnose

Continue Reading »

Retro Challenge 2017/4 – The Key(board) to Happiness

Next up on the things to investigate is the 4 keyboards

Judging by the connectors, it was obvious that these aren’t modern (PS2, USB or even 5 pin DIN) keyboards.  Likely either a raw matrix or maybe parallel ASCII.  Lets open them up and have a poke around!

Continue Reading »

Retro Challenge 2017/4 – ICE ICE Maybe

I decided the easiest thing to tackle first would be the three ICE (In-Circuit Emulators) as they’re quite bulky things to get out of the way early.  There are two non-identical versions of the same model Adtek ICE Engine BX and a Zax ICD278 – all with manuals!

Although they all have PAT stickers on to indicate they were tested safe in 2001/2002, before plugging anything in I wanted to check inside for bulging capacitors, leaky batteries or any metal debris that might be floating around inside.  Also, I wanted to know what was actually in these machines!

Inside the ICE Engine Bx is quite full.  This unit is not only an ICE but also an EPROM programmer and a UV EPROM eraser too!  The bulk of it is made up of 3 boards with off the shelf logic, all connected to a backplane.  One of them had a 3 slot backplane the other had a 4 slot one, with one empty slot

Everything looked in order on both machines.  Even the rechargable battery on one of the boards was fine and showed no signs of leakage and all the caps were visually ok.

According to the manual, these could be connected to a CP/M machine running their software (which I did not have) or used with a dumb terminal.  The terminal options looked like the easy option, so I figured I’d give it a go with PuTTY running my Linux desktop

Sadly, no combination of serial cables, baud rates, ports, with or without the probe* gave any joy.  The units both powered up and the lights came on, but I just couldn’t get anything coming out of the serial port.

* The probe needs two 60 pin ribbon cables – which I don’t have.  The unit should work without (and should report ‘No probe connected’ if used for debugging.)  If I used 40 way cables, though, the lights came on – but still nothing on the serial port.

I wondered if all of the cables and adapters I had were faulty, but figured that plugging in the Zax ICD278 couldn’t make things any worse

 

But it turns out that this sprang in to life with some console messages straight away!  I hadn’t opened this one up to check the caps or battery, and I hadn’t looked through the manual at all, but it seemed to work and typing random commands seemed to do things.  Typing a R for example showed the current state of all Z80 registers.  So, it was worth reading the manual and trying things out

One of the first things I learned is that the manual isn’t for a Zax ICD278, but for a Zax ERX 64180 (well, ok, I could have just read what was written on the cover!).  Some of the instructions worked though, so, for example, DI 100,120 would show a disassembly of the code from 0x0100 to 0x0120.  However, a lot of things didn’t work, so I needed to find out what I needed to do.

Luckily, some kind soul had already scanned the manual and uploaded it to Archive.org :-)

So, with a little bit of knowledge, it was time to plug this in to a Z80 machine and test it out.  By an amazing twist of fate, I happened to have a RC2014 to hand, so I whipped the CPU out and plugged in the long dangly attached to the Zax.

It turns out to work great, and in no time at all I was able to type in Z80 assembly code, list it out, and execute just that bit of code!  This is just a tiny fraction of what this machine is capable of though, and the amount of options for break points, tracing, history and register manipulation is probably beyond what I will ever need or understand, but I can already see a lot of instances where this will save me burning many many many ROMs!

However, I had already violated my initial rule – Don’t plug things in until after you’ve taken them apart.  So, time to hit it with screwdrivers to check the innards are visually ok

Apart from a bit of dust and grime, it all looked pretty good inside.  It’s nowhere nearly as complex as the ICE Engine BXs are, but there’s still a lot packed inside.  However, I’m happy that this will be a regular tool in my arsenal against Z80 programming.

As for the ICE Engine BXs – I honestly believe that they both work, but I either don’t have the right cables, or just don’t know what I am doing.  (Probably both actually).  It might even be as easy as leaving them plugged in long enough to recharge the internal battery.  I don’t know.  Yet.  I will revisit them again in the future, but for RC2017/4, I have ticked them off of the list for now.

Retro Challenge 2017/4 – Getting The Excuses In Early

So, once again Retro Challenge is upon us, and, yes, the timing is offset , but an April challenge should mean that more people are able to participate.

To try and stay ahead of the curve this time, I thought I’d get in early and give my excuses for why I failed to complete the challenge this time around.  I know most people leave this part until the very end, so hopefully I can impress the judges with my efficiency!

The very first weekend in April was the UK Maker Faire in Newcastle (which was awesome, thank you for asking), so that took 3 days out of April for me. Then at Easter the Edinburgh Mini Maker Faire will also be robbing me of 3 days.  And, finally, Vintage Computer Festival Europe is on from 29th April to 1st May.  So, with travel and prep for these events, I feel like I’ll be left with about 4.5 days in which to complete the challenge.  Lets see how that works out…

Continue Reading »

Retro Challenge January 2016 – Preamble

So, you may well remember that I entered Retro Challenge 18 months ago, and what a fun crazy busy time that was!  Well, the January Retro Challenge competition is about to kick off in just over 2 weeks.

If you’re not familiar with Retro Challenge, shame on you!  But you can de-shame yourself by heading over to http://www.retrochallenge.org/ and seeing what it’s all about.  Essentially, it’s a month long bi-annual competition where the entrants set themselves a goal based around old school computing and blog, tweet and share their experiences.  The goals are pretty loose, as long as they are based on something from last centuary (modern emulators of old kit is fine).

The challenge I set myself was to take a breadboard based Z80 computer and bring it to life in modular PCB form in such a way that I could spell out my name on.  Have a look back through my blog to see how I did.  Spoiler —->

IMG_20140730_205950

Continue Reading »

Ace adventures on Jupiter

So, before I dive in to this, a quick history lesson for those of you that aren’t fully up to speed on your rare 80’s vintage 8 bit computers.  In the beginning, there was Clive Sinclair, and he invented the Sinclair ZX80.  From the ZX80, the ZX81 and indeed home computing was born.  From the ZX81 came the ZX Spectrum.  Ok, so Clive didn’t invent these single handed.  He had a team working for him, which included Steven Vickers and Richard Altwasser.  Somewhere between the initial design of the ZX Spectrum and its launch, Vickers and Altwasser thought there was a better way to do things, and left to set up their own computer company.

Jupiter ACE (restored)

Jupiter Cantab was formed in 1982, and Vickers and Altwasser developed the Jupiter ACE.  This little computer was a weird mix of ZX80 (vacuum formed white case), ZX81 (black & white low res graphics, 3k memory) and ZX Spectrum (rubber keyboard, small speaker).  The one fundamental difference, however, was that it used FORTH instead of BASIC as it’s operating system.  FORTH was much more efficient than BASIC, and would revolutionise the home computer market…

Although history tells us it didn’t.  Cantab went bust after 18 months and was bought by Boldfield Computing, who went on to sell off the remaining hardware in 1985.  Approximately 8000 units were manufactured.

When I was offered an original unpopulated Jupiter ACE by John Fletcher, it was too good to turn down…

Continue Reading »

Happy New Year. Again. And Again. And Again…

A recent discussion started with the simple question “When is it New Year?”.  Well, 1st January, right?  The stroke of midnight on 31st December?  Depends where you are on the planet?  [depends what planet [if any] you are on].  It depends on which timezone you are in.

So, we settled on it being at the stroke of midnight for each of the timezones around the world.  Which, surprisingly, is 30.  Less surprisingly, they cover a full 24 hours.

Timezones

Continue Reading »

Printing Xmas Tags Like It Was 1983

Yesterday this tweet appeared on my Twitter timeline

Now, being the geeky retro Sinclair fanboy I am, I read it, understood it, and retweeted it.  Obviously. Continue Reading »

RC2014 SD Bootloader Update

Just a quick update to about the SD Bootloader I designed a few posts ago.  Well, the PCBs have arrived and last week I took a soldering iron to one of them and gave it a quick test

One side of the board is effectively an Arduino, so without plugging it in to the RC2014, I connected up an FTDI lead and uploaded the Arduino Blink sketch.  A quick check with a multimeter and one of the pins was altenating between 5v and 0v.  So far, all good! Continue Reading »

Chromecast to VGA

 

When Google first launched the Chromecast, I wanted one as it seemed like it would solve a lot of viewing problems for me.  The trouble was, my “TV” (technically, it’s a 42″ monitor as it has no tuner) doesn’t have any HDMI sockets, so it would cause more issues than it would solve, and I figured it would be £30 wasted.

chromecast

When the price was dropped to £18 recently though, I figured that was within the realms of wasteable money I was prepared to spend.  My TV didn’t have HDMI, but it did have composite, RGB, SCART and VGA connections.  Surely something would work…

Continue Reading »

RC2014 Bootloader for SD Cards

So, the RC2014 is great.  I can run Microsoft BASIC and program it from there, and as long as I am using a terminal emulator, I can copy & paste to save and load programs.  Alternatively, I can write Z80 code using an online compiler then download it, copy it to USB stick, move it to my old Windows 2000 laptop (which has a parallel port) so I can burn it on to EPROM to see if it works, make adjustments and repeat with another EPROM.

I will be the first to admit, however, that this is probably not the most efficient workflow.  Not to mention the time and effort involved in wiping the limited stock of aged EPROMS.

So, I am in the process of designing an SD Card based bootloader.

i (2)

Continue Reading »

RC2014 with ZX Printer interface

My original plan had never been to design and build my own computer.  I had, however, planned to build a clone of the Sinclair ZX80, which has been on my bucket list of things to own for year, and which I had found plans for online.  Whilst collecting the parts and reading up on simple Z80 computers I got kind of sidetracked and ended up with the RC2014.

The print out shown was what was left from the last time this was connected to a ZX Spectrum!

The heart of the RC2014 is a Zilog Z80 CPU, which is the same one that Sinclair used in the ZX80, ZX81, ZX Spectrum and Z88.  If the ZX81 and ZX Spectrum can run a ZX Printer, then surely it follows that the RC2014 will be able to too?

Continue Reading »

The Future I AM IN YOU

As a child growing up in the 1970s, I had no idea of what the future held.  I didn’t know if Mr Benn would be able to get back from his adventures, or if Scooby Doo could catch the Evil Swamp Monster, or even if we were going through the round or square window in PlaySchool.  But there were some things about the future that was pretty certain.  We would all have robot butlers, go on holiday to the moon and drive electric cars!

2014-07-13 13.31.18

So, as I drove to work this morning in my electric car, wondering when my moon tickets would drop through the letterbox, I realised that maybe, just maybe, I am already in the future Continue Reading »

Man Cave 2.0

Recently I’ve read a few posts about other peoples working environments, office setups, man caves or work benches.  I’ve also had a couple of people ask about mine, since I tweeted about the redecoration and overhaul of my old “spare room” as it transformed in to “Man Cave 2.0”.  I had intended to write it up when it was finished anyway, although, even now, 9 months later, it is still not finished, I am begining to realise that it will never actually be finished but will evolve and morph over time.

IMG_20140815_204745

So, this is a look at the overall design and some of the finer detail in to my Man Cave 2.0 as it stands in August 2014 Continue Reading »

Linux support, upgrades and headaches

Some of you may remember that last year , after a regretful decision to ‘upgrade’ from Windows 7 to Windows 8 I decided to jump ship and switch over to Linux.  Ubuntu 13.04 to be precise.  I blogged about the install process here, and my first thoughts after a week here, with the intention of regular posts whenever something goes really good or really bad.

So, it’s 14 months later, and basically things have gone pretty good.  Sure, there’s some things that aren’t just how I like them with Windows, but other bits that just seem to work really well.  In defence of my lax blogging, I’d just say that I got on and used the computer as I expected I would.  I got tripped up a couple of times, but Google and AskUbuntu.com always seem to put me back on the right track.

I have expanded my Linux network too.  I was donated an old netbook last year that now runs Ubuntu 13.04 for an hourly Twitter job.  The plan had been to test it on the netbook then set up a Raspberry Pi to run it, but the netbook is surplus, capable, cheap to run and it works – so why change.  I have also bought myself a little HP server which I put Ubuntu Server 13.10 on, along with OwnCloud.  This works like DropBox, and synchronises files between my main PC, phone, tablet, work computer and is available to me (albeit slowly) anywhere on the internet.

All in all, things have been ticking over quite nicely.  Life has been happy in Linux land… until recently! Continue Reading »