It turned out that my TMS9995 system had no modules in common with my CP/M system, as it’s using the ROM and RAM modules left over from the CP/M upgrade. All I needed was another backplane to be able to run both at once.

SC116 3 slot backplane

As the TMS9995 uses three modules: CPU, ROM and RAM I wanted a 3 slot backplane[1], and it turns out that Steve Cousins makes just the thing with his SC116, which is available on Tindie. I ordered one yesterday, and it arrived today :)

It only took a few minutes to put together (in part because I left out all the bits I didn’t need).

Pi terminal server

It’s great to use my RC2014s from a serial terminal on my laptop or PC, but that means I can’t do anything with them when I’m away from home.

To get over that I’ve used the Raspberry Pi that’s sat on the UPS on my desk (my first original Model B) along with a couple of UART cables.

I wanted to get another FT232 cable, but the eBay supplier I used last time is away. So instead I order a pair of PL2303 based cables from Amazon. These turned out to work fine with my laptop, but not so great with the Pi, where I could only get one working at once (due to power issues?), and also hit a somewhat well documented issue with (clone?) PL2303X chips where it’s necessary to sudo modprobe -r pl2303 && sudo modprobe pl2303The compromise I ended up with was the FT232 for the CP/M system using screen -S Z80 /dev/ttyUSB0 115200 and the PL2303 for the TMS9995 using sudo minicom -D /dev/ttyUSB1This means I can now SSH to my Pi and connect from there to the two RC2014 systems.

Note

[1] At some stage I may make a TMS9901 I/O module, and I’d also like to see if I can add a TMS9918 video adapter (like this one), so I might have to upgrade to 5 slots later on.


Playing Tetris on my Gigatron reminded me that I still had my original Game Boy in a box in the loft, which had last been out when my kids were too young to remember.

I found it in a sorry state – the screen cover had fallen off, and the case had turned orange. Sadly I forgot to take the ‘before’ picture, but it may have been even worse than the one pictured in this Reddit thread ‘Quite possibly the most yellowed DMG I have yet to come by‘. Here’s what it looked like once finished:

Ersatz Retr0bright

The first problem I went after was the yellowing of the plastic. I found a couple of videos from ‘The 8-bit Manshed’ that provided a good overview of disassembly (part 1)[1] and plastic restoration (part 2). Having previously read the Wikipedia article on Retr0bright I knew that all I needed was some hair salon hydrogen peroxide (already on hand) and some sunlight[2].

I put the salon creme on with a brush, popped the parts into a zip lock bag, and left it out in the back garden. As can be seen above it came out nicely :)

Screen

The detached screen went back on with a dab of superglue (cyanoacrylate) on each corner – easy.

Battery terminals

These had picked up the usual green encrustation over the years. The removable ones went into vinegar whilst the case was whitening, and I sprayed the PCB mounted ones with contact cleaner and brushed them off.

When I put things back together it wasn’t firing up, as the PCB +ve terminal dome had corroded badly (which happened back when I used the Game Boy regularly).

The solution was to wrap some kitchen foil around the terminal, which now provides good conduction from the battery to the system.

Screen Lines

With everything nominally working again it was time for some Tetris, but that revealed some missing lines on the screen. It’s a common problem, and one with a well documented repair. One thing I did differently was to place a piece of scrap paper over the ribbon connection to the LCD and (briefly) run the soldering iron directly over that, which takes care of better heat transfer (as conduction beats convection) whilst avoiding direct contact between the ribbon plastic and the iron tip.

I can now get back to some of my old games

Including the 8×1 cartridge I picked up in Sham Shui Po’s ‘Golden Shopping Centre‘ in ’92.

I think my favourite was Shanghai, or was it Bubble Bobble – they were all good, maybe apart from the Chinese language ones that I couldn’t figure out :/

Notes

[1] Easy when you have a tri-wing screwdriver, which I didn’t back in the day, but that became an essential when DSs were a feature in $son0’s life.
[2] The 8-Bit Guy’s ‘Adventures in Retrobrite – New techniques for restoring yellowed plastic!‘ provides a good run down of various alternative techniques.

 


