My BBC Microcomputer BBC BASIC version of the BBC 2 station clock shown running in VirtualBeeb. VirtualBeeb is a BBC Microcomputer Emulator which runs in a 3D environment VirtualBeeb shows a BBC microcomputer, a Cub MicroVitec 1431 colour monitor and a background taken from Acorn's 1980s advertising material. The monitor shows the output of the BBC Microcomputer with a CRT phosphor filter, so it looks very realistic.

A little GEM

Sometimes, things don’t go as well as you expect. Other times, things go a lot better. And here’s one that falls into the second camp.

After creating Oliver Elmes’ 1979 BBC2 symbol in Owlet, I thought it would be fun to create the fully-electronic BBC2 station clock to go with it. The BBC2 station clock was a wonderful piece of design by Richard Russell and he can tell the story of how it came to be far better than I can. The clock was two pieces of electronics, the GE6/545 to generate the clock face and caption and the GE1M/597 for the hands, but the presentation department of the BBC called the end result the “GEM” clock.

As well as creating the BBC station clock, Richard Russell is undoubtedly the most important figure in the long history of BBC BASIC after Sophie Wilson, so using the BBC Micro to create the BBC2 station clock seemed rather appropriate.

Inkscape, the open source vector graphics editing program, is shown. In the editing window is a black image of the BBC GEM clock face with no caption at 12:00:00. The clockface and hands are entirely black on a white background. Horizontal and vertical blue guidelines are shown in the image.
The GE1M/597. clockface in Inkscape

I’d already drawn this clock in Inkscape, and so the starting point was my Inkscape drawing, scaled to be 1280 x 1024. I’ve placed this drawing in my GitHub repository of all the BBC BASIC programs I am writing for the BBC Micro.

One thing I realised I had to do was dust off my knowledge of trigonometry. I was going to have to draw the clock face and hands using trigonometry and my school Maths teacher Gary (@Gazpics76@mas.to), who first taught me about radians, was following me on Mastodon so I had to do a good job of it!

Back in the day, I always did badly at trig. I could do the maths, but invariably went wrong because I used to draw such awful diagrams to work from. However these days, my Inkscape diagram coupled as my working diagram and things were much easier!

The first thing I did was have a look at the CLOCK program on the BBC Welcome Disc (hold down SHIFT and press f12 to run the Welcome Disc) to see what it was doing. Then I fired up Owlet, and got cracking.

When doing trigonometry on a computer I invariably use radians as I find loads of DEG() statements make the code very messy to read. After writing the clock-face code, I noticed it drew very slowly indeed. I realised that I was working out the same SIN and COS values over and over again when I only need to work them out once and reuse the value. The clock-face still draws slowly, but it’s very quick compared to how slow it was.

Owlet, with the BBC BASIC code on the left and the program's output shown on the right. The output shows the BBC2 station clock is showing the time 04:04:32.
The clock face and caption successfully drawn

With the clock face drawn, I should have realised I also had the code for the hands and created one routine to draw a rectangle at an angle at a certain distance from an origin point. But I didn’t, so my code is full of repetition and could do with a good refactor.

To animate the clock, I decided to use GCOL3. This is the EOR (or XOR if you are not in the Acorn world) plotting mode allows you to draw and erase using the same routine. If there were eight colours available in MODE1 then I would have been able to make the overlap between the hands white and made the clock look a lot more professional. As it is, the area where hands intersect is black.

To create the caption on the bottom of the clock I turned the PLOT statements in my BBC2 logo program into DATA statements and then drew the logo at around half size at the bottom of the screen. I was relieved to find that it still looked fine without any adjustments.

One of the problems I found was with using DATA statements in Owlet was that when I added code, the RESTORE values had to be updated. I was using RESTORE to redraw the white 2 by itself without the stripes, and changing the RESTORE line number was a bit of a pain. BBC BASIC V on the Archimedes solved this by having RESTORE +expression.

Owlet, with the BBC BASIC code on the left and the program's output shown on the right. The output shows the BBC2 station clock at 22 seconds to 11 o'clock. The cue dot (two small parallel white vertical stripes with a black stripe between forming a small square) is shown at the top right of the screen.
The cue dot added for a bit of fun

Once the clock was working well, I added a couple of extra features. The first was a cue dot. Cue dots on the BBC were the black and white striped dot that appeared in the corner of the screen to indicate some kind of transition was about to happen. They often appeared when the clock was on screen, particularly before the news. You can toggle the cue dot by holding down the space bar.

Owlet, with the BBC BASIC code on the left and the program's output shown on the right. The output shows the interface for setting the time. It's a red window that appears in the top-left corner of the screen with the text "HOURS: 4", "MINUTES: 3" and "SECONDS: 2". The clock face has no hands while the time is being set.
Not the prettiest UX design!

Finally, I added a facility to set the time which you can get to by holding down the tab key. I pinched the code from the Welcome Disc clock program to do this.

My BBC Microcomputer BBC BASIC version of the BBC 2 station clock shown running in VirtualBeeb. VirtualBeeb is a BBC Microcomputer Emulator which runs in a 3D environment  VirtualBeeb shows a BBC microcomputer, a Cub MicroVitec 1431 colour monitor and a background taken from Acorn's 1980s advertising material. The monitor shows the output of the BBC Microcomputer with a CRT phosphor filter, so it looks very realistic.
BBC BASIC GEM clock in VirtualBeeb

If you want to see the clock in action, here’s a link.

After creating static graphics in Owlet, it was nice to create something that moves, and it’s given me an idea for something I might like to tackle next.


Posted

in

, ,

by

Tags:

Comments

One response to “A little GEM”

  1. […] doing a BBC2 “GEM” clock, I thought it would only be right to do the BBC1 clock to go with […]

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.