Hacker News new | past | comments | ask | show | jobs | submit login
R.T. Russell's Z80 BBC Basic Is Now Open Source (cowlark.com)
88 points by ingve on June 14, 2019 | hide | past | favorite | 26 comments



Richard Russell was also involved in the Colour Recovery Working Group, which successfully sought to recover the colour signal from black and white telerecordings.

For background: many programmes produced on colour videotape by the BBC in the 70s, were distributed to overseas broadcasters on black and white film only. When the BBC destroyed the original videotapes, this left the black and white films as the only remaining copies of these programmes. In some cases, however, the colour information had been accidentally embedded into the black and white film (a notch filter should have been used to remove it).

So around 2008, Richard developed a piece of software, in BBC BASIC, which was able to recover the embedded colour signal and restore several programmes held in black and white to their full colour glory.


The process seems fairly DSP intensive. If I recall, the IQ modulated color signal would leave a dot pattern in the luminance signal. I wonder how many frames it could process a second, if written in BASIC.


From memory, it would do 1.5 frames per second.


Great!

I'm currently working on a homebrew Z80 computer on breadboards and wirewrapped boards, and building all the (simple) hardware and software from scratch, using vintage chips (strictly no post-1989 chips) and Steve Ciarcia's Build Your Own Z80 Computer as a reference, but with a much higher spec (32K or better).

My original plan is porting Li-Chen Wang's Tiny BASIC (https://en.wikipedia.org/wiki/Tiny_BASIC) to my homebrew computer, and describing its operation at my local hackerspace. Basically, after Bill Gates' has written his letter, there was a revolt in the microcomputer scene and many hobbyists sought alternative implementations. Around the same time, Li-Chen Wang released his hobby project - Tiny BASIC, with full source in public domain. In retrospect, it can be seen as a free software project before the free software movement. Although its functionality was extremely limited Proof-of-Concept and never widely used, but I believe it's a piece of important legacy of the FLOSS community worth mentioning.

But now, since BBC Basic is now free, I'm looking forward to port BBC Basic to my system as well!


Sounds like a great project, good luck. I'll share my favourite tip from back in the day when I regularly brought up new bare metal Z80 systems. Just on the off chance it might be useful. Use a blank EPROM as your first program. It's all 0xff bytes which are RST 7 instructions, equivalent to a subroutine call to 0x0038. So you should observe an super tight loop of an 8 bit read of 0xff from 0x0038, then a 16 bit write of 0x0039 to an ever incrementing address. Suitable for scoping each bit of your address and data bus. The incrementing write address is the stack pointer, which just cycles through 64K. The most significant address bit toggles at the rate it takes to cycle through 64K. Although 0x0039 return address keeps getting pushed onto the stack, there's no corresponding pop, the stack is just perpetually overflowing. But it doesn't matter given this 1 byte "program" serves only to give you the simplest possible repeating pattern to look at with your oscilloscope.


Good luck with your project. I am sure you will find it really rewarding when everything is wired up and it actually works. I like your detail of using strictly vintage chips, not heard of that before, you are taking the art to new levels with that.

I built my own computer with breadboards and a very simple EEPROM. My goal was to have it just turn on a few LED lights and do so according to a few very simple switches. That was satisfying enough. The wow it works moment was worth the many hours with things like an oscilloscope.

If you want to do more than what I did - just get the thing to turn on - then I highly recommend the BBC BASIC. It is just built better than other BASICs that were doing the rounds and definitely suits a hardware oriented project.

If you wanted a breadboard built computer to do actual interfacing, maybe to a strain gauge or other hardware then you will do well to take the BBC BASIC route. You can talk to your IO controller with it and do so with the built in assembler. Your code for presenting results or storing data can be done in BASIC and you can drop down to assembler to do the nitty gritty stuff quite easily. On today's modern computer even if running Linux you are kind of stuck as to where to start, with BBC BASIC you can accomplish low level things from first principles.

Whatever you end up doing with your project, I think that there is definite merit in doing it with BBC BASIC, I think you can beat a path that others (particularly in the UK) will see as a good one to follow. Good luck and have fun stripping those wires!


"during the early eighties every school child in the United Kingdom was exposed to it, spawning a whole generation of bedroom programmers." Erm no. When I was at secondary school, only those deemed to be good at Maths were allowed to work with the BBC Micros, despite having some skills already from owning a ZX Spectrum at home. This maths centric view was partly why I didn't try to study Comp Sci at Uni and went to do Chem, and then fell into more IT classes and post grad and onto an IT career subsequently.


The original Sophie Wilson version of BBC BASIC was brilliant. I did not get to play with the Z80 version but if it is a faithful original of the BBC 6502 version then this a valuable contribution to open source software.