Having got a TMS9995 system on RC2014 working as far as the monitor I still wanted to run BASIC and Forth. I’d not been able to get my pageable ROM card working, and the switchable ROM module is too small. But it’s too small because it’s designed to carve a 64K EPROM into 8K pieces. All I had to do was take the gating out of the A13 and A14 lines. That took a couple of jump leads and a solder blob on the back:

and disconnecting U2A:

I can now use the A15 jumper to choose between BASIC:

and Forth:

It’s all a bit hacky, but a lot less work than making my own ROM module from scratch.


I already wrote about my plans to get a TMS9995 running on RC2014, so this is the post about how I put together an RC2014 version of Stuart Conner’s TMS 9995 Breadboard or PCB System.

Planning

Taking a look at the TMS9995 pinout and the RC2014 module template it became clear that there was no easy way to place the CPU that would align well to the address bus, so I chose a position to one side of the module that lined up the clock pins and made the data bus reasonably easy. That placing also meant that I had plenty of space for the TMS9902 based serial port.

Pinout

I went with the following mappings

TMS9995 : RC2014

A0-A15 : A15-A0 (as TI convention for numbering is reverse of industry norm)
Vss : GND
Vcc : 5v
NC : M1
Reset : Reset
CLKOUT : Clock
NC : INT
MEMEN : Mreq
WE/CRUCLK : Wr
DBIN : Rd
NC : IORQ
D7-D0 : D0-D7 (same reversal as address bus)
CRUIN : USR1

Parts

This whole thing came about because I found a stash of TMS99xx chips. So I already had the TMS9995 CPU, and TMS9902 asynchronous communications controller. I also knew that I’d be able to use my existing RC2014 RAM and ROM modules. With some 74LSxx TTL chips and pull up resistors on hand,  all I needed were some sockets, a crystal, and a couple of capacitors, which I ordered from Bitsbox (rather than lots of little eBay orders).

The whole thing went onto an RC2014 prototype module. I chose to put the CPU and serial together on one module (as I only had one lot of right angle edge connector).

Clock check

Before getting too far into the build I checked that I could get a 3MHz clock out of my TMS9995 on breadboard:

All was well:

Construction

I knew that the address bus would be tricky, so I got that out of the way first:

Next up was the data bus and clock, which got me to a stage where I could test the clock again:

After that I found space for the serial parts. It turned out that I could mount the TMS9902 right by the CPU to take advantage of its use of A10-A14 with some simple bridges. The 74LS138 also sat nicely in reach of A7-A9 using the space remaining over the power lines. That just left me needing to place the 74LS04 inverter for CRUCLK (which Stuart told me was needed after TI changed things between the TMS9900 and TMS9995)[1].

Here’s the finished board from the front:

and the back:

It didn’t run first time :(

and it took me ages to track down the short between A9 and the /CE on the 9902. Eventually I realised that Stuart’s debug test images were working without the 74LS138 at which point I found the bug.

I then had the delight of running Stuart’s third test image and seeing a screen full of ASCII characters :)

ROM wrangles

I expected Stuart’s 32k images with EVMBUG and BASIC/FORTH to work in the RC2014 pageable ROM module with the jumpers set for a 32k page size and A15-0 for the lower page, but that hasn’t worked for me.

I have however succeeded in getting EVMBUG running from the switchable ROM module, which allowed me to run HELLO WORLD from the monitor:

I suspect I’m going to have to knock up my own 32k ROM module to get BASIC working

Conclusion

I’d have liked to try Cortex BASIC, but getting HELLO WORLD running from the monitor will have to do for now.

Note

1. It seems that a couple of the TMS9901 that I have are the -95 versions that should work with a TMS9995 without inverting the CRUCLK, but none of the 9902s :/


This is the blog version of a Twitter conversation with my colleague Graham Chastney.

Huawei, and the war on trade

POTUS #45 has been pursuing a ‘trade war’ with China, as this appears to be popular with his base, even though it makes stuff more expensive for them and will ultimately harm the US economy. It’s not really a trade war, more a war on trade.

The latest target in that war is Huawei. First came a US export ban, then Google pulled their access to Android licenses and the underlying Google services and now ARM is breaking away.

