PiTubeDirect on the BBC Micro and Electron

PiTubeDirect is a project that turns a Raspberry Pi into one of many different coprocessors for the BBC Micro. It also works on other Acorn 8 bit computers including the Electron, but you need extra hardware for that. I have a few old Raspberry Pi’s including a Raspberry Pi Zero that was not getting much use in a RaSCSI. The main other parts are two 74LVC245 transceivers and I had a few of those too.

For some background, the original BBC Micro had a ‘tube interface’. Basically a 40 pin connector (looks the same as an IDE connector) that carries the databus, a couple of address lines and some control signals including a chip select. Back in the 80s, you would have plugged a physical ‘external Tube Coprocessor’ into the 40 pin connector. Your external box would have included a CPU, ROM, some RAM and ‘Tube interface ULA’ chip that implemented some FIFOs to allow the two CPUs to communicate. Here’s some details about the tube protocol.

I just hacked it together on some protoboard. It’s quite easy to put together. The project has been around for a while and I found two different schematics. An older one that did not use the A3 address line, and the newer one that does. I wired in the A3 line. As you can see from the later photos, I haven’t quite gotten around to sawing off the excess of the prototype board. I have a small jumper on the board to allow me to use the BBC Micro’s power or not. I realise that the Pi Zero that I am using probably has the lowest power consumption of all the Pi’s, but I’ve had so much trouble in the past with how power hungry Raspberry Pi’s are (in general) that I generally run it with power being fed into the Raspberry Pi’s power USB connector.

I’ve actually wired it slightly differently … which is more to do with the placement of the 74LVC245’s. You can also see the 270 ohm resistors between the Tube connector and the ‘data bus’ 74LVC245 (more on those resistors further down). After some false starts I had the ‘6502 TUBE’ banner and there are a couple of benchmark/tests that you can run straight away. There is this sphere one:

OLD

RUN

And another that does some benchmarks

PAGE=&1000

OLD

RUN

 

You can also get a list of available coprocessors with

CALL &2000

I am using the ‘Hognose’ release of PiTubeDirect and the default is now ‘coprocessor 24’ which is a JIT based 6502 … which is very very fast.

And if you have the most common BEEB.MMB for the BBC Micro you can run the tube version of Elite.

*DIN 0 45

*TUBEELT

So that is the BBC Micro. Of course, one of my favourite machines is the Electron and it is possible to hook the pitubedirect to it. In a normal hardware world you might have a Plus 1 or Plus 3 expansion and then you need a Tube card of some sort, and then you probably need an AP6 rom to just get to the point of being able to connect the pitubedirect. For me, I have none of that hardware, but I do have my Electron ROM emulator. I thought if I put a 40 pin connector on my ROM emulator board, then wired it to the 6502 data bus and the 4 address lines the tube interface has, then there are only a couple of other signals and a chip select that needs to be added. There is a newer Electron Tube interface card discussed on the stardot forums. If you look at the schematic it is basically a 74LS245 transceiver and a GAL .. and the main point of the GAL is to decode the address to get the chip select. The chip select needs to go low for 0xFCE0 to 0xFCEF. I thought I could ignore needing the 74LS245 because ‘hey, there are already the 74LVC245 transceivers’ on the pitubedirect. I also thought ‘Instead of adding some chips to decode the 0xFCEx address, I could just do it in software. Just like how the ROM emulator detects that you are writing to the plus 1 printer port and ‘does something’, now I’ll detect reads and writes to 0xFCEx and send a GPIO line low to act as the chip select.

All good. I wired it up, updated the code and it didn’t work. This took me down some rabbit hole for a few days which eventually ended in mostly success (though I am still testing). The key things are;

  • Those 74LVC245’s have a lot of ‘drive’. I have placed 270 ohm resisters between the databus 74LVC245 and the Electron’s data bus.
  • I think if anything the stm32f407 really dislikes the ‘drive’ more than the 6502.

 

  

So it does seem to work. At the moment, I have the changes to the electron-rom-emulator in the tim-tube-version branch , but hopefully I will merge that to master at some point.

I can run all the 6502sp test programs. I can boot CPM and run Hitchhikers Guide   .

But there are a couple of things that puzzle me; 1) The Electron doesn’t make the same distinctive beep as it boots. Its shorter and muffled. But the Electron still boots and seems to work 2) The Electron Tube Elite posted on stardot seems to crash badly when you ctrl-break out of it (filling the screen with ‘Bad Command’ until you ctrl-break a few times).

Other than that it all works pretty well. I have no idea what to use it for though 😉