The UK owes a lot to the people such as Sophie Wilson (who wasn't Sophie then) that were extremely forward thinking. The BBC Micro was just for kids. Rather than dumb it down the creators went the other way.

Anyone not familiar with the BBC Micro (because they weren't a kid in the UK in the 1980's) can't really appreciate how good it was and for its time. Perhaps an analogy could be found between arcade games machines and home consoles of the era, the arcade machine just worked, the console was just compromised in every way in comparison to what you had in the arcade original.

It was the same with the BBC and home computer rivals. There was just an edge of performance to it that no other home computers had. This was because the hardware had all the add ons, e.g. a decent sound chip, not just one but two competent graphics chips, a socket next to the keyboard to put your home blown EEPROM in and every port you could imagine at the back and under the machine.

The BBC Model B was a true Rolls Royce of a machine and we gave it to kids.

BBC BASIC was equally deluxe. The built in assembler that was embedded in was awesome. Particularly when you only had a 6502 which has all of three registers - X, Y and A. I was doing assembler at school and plenty of other kids were. No extra software was needed, nobody needed to pay for a compiler, it was all in there.

The rest of BBC BASIC was sophisticated compared to all other BASICs of the time. You could and did write procedures at a time when other BASICs would have you doing GOSUB with a line number.

Later when I moved on to the IBM PC with MS-DOS I felt extremely disappointed. It was actually backward! It lacked the sophistication the BBC Micro had. It was MS-DOS that I found particularly dumb, I just felt 'is this all there is?' and could not believe this was the new 'better'.

Exposure to BBC BASIC, UNIX and today's Linux makes me wonder whether Microsoft's products from MS-DOS to Windows have really advanced computing as we know it. I am not knocking Microsoft entirely as I do believe some of their products such as Word 2.0c were fantastic at enabling progress. But with Microsoft came a particular model of personal computing, we stayed on floppy disks far too long and Microsoft BASIC introduced things that are best not taught - i.e. the GOTO statement.

Anyway, the BBC Micro and BBC BASIC were free from this Microsoft way of doing things, the BBC Micro got it right and it was a vision that was gifted to a generation of schoolchildren.


The BBC was made by a company called Acorn (where Wilson worked), and after the BBC they wanted to go 32-bit but were unhappy with the Motorola offerings of the time - so they designed their own brilliant low power processor for their “Archimedes” machine.

They later spun the processor division off, calling it “Acorn RISC Machines”, where Sophie Wilson still works - except, it was shortened to the acronym, ARM. Yes, that ARM.


And during the initial development of ARM, a BBC Micro was used for writing an ARM simulator. After the successful production of the ARM chip, the BBC Micro was still used as a monitor. https://en.wikipedia.org/wiki/BBC_Micro_expansion_unit#ARM_E...


RISC OS, the ARM descendent of the BBC Micro OS, runs on the Raspberry Pi, and there is even a "Pico" version that boots directly into BBC BASIC (though it is now called ARM BASIC V):

https://www.riscosopen.org/content/downloads/raspberry-pi

It is the closest you can get to a BBC Micro today, and it is extremely close. A BASIC library for working with the GPIO pins is even included.

The whole thing is Apache 2.0 licensed.


I had a similar experience: I used a Beeb in my teens and then started using PCs. My Beeb had (has, actually) Pascal installed as well. So I had Basic, colour graphics, built-in assembler, a word processor in ROM (Wordwise), and Pascal. All of it instantly accessible as soon as the machine turned on. So a PC, which had nothing available without loading DOS and then something else, was a horrible experience.

One thing I find really interesting about BBC Basic is that all the low-level routines (floating point, graphics, etc.) are available for your own assembly programs so you can use them even when you are not using Basic. I don't know if other 8 bit machines had this.


It was just brilliant being able to drop down a gear and do stuff in the Assembler. You still had access to all the trimmings.

Not that BBC BASIC was written badly and needing extra assembler stuff. Commodore people had to poke obscure data into obscure places for things that should have been in BASIC.

On the Sinclair machines you were using REM/CODE statements to store HEX, so you would need to look up the hex codes for all your commands and then type them in. So much to get wrong!

So no, the BBC was in its on league.

A parallel today is browsers. Remember when Internet Explorer did not have dev tools? Or when you needed Firebug for Firefox?

Chrome came along with proper dev tools, changing all that. I think that the BBC BASIC was analogous to that.

I am glad I was not alone in finding the PC experience after the arcade grade instant-on performance of the BBC. I didn't get Pascal but Wordwise takes me down memory lane. You had some fine ROMS... All bank switchable of course.


Your personal experience is very interesting but it's misleading to claim the BBC Micro was "given to kids" or "gifted to schoolchildren", as if the BBC or its Micro inspired a generation of British computer enthusiasts or programmers.

In reality kids were largely not allowed to go anywhere near the beige Rolls Royces gathering dust in classroom cupboards, because they were so expensive and/or because nobody was trained to use them.

The massive gaming and programming ("computer literacy") explosion in the UK in the 80s was almost entirely thanks to the ZX Spectrum, ZX81 and ZX80.


They had some in my primary school and we were allowed to use them.

Mostly I'd just play with "PRINT" and "COLOUR" in BBC BASIC.


I never owned a BBC Micro but my school let me borrow one every holiday. It was a comprehensive, a state school, so anecdotal.


As in take it home? That's amazing. They had at least one BBC at my middle school in the early/mid 80s, and we once or maybe twice got to play Frak on it. That was it. :/


Frak!

I totally forgot about Frak. I will have to see if someone has uploaded that being played to YouTube. Inevitably they will play better than I would and I would also avoid the risk of getting hooked into a game...

https://www.youtube.com/watch?v=UgiA10MfOu4

From the comments, the levels on stage 1 spell 'FRAK'. As per the comments, I don't think I knew that!

It was such a rich diversity of games then, it was more like listening to music in that you don't just have the one song you listen to, depending on your mood you have different things to listen to. With modern consoles you just have the one or two things in practice, you don't have the repertoire.

As well as the BBC Micro there was also the CUB monitor and disk drives. Imagine that!

This was mid eighties, I don't think I did any formal computer lessons at school, it was a lunchtime thing where things like Frak certainly got played. I know you envy my fortune - and in a regular state school.

During one holiday I made things like a pantograph arm for drawing with - bits of carefully cut perspex, potentiometers and the A/D port, then some code to do the trig and draw something on a screen. This was my first go at using a saw, a file, a soldering iron and also my first experience learning the reality does not match the dream. The noise in the A/D was ridiculous and having real time screen updates was also not exactly without lag.

This was an entirely self directed project, no competition or even idea from a magazine. Just a desire to draw at a time when ambition just worked. It was useless at what it did but there was more maths in that than what 99% of the population ever use, even if simple trig.

To think nowadays kids all have their own laptops/tablets/phones and there is zero recognition that 32K of RAM and a beige box could be special. But they actually do much better things now than anything I was ever up to.


Russell's BASIC is supposed to be as close as possible a copy of the BBC Second Processor system BASIC, which was v4 (v1 was the rather buggy version in the 1981 Model A, v2 the bugfixed 1982 Model B, v3... don't know, probably the almost unheard of B+, and v5 was the hand-tooled and significantly improved ARM version for the Archimedes line of computers). I believe the on-disk representation is compatible with Acorn's version.