This leaves us asking what happens to a mobile phone maker that relies on ARM for hardware, and Google for software and services when ARM and Google are put into a position that forces an end to those business relationships?

The direct and immediate consequence seems clear – Huawei’s mobile phone business (at least in the West) is toast. But let’s look at the longer term (unintended) consequences, and particularly the role played by open source, and how regulators might try to react.

This is great for RISC-V

If Huawei can’t work with ARM then the clear alternative will be the open source RISC-V Instruction Set Architecture (ISA).

Huawei is a Gold member of the RISC-V Foundation

RISC-V has been making great strides forward over recent years with industry giants like Western Digital and Nvidia jumping on board. But they’ve been nibbling into the bottom of ARM’s world with the low spec microcontrollers that do housekeeping stuff on hard drives and graphics cards.

A deep pocketed and cornered industry behemoth like Huawei can now drive a full on assault at the top of ARM’s market to get RISC-V a place in the high end Systems on Chip (SoCs) used in mobile phones.

But bad for Western RISC-V specialists

As they’ll be cut out of the action as all the work will be done in Shenzhen rather than Cambridge.

The software part has already played out

Android as we know it in the West isn’t a thing. The phones being used on the Chinese side of the Great Wall might ostensibly use Android, because they’re based on Android Open Source Project (AOSP), but they don’t use Google apps or the underlying services. So cutting Huawei off from Google’s Android licenses cuts them off from Western consumers, but doesn’t impact their domestic market at all.

We have however seen this show before (without the populist politics). Amazon sells Fire tablets, which are Android without Google services. This saves Amazon from paying Google a license.

Many people install Google apps and services onto their Fire devices, and both companies do nothing to prevent this. Google doesn’t mind losing out on a license fee if they still get all that tasty customer data, and maybe even some sales in the Play store. Amazon doesn’t mind people using Gmail on a device that’s pushed up their volume production economics, and likely also pulled along a Prime subscription and maybe some Kindle sales.

Huawei could very easily sell AOSP devices into the Western market where customers self help themselves to Google apps and services. Google’s hands would be clean as they wouldn’t be taking a license fee or helping Huawei in any way.

What I don’t see happening here is Huawei trying to build a portfolio of services and associated apps to appeal to those of us West of the Great Wall. Amazon didn’t bother, because it would take $Billions to build the platforms and establish the customer intimacy.

So what happens when the US Federal Government tries to cut Huawei off from RISC-V and AOSP?

Both of these projects originate from the West, and so it’s conceivable that Western governments will feel a sense of ownership over them. Furthermore it’s conceivable that Western governments will see open source as a loophole around export controls – a loophole that has to be closed.

It is of course completely impractical to prevent the export of open source. It’s inherently a globalised phenomenon. But this might be one of those times when politics tries to trump practicality. We’ve seen this show before too with the export controls of cryptography, or the more recent statement by Australia’s Prime Minister that ‘the laws of Australia will trump the laws of mathematics‘.

Open source, apart from you” as Graham puts it may be where the politicians and the agencies under them might want to go. But making that real will rapidly play out first as tragedy then as farce as an endless game of whack’a’mole ensues in a futile attempt to stop Unicode characters from crossing international borders.

It is sadly a losing game that governments will feel obliged to play, because the alternative is to accept that open source is a trans national power that transcends the power of national government; and of course that’s an alternative that’s unacceptable to a national government.

So I predict that the US Government will huff and puff and try to blow the house down, and they’ll drag the Five Eyes allies along under the banner of ‘intelligence’ protection, and then the rest of the West under the banner of ‘trade’. We’ve seen this show before too with the hapless ‘war on drugs‘, where we now have the ridiculous situation where many states have legalised cannabis whilst most of the West keeps it unlawful because the US told them too (and that’s still the Federal government position).

Conclusion

The US Federal government is on the brink of cornering itself into a war on open source (which will become a side skirmish to the war on general purpose computing), and it’s going to get very messy and very silly.

Tags

I tag a bunch of stuff on Pinboard.in, so if you want to read more about RISC-V, open source hardware or the war on general purpose computing click on.


After building my RC2014 CP/M system and Gigatron I decided to dig through the pile of old integrated circuits I stashed away before leaving home thirty years ago. I don’t remember the source, but it seems that I stripped down 4 systems (which might have been something like data loggers) that had a reasonably complete set of TMS 9900 series components. So I have CPUs, serial I/O, programmable systems interfaces and more at hand (though kits with all the parts are available inexpensively from eBay).

There is already a design that I can adapt

Stuart Conner has published plans for a TMS 9995 Breadboard or PCB System, which I think will work well as the basis for an RC2014 build. The RC2014 backplane carries power, a 16 way address bus, an 8 way data bus, and the various signal lines I’ll need.

The TMS 9995 memory layout and memory access scheme isn’t identical to the Z80, so I don’t think I’ll be able to use the standard RAM and ROM modules, even though they use the same glue chips as Stuart’s design.

Stuart doesn’t just have the hardware design; he also provides some firmware, and even some debug firmware. My plan is to drop it onto a W27C512 EEPROM[1] and I’ll then be able to use a jumper on the top address line to switch between BASIC and Forth.

The other major change I’m planning is to ditch the RS232Max, as I can just use TTL levels and an FTDI adaptor.

Getting it onto RC2014

I’ve ordered a few RC2014 prototype modules, and my general plan is:

  • One module for CPU, clock and serial too if I can squeeze it on.
  • One module for ROM, with jumper select for BASIC/Forth
  • One module for RAM (which I might just hack from my now unused RAM module since I did the CP/M upgrade)

That should leave me with a spare prototype board to lash up some sort of blinkenlights I/O board from one of the TMS9901NL I have at hand.

Given that I already have CPU, serial, EEPROM and most of the glue chips that just leaves me needing some chip sockets, a crystal and a few pullup resistors and capacitors. I’ll also get a fresh RAM, as I don’t want to mess with my working CP/M setup.

Update 20 May 2019

After a bit more noodling on the memory arrangements I’m now pretty sure that a regular RC2014 32k RAM module will work along with the pageable ROM module. It seems that Stuart (9995 breadboard design) has gone for switching the /CE signal whilst Spencer (RC2014) has gone for switching the /OE signal, but I think both approaches are equally valid. I’m using the following signal lines as equivalent:

  • Z80 : 9995
  • MREQ : MEMEN
  • RD : DBIN
  • WR : WE

I now need to figure out why Stuart uses an inverted WE/CRUCLK into the 9902 for serial? Maybe I should just ask him[2].

Note

[1] I burned the K0001000 factory ROM image onto a W27C512 EEPROM to replace the supplied 27C512 one time programmable (OTP) EPROM, and it’s working perfectly in my CP/M system. As I ordered a 3 pack from eBay that leaves me with a couple to play with.
[2] I did, and the answer is that due to differences between how the TMS9900 and TMS9995 handle clocks it’s necessary to invert the clock. Apparently there are TMS9902-95 ICs out there that don’t need this, but not in the bunch I have.


I’ve had a bit of a binge on this topic over the past few weeks, putting together some kits that I bought ages ago. My RC2014 came first, and then this, a Gigatron.

Why?

Ken Boak did a lightning talk on his Gigatron at OSHCamp 2018, and it sounded super interesting.

What is it?

A computer without a microprocessor, that runs entirely on 74 series Transistor Transistor Logic (TTL) chips plus a 32KB static RAM, a 1Mb EPROM (arranged as 64K x 16 bits) and a bunch of diodes.

Despite the simplicity of the hardware it’s capable of driving a VGA monitor (albeit at quarter resolution) along with sound.

It’s the computer that could have been made with late 70s components, but wasn’t, because the trade off between hardware simplicity and software complexity needed to program such a thing wasn’t really manageable back then[1].

It uses a Harvard architecture, that separates program code (in the EPROM) from data (in RAM) rather than the Von Neumann architecture that we generally take for granted.

It is therefore deeply weird for anybody (like me) who grew up with 80s 8 bit ‘micros’. But it’s rather satisfying to play Tetris on something you put together in an afternoon; and it’s a journey of discovery to figure out how on earth that actually works. Co-creator Walter Belgers does a great job of explaining it in his Hackerhotel 2018 presentation.

Assembly and testing

The Gigatron kit comes with a really nice spiral bound handbook that explains everything from basic soldering through to step by step assembly guide.

It took me about 4hrs to put it together, including a bunch of time wasted on an upside down 74HCT161 in the Program Counter[2].

It fired up almost first time. I didn’t have a spare 74HCT161 to replace the one I cut away, so I went with surface mounting it to the top of the through holes, then putting a blob of solder at each spot on the bottom. That didn’t quite work, but after I poked through a short piece of offcut wire into each hole the board started up properly and I got the ‘cylon’ on the blinkenlight LEDs.

When fully complete I found VGA, sound and input all working as expected, meaning I could start using the build in apps. Unfortunately it wasn’t stable when I put it in the enclosure with rubber feet holding up the PCB, which is why it’s pictured out of the (rather nice) supplied case in the photo above. I think it’s fixed now (after a little more work on the program counter joints), though I still suspect a possible (and intermittent) PCB track break around U5.

Extras

My Gigatron came with a ‘Pluggy McPlugface’ input adaptor that lets a PS/2 keyboard be used for BASIC etc., but I’ve not got around to digging out an old keyboard to try it yet.

What’s next?

I’d like to have a go a writing (or at least adapting) a program written in Gigatron Control Language (GCL).

Try it yourself in the online emulator

If you want to see what the Gigatron looks like in action without building one yourself then check out the emulator.

Notes

[1] I guess the metaprogrammers in the LISP community might have had the tools at hand to do something like this, but they didn’t.
[2] It was the third chip that I put in, and I couldn’t believe my own carelessness. I used to be fairly handy at desolding ICs, but I now realise that back then I used a clumsy old 30w soldering iron that was pretty good at delivering heat to many pins at once. What I should have done was just cut off the chip and pulled the pins, and that’s what I did in the end, but not before lots of solder sucking and wrenching.


I mentioned in my RC2014 post that I’d got myself a new oscilloscope, so this is the blog post to complement my review on Amazon.co.uk.

Background

The ancient single trace Telequipment S51E that I saved from a skip a 6th form college as they upgraded to shiny new dual trace scopes has served me well over the years, but at 1MHz it doesn’t have the bandwidth for retro computing projects. I’d briefly looked at what was available a few years ago, and knew that I could pick up something modern and effective for a few hundred pounds.

At around the same time I was saving the S51E I came across my first digital storage scope, which was probably from HP. I recall that it had cost something staggering like £50,000, and even at that price had less memory than my Amiga. Oh my have things changed as the digital revolution and commodification have reached the arena of test equipment.

Standalone vs PC peripheral

My expectation was that it would be cheaper to get a USB scope that uses a PC as its display, but that wasn’t the case – at least not at the bandwidth I wanted. Hantek do a 20MHz 2 channel PC-Based unit (the 6022BE) for £57.99, or 70MHz with 4 channels (the 6074BE) for £165.99, but I wanted 100MHz and although there is a 6102BE that would have fitted the bill I wasn’t finding them for sale.

The PicoScope 2000 series appeared to come highly recommended, and the lower bandwidth models come in at under £100, but unfortunately the 100MHz version starts at £479 for two channels.

So I picked the standalone DSO5102P as it had the right features (2 channels and 100MHz) at a very attractive price of £227.99. I also quite like the idea that I can use it without a PC or laptop, but I can connect it to a PC or laptop should I want to.

It’s very easy to use

The first task I had was to check the clock on my RC2014, so I plugged in, switched on, hooked up a probe and dialled in V/div and time base. I needn’t have bothered, as there’s an Auto Set button that would have got me straight to where I needed to be.

Like the scopes I grew up with it can display a live picture, but because it’s a digital storage scope it just takes a press of the Run/Stop button to pause time, at which point it’s possible to then scroll backwards and forwards along the time base.

Fancy features, and easy help

There’s stuff like Fast Fourier Transforms (FFT) that turn it into a spectrum analyser, and there’s no need to memorise the manual on how that stuff works, because the not quite so obvious features are documented in help pages that can be reached right there on the device.

It’s not quite as fancy as the PicoScope – so no serial port decoding, but my expectations are still calibrated to a 90s electronics lab rather than Star Trek.

There’s an app

The DSO5102P has a USB interface (Type A) on the front for copying to storage (which I haven’t tried yet) and another (Type B) on the back for connection to a PC. Once connected to a PC there’s an app that essentially provides a copy of what’s on the scope’s screen, and the ability to manipulate and save that. It’s functional rather than amazing, but if I ever need to put some traces into blog posts, it will let me do that. Like this:

Conclusion

The just over £200 mark seems to be about as cheap as standalone scopes get, but that buys a LOT of functionality. Given that I grew up in an environment where dual trace was considered high end it’s remarkable how much things have improved. It’s possible to drive the price even lower when buying a PC peripheral rather than standalone, but (surprisingly) only for low end specs with less bandwidth.


This is the first post in a short series (with perhaps more to follow as I go deeper).

Why?

I came across the RC2104 at OSHCamp 2018 where I got to meet its creator Spencer Owen and make one of his Mini kits with my son. When he put his Full Monty kit on sale for ‘Cyber Monday’ I had two reasons to buy:

  1. My daughter is doing Computing GCSE, and I thought it would be good for her to put together something where she could see the CPU, ROM, RAM and interfaces (plus she like soldering).
  2. I wanted to try out the CP/M Upgrade Kit to relive my days of running stuff on an RML380Z in the far corner of the computer lab at my high school.

What is it?

The RC2014 design is very modular. with each module plugging into a simple backplane that has power, data bus, address bus and miscellaneous signals running across it. It’s a step up from building on breadboard or stripboard, but has the same underlying simplicity and elegance.

In the Full Monty kit I got:

  • 8 way backplane – used to connect modules together
  • CPU – a Z80
  • RAM – a 62256 static RAM (32kb) supported by a couple of 74HCT series TTL chips
  • ROM – an AT27C512 one time programmable (OTP) EPROM (64kb) supported by a 74HCT32 and some jumpers so that different chunks can be addressed to select BASIC, CP/M monitor or Small Computer Monitor.
  • Clock – a simple 7.3728MHz crystal based clock using a 74HCT04
  • Serial -a 68B50 supported by a 74HCT04 with headers for an FTDI cable (and space for a 232Max chip for those wanting RS-232)

The components on each module are more retro inspired than retro authentic, but that helps to keep the complexity down. RAM in the 80s would have used lots more smaller chips, and the same would go for ROM (which would be EPROM rather than EEPROM). 80s designs also tended to stay in lane according to the CPU type and supporting chips for I/O etc. rather than mixing from the different worlds of Intel/Zilog and Motorola/MOS.

Assembly and testing

There are over 600 solder joints, but everything uses easy to work with through pin connectors, so after a few hours of me working on the backplane and my daughter making the modules we were ready to try it out.

It didn’t work first time :(

I then started working my way through the troubleshooting guide[1]… No obvious bad joints. Power was present at all the key points. No shorts on bus lanes. Good continuity along bus lanes.

At this stage I broke out my ancient Telequipment S51E single trace analogue oscilloscope that I saved from a skip at my 6th Form College when they were refreshing to shiny new dual trace scopes. I showed me that there was a clock signal, but didn’t have sufficient bandwidth to display it properly – you can’t look at a 7MHz clock on a 1MHz scope. I ordered a shiny new scope (more on that in another post).

Next up I switched each major chip with my RC2014 Mini – everything still worked on the Mini, and the Full Monty still refused to fire up.

At this stage I reached out to Spencer for some advice, and he suggested that I try each of the modules in my Mini (pulling the chip that was on the module). This let me eliminate the CPU, RAM and ROM from enquiries. I was pretty sure the clock was good (and my new scope arrived in the middle of troubleshooting to confirm that), so attention focused onto the Serial module.

Spencer noted that the only difference between serial on the Mini and the serial module is the resistors – 1k vs 2k2 respectively, so maybe my FTDI connector wasn’t getting along with the slightly weaker signal. I was using an Embecosm EHW5 USB UART that I got at the OSHUG Chiphack FPGA workshop, and that’s served me well for various projects, but Spencer was right – it was my ‘FTDI’ cable, and plugging it directly into the RX/TX lines got me a working terminal.

When my daughter got home that evening she was able to type in a BASIC program and test her creation.

I ordered a cheap FTDI cable from eBay, and when that arrived it worked perfectly with the serial module (even though it appears to have a counterfeit FTDI chip, which I guess is to be expected for low price parts from dubious sources[2]).

Extras

Along with the Full Monty kit I fell for the upsell to get some extra modules:

  • Digital I/O – provides 8 bits of input using push switches and 8 bits of output onto LEDs
  • Joystick – a derivative of the input side of the Digital I/O board to connect 2 DB9 joysticks (like those that came with the Atari VCS console and most of the 80s home computers)
  • Raspberry Pi Serial – connects a Raspberry Pi Zero with terminal software so that the RC2014 can be used with a USB keyboard and HDMI or composite screen rather than using a terminal (usually another PC with terminal emulation)

I made a disastrous error with the I/O board of thinking I knew the colour codes for 2K2 resistors vs 330R that let to a lot of bothersome desoldering and a tiny bit of PCB track repair. This is why we have multimeters, and if we have multimeters we should use them.

I was disappointed to find that the joystick port didn’t work, and this turned out to be due to a fairly fundamental design issue. 80s joysticks hold the pins high for up/down/left/right/fire, and the switches connect to GND to switch them low. The RC2014 module holds the pins low, and switches to 5v to pull them high. On my old Competition pro 5000 the 5v line isn’t even connected. I bodged this by bridging pins 7 & 8 on the DB9 connectors.

My Pi Zero needed the mounting holes drilled out a fraction for the mounting screws to fit through. I’ve not got around to playing with that part yet (as it’s a feature of the Mini that I’ve already explored).

CP/M

Digital Research’s Control Program/Monitor (CP/M) was the ubiquitous operating system for things that were simultaneously grown up and microcomputers prior to the advent of the IBM PC and PC-DOS/MS-DOS. I didn’t see a ton of it in my youth (at least until the Amstrad PCW came along), because it was too high end for home computers (at least for stock systems without a load of pricey expansions) – so it was somewhat aspirational.

The CP/M Upgrade kit comes with:

  • Pageable ROM – to provide more control over which ROM section is being accessed.
  • 64kb RAM – for extra working memory
  • Compact Flash – to provide mass storage in place of floppy disks or hard disks. The module comes with a pre formatted 128MB card that has a small selection of essential CP/M utilities on.

As it’s an upgrade it reuses the RAM chip and 74 chips from the RAM & ROM modules, but oddly comes with its own R0001009 ROM (versus the R0000009 ROM that came with the Full Monty kit, where the 1 represents the presence of the ‘CP/M Monitor, for pageable ROM, 64k RAM, 68B50 ACIA, CF Module at 0x10, with origin at 0x0000’ in bank 4).

The additional modules worked first time, and following Spencer’s Simple Guide I found myself at the once familiar A> prompt.

The challenge then shifted to finding something useful or interesting to do with a CP/M machine; but practically the first obstacle was getting some CP/M programs onto my RC2014…

The compact flash card comes with a DOWNLOAD.COM utility on the A: drive, which comes from Grant Searle’s CP/M on Breadboard project and provides a way to copy files through the terminal emulator console. Usually I use PuTTY as my terminal emulator, but throwing bytes down a serial link at 115200bps without any hardware flow control is a recipe for disaster, so I switched to Tera Term and configured it for a 10ms per character delay to slow things down a little. Grant’s archive contains a FilePackage.exe program for Windows that encodes CP/M programs and files to the format used by DOWNLOAD.COM, though I had to register COMDLG32.OCX on Windows 10 as simply having the control in the same directory doesn’t work for VB6 apps running on much newer Windows.

With DOWNLOAD.COM working it was time to plunder the archives for MBASIC and Zork etc. With the equivalent of something like 1600 80s 5.25″ floppy disks’ worth of space to play storage shouldn’t be a worry.

Having got used to multi tasking multi user systems I keep wanting to bring up another terminal whilst it’s busy doing something boring like file copying; but of course CP/M is a single tasking single user system, so it needs a bit of patience. Apparently it’s possible to run Unix on the RC2014, so maybe that’s a project for another day.

Notes

[1] Chelsea Back’s Further Debugging RC2014 and First Programs was also helpful.
[2] For things like FTDI cables the problem these days is finding vendors who don’t have compromised supply chains. At least FTDI have backed away from their scorched earth approach to clones.


I like to have permanent SSH connections from (a VM on) my home network to the various virtual private servers (VPSs) that I have scattered around the globe as these give me SOCKS proxies that I can use to make my web traffic appear from the US or the Netherlands or wherever (as mentioned in my previous post about offshoring traffic).

I’ve been using Ubuntu VMs since Jaunty Jackalope and when I discovered AutoSSH I made myself some init scripts that would make the connections. Later on I modified those scripts to run in Screen so I could jump onto them if needed for any troubleshooting. That was all fine in the world before systemd, but with Ubuntu 14.04 LTS reaching end of life there’s no longer a pre systemd choice for a mainstream distro[1]. So I’ve bitten the systemd bullet, and upgraded my VMs to Ubuntu 18.04 LTS.

Of course… my old init scripts didn’t just work. So I had to cobble together some systemd service units instead.

[Unit]
Description=AutoSSH tunnel in a screen
After=network-online.target

[Service]
User=changeme
Type=simple
Restart=on-failure
RestartSec=3
ExecStart=/usr/bin/screen -DmS tunnel1 /usr/lib/autossh/autossh \
-M 20020 -D 0.0.0.0:12345 [email protected]

[Install]
WantedBy=multi-user.target

The unit source code is also in a gist in case that’s easier to work with.

The unit can then be enabled and started with:

sudo systemctl enable autossh_screen.service
sudo systemctl start autossh_screen.service

Going through it line by line to explain what’s happening:

  • Description is a plain text explanation of what the unit is for. In my own I note which location the tunnels go to.
  • After is used to ensure the network is ready for making SSH connections
  • User defines which user the screen runs as, and should be changed to the appropriate username
  • Type simple tells systemd that we’re not running a forking process
  • Restart on-failure means that if screen crashes for some reason them systemd will try to restart it
  • RestartSec tells systemd to wait 3s before doing any restarts (so it doesn’t thrash too hard on something that keeps failing)
  • Execstart gets us to the actual command that’s running…
    • /usr/bin/screen is the default location for screen on Ubuntu (installed with ‘sudo apt-get install -y screen’)
    • -DmS tunnel1 tells screen to Detach but not fork, force a new session, and name the screen ‘tunnel1’ (mine are named after where they go to so that when I resume those screens with ‘screen -r’ I can pick out which VPS I’m using)
    • /usr/lib/autossh/autossh is the default location for autossh on Ubuntu (installed with ‘sudo apt-get install -y autossh’)
    • -M 20020 configures the monitoring port for autossh – make sure this is different for each unit if you’re running multiple tunnels
    • -D 0.0.0.0:12345 gives me a SOCKS tunnel on port 12345 – again make sure this is different for each unit if you’re running multiple tunnels
    • [email protected] is the username and fully qualified hostname for the VPS I’m connecting to
  • WantedBy defines what we’d have previously considered the default runlevel (normal system start)

Although I’ve been using Ubuntu 16.04 and 18.04 to acclimatise to systemd for the past few years I’m by no means an expert, so it’s possible that I could have done better here. Should I have used the ‘forking’ type and stuck with -d rather than -D in the screen flags? I just don’t know. This was cobbled together with help from this autossh gist and this python in screen example I found.

Update 9 May 2019

For a good overview of systemd check out Digital Ocean’s Systemd Essentials: Working with Services, Units, and the Journal (and their other posts linked at the bottom of that overview). There’s more at my systemd PinBoard tag.

Note

[1] I’ve kicked the tyres on Devuan, but we didn’t get along.