Incidentally, the BBC Micro had a real operating system, and a lot of BASIC functionality just shelled out to the OS. Russell's Z80 version replicates a lot of this itself, so commands like LOAD and SAVE to load and save raw memory will just work. EXEC, which reads console input from a file, and SPOOL, which writes console output to a file, both work too, which means converting to and from text is easy.

Of course, none of the graphics primitives work, but all the hooks are there if you want to extend it!

If anyone's interested in what BBC BASIC looks like, a little while ago I managed to recover a program I wrote in it in 1991. It uses graphics so I haven't tried it on the Z80 version, but it's interesting to look at nevertheless; and there's an emulator too:

http://cowlark.com/2015-02-03-bbc-micro


I couldn't understand what you meant by wasn't Sophie then so I looked her up. She's a transgender woman. Transgender people are getting it in the neck a bit at the moment, it's nice to have an example of such an impressive person who is one.


Identity politics don't come into it really.

Acceptance of transgenderedness means that we call people by the name they wish to choose but it does not mean we eradicate the past. Same if someone gets married and changes their name. It should be no big deal and nothing awkward.

It is all about merit. It gets a bit silly if we give people extra cringeful 'well done!' marks just because of some identity politics thing.

Sophie is not the only successful transgender person in UK tech, however I think she just gets on with her work. Also fully admirable is Kate Craig Wood and she does write on the subject of how it all works out. Since your interest is piqued and this is the internet, here you go. Again, I would say in Kate's work it is more her business that defines her rather than the transgendered aspect, so you should find how they run their business (not beholden to VC money etc.) quite fascinating too:

http://kate.craig-wood.com/


I agree with you that my comment was a bit cringeworthy, but at the same time, unlike for gay people where there are any number of well known successful people, I was unaware of any successful transgender people. They only ever seen to get a mention in connection with some controversy over gender reassignment or conflict with feminists.


Lynn Conway is another notable transgender woman in tech, with influential accomplishments in computer architecture and VLSI design, and later as a DARPA research administrator and academic.

https://en.wikipedia.org/wiki/Lynn_Conway


The Eurovision contest produced a few winners (and famous also rans), such as Concita Wurst (sp?) and Dana International (sp?); but indeed I can’t think of many examples outside ShowBiz (Wendy Carlos is a musician; Sophie Wilson and Audrey Tang in tech; can’t recall any others)


Wendy Carlos


WoW! Finally, my second programming language.




Consider applying for YC's W25 batch! Applications are open till Nov 12.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: