Castle Defender is a brilliant new game for the BBC micro

Every now and then a new game is developed for vintage computers. Built by computing enthusiasts these games are often better than the original offerings from the time that the machines were first popular, or include titles and ideas that come from the modern age.

Castle Defender is the BBC micro's first ever tower defence game, and it is really very good. Programmed by Chris Bradburne with graphics by John Blythe, this game is superbly well written and designed. The graphics are stunning and the game play is addictive. I have been playing all morning, with admittedly, a pathetic high score of only 40% to show for my efforts.

A hoard of orcs and goblins storm my castle defences on the BeebEm emulator.
The aim of Castle Defender is to protect your castle from the waves of computer controlled 'nasties'. You build towers at strategic points along the way to shoot your enemies to death. There are three different types of weapons which can be upgraded as you earn more gold. Indeed, upgrading your weapons is the only way you will succeed at this game.

There is an initial steep learning curve in Castle Defender. At first the cursor key controls seem a little counter-intuitive, and you will possibly long for a touch screen. The best approach is to only use the left and right cursor keys to navigate the battle field. The second lesson you will need to learn is how to read the display at the bottom of the screen. Some enemies have shields which make them almost impossible to kill unless you have weapons that can deal with shields. Choosing the appropriate mix of weapons is essential to surviving each wave of nasties in Castle Defender.

Snakes! I hate snakes, Jock! I hate 'em! Come on! Show a little backbone, will ya!
There are four levels of superb high-resolution MODE 1 graphics, with each level getting progressively more 'evil'. You can skip levels by pressing the corresponding key 2,3 or 4 at the start of the game, although if you do the game wont track your high score. The animation is very smooth and the enemies make a satisfying 'pop' when they die.

It really is a joy to see developers creating new games for vintage machines, particularly when the results are such superb quality releases. One geek experience point is awarded each to Chris Bradburne and John Blythe.

You can download a copy of this game for your BBC micro or BBC master computer, or run it on your PC in an emulator such as BeebEm.

Zap that nasty! The loading screen of Castle Defender.
More modern games for vintage computers are available on the Homebrew Heroes Facebook page.

Well that's all from me today. I'm off to squish some 8-bit orcs...

Some weather apps

Yesterday's post started out about the Raspberry Pi Sense Hat, and ended up looking at the Barometer app for Lumia 950. Today, I'll look at a couple more useful weather apps for your Lumia 950.

I have been using GPS Thermometer Free from Jappi-Soft. This app uses your current location at matches it with publicly available weather station data to show the outside temperature for your location.

GPS Thermometer Free on Lumia 950
The paid version includes a live tile with adverts removed. Both versions include a choice of accent colours and displays. Bizarrely, several people in the comments section of the app were disappointed because the app doesn't display the inside temperature of their homes. These people have clearly misunderstood how this app works. I will reiterate: It finds the nearest weather station to you and displays the temperature as measured by that weather station on your screen.

Sun and Moon
I love this app. Sun & Moon by Ronca is a simple app that gives a representation of where the sun and moon are currently located in their daily cycles.

Sun and moon on Lumia 950 showing the current position of the sun as though you were facing South on a cloudless day.

It also shows the sun rise and sunset times and the expected hours of sunlight. Sadly, the app does not cope with the annoying habit we Brits have of setting our clocks forward one hour in summer, so you you also need to add one hour onto the times displayed onscreen.

Perfect Weather
This is one of the most beautiful weather apps I have seen for Windows 10. Perfect Weather is a universal app, which means it is available for both your phone and PC, or any other device running Windows 10. It defaults to your current location, however you can set it other locations as well. Your display will show the current weather conditions, temperature, wind speed and direction, sun rise and set times, air pressure, moon phase, moon rise and set times. In effect it does everything the other two apps do plus more. Sliding your finger across the display will show an animation of the weather for that day. If you want to pay for the full version you will get a choice of background themes which include a Star Wars theme, presumably so you can see what the weather is like onTatooine  (presumably hot during the day, and cold at night).

Perfect Weather Universal showing the weather in Fantasia after The Nothing had finished doing its work.
Part of my Lumia 950 homescreen in all its Windows 10 goodness.

Is there a difference in air pressure between your head and toes?

It has been a lovely day in England today, with highs of 20 degrees (that's 68 F) and a gentle breeze. It has been the sort of weather for relaxing in the sun with a cool drink and a sun hat, and maybe a good book, because it is not often we get the chance to produce some vitamin D in this country. But I couldn't just sit around all day. During the peak of the midday sun, I retreated to the relative safety and coolness of my geek cave and tinkered with my Raspberry Pi Sense Hat data logger.

The 8-by-8 LED matrix on the Sense Hat, which is useful for anything your imagination can conceive. 

The Raspberry Pi Sense Hat data logger uses the brilliant Sense Hat to log temperature, pressure and humidity from its many sensors. You can grab my code from the link above, or read about other Sense Hat projects, and if you have a Raspberry Pi then this is an brilliant add on device that will guarantee hours of fun.

It was this tinkering that made me ponder the question raised in the title of this post.

Is there a difference in air pressure between your head and toes?
Assuming that you have toes on the ends of your feet (as I do), and not growing out of your forehead (as I don't), then there should be a difference in air pressure between these two points due to the difference in height between them (assuming that you are standing vertically). More to the point I wondered whether it was possible to measure this difference. Sadly, Raspberry Pi is not maneuverable enough to lift off my desk (so many things plugged in) which led me to look for barometer apps in the app store.

I soon found Barometr by SeNSSoft for my Lumia 950.

Air pressure at ground level

Air pressure at head height.
And there you have it. The answer is 'Yes', about 0.2 hecopascal (or about 0.1 hecopascal if your name is Frodo).

The best feature of Windows Creators update

So last night I updated my main work horse, the 'beast' i7 Windows 10 machine to the latest update - the so-called 'creators' update.

The download took over an hour on my home network and the whole process was left to complete for several hours overnight. If you are thinking of updating then do so when you wont need to use your machine for maths homework, or general world domination.

What's new?
The new stuff is few and far between, to be honest, and I suspect that most people will either miss it, or not notice or need it at all.

There's the new Paint 3D app that you will get whether you like it or not. I am not sure that I need to create three-dimensional artwork, and my main go-to for digital art is SketchBook for Windows in all its 2D glory. I still remember the days when the best app for my IBM 286 was the Paintbrush application in Windows 3.1. I firmly believe that if all world leaders got together over a copy of Paintbrush, drew a doodle and then used the flood fill tool to colour it in, then the world would be a better place.

In the previous update Microsoft added functionality to Edge browser to let you draw on webpages. In the Creators update you can now draw on the Maps app, which no doubt will be of some use to the lost and confused. I've already drawn a big circle around my house and then sort of coloured it in a bit. Oh, well, moving on...

There are a load of new updates for Edge browser. I have been impressed with Edge from the beginning and it looks like this browser is getting ever closer to being a very good experience. It will at least help wean me off my destructive Chrome habit. Seriously, I am fed up of Chrome hogging system resources and failing to load pages.

The new night light setting allows you to change the amount of blue light your screen emits at night. This is because some studies have suggested that blue-light affects sleep. You can set it in synchronicity with the setting and rising of the sun for your location. I am not overly convinced that blue light has an effect on my sleep though. I am usually asleep like a baby at night, and if I am going to have sleep problems it is because I have woken up at 3am with a brain buzzing with more thoughts and worries than Macbeth. I have turned on the night light feature, but I will turn it off again if it doesn't look right; or if I need to stay up late coding, then I'll wear shades, increase brightness and turn the high-contrast settings on.

Which feature do I actually like?
There is one new feature that I have been long anticipating and that is that live tiles on your start menu can now be conveniently grouped together into folders. This is exactly the same as what you have been able to do on the Windows 10 phone and is incredibly useful for gathering tiles together and neatly packing them away.

Windows 10 live tiles on Lumia 950, now available for desktops running Creator's update.
To use this feature just grab a live tile and move it over another tile that you wish to join together.

Well, that's all for now. No doubt I will be back when I have discovered something else, either way I will be back posting something geeky for all you nerds to laugh at soon.

Hacking a hurricane plant

Monstera deliciosa, Hurricane plant, or Swiss Cheese plant, call it what you will, they are beautiful plants that take little effort to care for and add a tropical vibe to any geek's dungeon. I've had this one for at least ten years after it was propagated from an earlier parent plant (long ago donated to the Art department of a local technical college).

Yesterday I decided to rescue my plant from the sorry state it had got into over winter. I keep mine in the conservatory where in summer it gets plenty of sunlight and stays warm enough over winter.

Hurricane plant after winter in the conservatory.

The first thing I did was to remove all of the dead leaves. Then I trimmed the aerial roots. I noticed that a number of the aerial roots (which usually attach themselves to nearby rocks and trees) were attempting to make an escape through the carpet. Thankfully there was minimal damage.

Next step was to remove the old string I had used to tie the plant to its support and replace with something more sturdy. I use Toolzone Garden Twist Tie Support Wire which provides a very strong bond between plant and support without damaging the plant.

Hurricane plant with some better support
I then removed some of the young plants that were growing from the base of the Hurricane plant. One of the fun things about this type of plant is that it is very 'hackable'. Any of the shoots providing they have at least two leaves and one aerial root can easily be propagated. You simply need to 'hack' parts of the plant away from the main plant and within a few days they should be growing on their own.

I now have two young plants from the parent plant. These plants should ideally be kept in a sunny location away from direct sunlight and given a moist compost. I used a recycled plastic bottle with drainage holes cut into the bottom which should allow me to see the root system as it develops over summer.

Young plants hacked from the bottom of the parent plant

A password for RISC OS

Recently I set up my Raspberry Pi to boot into RISC OS Pi, and I also showed you how to set a password for your Raspberry Pi for when it boots into Raspbian.

Although it is possible to set a password for your RISC OS Pi computer, horrible things happened last time I tried, and that resulted in a reinstall. I am not going to try again.

Instead I have written a BASIC program that performs the same operation. The file is set to run as soon as the computer boots and it is not possible to escape from the program until the correct password is entered. Although it is not the most secure of systems, it will prevent all but the most determined of attacker.

If you wish to follow these instructions, then they are split into the following sections:

  1. The code
  2. An explanation of the code
  3. Setting the file to run at boot time
The code

   10 REM Password protection
   20 REM T Street
   30 REM Version 2.0
   40 REM 2017-04-02
   50 :     
   60 pass$ = "fish"
   70 :    
   80 welcome$ = FNreadWelcome
   90 MODE 18:
  100 ON ERROR IF ERR = 17 RUN
  110 COLOUR 120
  120 PRINTTAB(0,1)welcome$
  130 ok% = FALSE
  140 guess$ = ""
  150 WHILE NOT(ok%)
  160   PRINTTAB(0,3)"Password : "STRING$(LEN(guess$),"*")" "
  170   g = GET
  180   IF LEN(guess$)=0 THEN PRINTTAB(0,5)STRING$(19," ")
  190   CASE g OF
  200     WHEN 8,127
  210     IF guess$<>"" THEN guess$=LEFT$(guess$,LEN(guess$)-1)
  220     WHEN 13
  230     IF guess$ = pass$ THEN OSCLI("DESKTOP") ELSE PRINTTAB(0,3)"Password : "STRING$(LEN(guess$)," "):
          guess$ = "":
  240     OTHERWISE
  250     IF LEN(guess$)<60 THEN guess$ = guess$ + CHR$(g)
  260   ENDCASE
  280 :     
  290 DEFFNreadWelcome
  300 LOCAL file%, welcome$
  310 file% = OPENIN(":0.Scripts.welcome")
  320 IF file% = 0 THEN = "RISC OS Pi, Welcome"
  330 WHILE NOT(EOF#file%)
  340   welcome$ = welcome$ + CHR$(BGET#file%)
  360 =LEFT$(welcome$,78)


You can either type the code directly into your BASIC editor in RISC OS, or download a copy of the file from OneDrive.

  • The password is set on line 60. 
  • Line 80 reads a custom welcome message from a text file set in line 310. You will need to provide a text file with your welcome message.
  • Line 110 should be omitted whilst you are developing and testing. It prevents the program from exiting on pressing of the "ESCAPE" key.
  • Line 310 reads a text file with your custom welcome message. For example you might want to provide a rude message for your little sister. You will need to provide this text in a text file called 'welcome'. You must also provide the full path to the file in line 310. Here I have it in a folder called 'Scripts' in my root directory.
  • Line 320 provides a default welcome message should the file not exist.  Note that only the first 78 characters of the welcome message are used by the program - so keep it short.

Setting the program to run at boot

Once you are happy that the program is running, save it and then add it to the programs that run at boot.  To do this select the '!configure' icon with a double left-click. Then single click 'Boot', then 'Run'. Drag the BASIC 'password' file into the 'Run at startup' window and click 'set', and then 'set' on the boot sequence.

This program will defeat all but the most determined of attackers. It will not stop someone from accessing the BASIC program itself once you are logged in. Although this program will deter the casual nosy parker from accessing your RISC OS machine, you should not rely on it for system security.

Still reading? How about some more Raspberry Pi stuff?

Getting my pi on the network

I have recently been setting up a Raspberry Pi and documenting the process here.

In previous posts I have been dealing with the RISC OS setup. Today I moved over to Raspbian. This post will deal with:

  • Getting the Pi to see my home network hard drive.
  • Setting up the Pi as a home server.
  • Changing the system password.

Getting the Pi to see the network hard drive
I have a 2TB USB hard drive on my home network. I use this to share music, movies and other media between computers in my home. You can read my full article about getting a USB hard drive to work on your network, however I have summarised the steps for Raspbian below.

  • You need to mount the network drive into the Raspbian file system.  To do this you need to have cifs-utils installed.  My Raspberry Pi 2 came with this pre-installed.  You can check whether it exists or not by running the following command: dpkg -s cifs-util

  • Should you need it, you can install cifs using the command sudo apt-get install cifs-utils

  • Next create a directory on your pi for where you want to mount the network drive: sudo mkdir -p /media/network/public

  • You need to edit the etc/fstab file in order to mount the network drive. You may need to give yourself permission to do this, so navigate to your /etc folder and type chown pi: fstab (where pi is your username).

  • Now open the etc/fstab file in your text editor and add the following single line:

   // /media/network/public cifs defaults,rw,username=pi,password=yourpassword,domain=domain 0 0

Note that the first part is //IP ADDRESS OF ROUTER/directory name of network folder. If your network folder has any spaces in the name, eg "My Documents", then replace the spaces with \040, eg My\040Documents.

The second part is the path to the folder you created in part 3. You will need to put in your own username and password .

  • Now mount the drive using sudo mount -a

Once complete, you will see your network drive appear as a folder in your file manager.

Raspberry Pi file manager showing network drive

Setting up the Pi as a home server
The following steps will allow your Raspberry Pi to serve dynamic web pages to other devices on your network.

  • First install the full LAMP stack with sudo apt-get update and then sudo apt-get install apache2 php5 php5-mysql mysql-server
  • This will install all the software that you will need to run a home server. You may be prompted to enter a password so do add a suitably secure password at this stage. Once you are happy with your password (at it is one that you will remember) the rest of the process may take a few minutes.
  • When the install finished you should navigate to the /var/www/html folder. This folder will contain all of the files that your server will use.
  • To check that your server is working, Apache should provide a test page. Using another computer or phone type the IP address of your web server on your home network. Mine is and you may be able to get this information from your home router page or using the command ifconfig. If all is well, you should get a confirmation page.
Apache confirmation page as viewed in Chrome browser under Windows 10

  • You can now replace this file with your own home page. Should you find that you do not have permission to access files in your webserver, you can use the Linux chown command to change ownership permissions. The syntax is: sudo chown pi: item where pi is your username and item is the name of the file or folder you wish to access, for example: sudo chown pi: index.html will give you ownership access to the file. It may still mean that you can't edit the file, so navigate to the file in your file manager, right click and bring up the 'properties'. Then change the 'permissions' to 'change content: anyone'.
Changing the system password
Now that your Raspberry Pi system is running a web server and has access to the network drive, you will probably want to set the password for access to the Raspberry Pi system. Your Pi may boot directly into a password entry when it boots, however many new installations of Raspbian skip this step so as to make using the machine as painless as possible for new users.

  • Find the main menu, and navigate to 'Preferences' and then 'Raspberry Pi Configuration'.

Finding the password preferences in Raspbian
  • You will be prompted to enter your old password before you can change it. If you are using the default user 'pi', then the default password is 'raspberry'.
  • Make sure that you un-check the box that says Login as user 'pi'.
Hit the 'change Password...' button to change your password. Then make sure you un-tick the box shown. This is what has been letting you log in automatically to the Raspberry Pi, but it also lets your little brother get in and see all your stuff too!

Well, that's all I have for today.  If you are still awake, then you might be interested in some more Raspberry Pi related posts.

Life hack 004

How do you remember the number of days in a month?

Do you just know it? Do you recite a poem to help you? Do you consult your calendar?

I use the following method.

Hold your hands out palms facing up and put your little (pinky) fingers together. Now recite the months in order starting with the index finger of your left hand. Move alternatively from the tips of your fingers to the area between each finger where two fingers join your hand. When you reach the little (pinky) finger of your left hand then you should have counted 'July' and moved on to the little finger of your right hand and counted 'August'.

Every time a month corresponds to the tip of your finger, then this month has 31 days. All the others either have 30 days, or is February, and you just need to remember that February is special.

Image credit: Evan Amos licensed under the Creative Commons Attribution-Share Alike 3.0 Unported 

More life hacks

BBC BASIC on Raspberry Pi

Recently I wrote about setting up RISC OS Pi for Raspberry Pi. One of the good things about RISCO OS is that it has a built in BASIC interpreter which is backwards compatible (mostly) with your BBC micro computer BASIC.

One way of running BBC software on your Raspberry Pi is to use an emulator, however it is also possible to run 'beeb' BASIC programs from your pinboard or command line, as this blog post will attempt to show.

RISC OS pinboard showing native BASIC apps and a stormy day in Scarborough.

Whether you choose to run the emulator, or run BASIC as native programs, your first port of call will be some BBC disc images. You might choose to download your BASIC disc images from the internet, or you may already have them on your vintage beeb machine. This post will cover both situations.

  • First load your disc image into your BBC emulator on your PC. I will be using the excellent BeebEm emulator for Windows.  To do this select: File > Load Disc 0 and find the disc image in your file explorer. The disc image will now be loaded into a virtual drive in your emulator. To see the files, type *cat in the BASIC command line.
Load your disc image into your emulator.
  • Export the BASIC programs that you want from the disc image. BeebEm provides you with the option of exporting a file from your disc image onto you PC. Save this onto a USB flash drive.  To do this select: Edit > Export Files from Disc > Disc 0

Export the BASIC files from the disk image onto a USB device.
  • Rename the file that has been exported. You don't want the DFS directory information showing. For example, change $.file to file only.
  • Plug the USB device into your Raspberry Pi. RISC OS should see the USB device which will allow you to copy the file and save it wherever it makes sense on your machine.
You should see the USB drive appear on your icon bar.
  • At this point you will probably have to change the file type to 'BASIC' rather than 'Text'. To do this, press the middle 'menu' mouse button and choose the appropriate option from the menu.
  • Your BASIC program will be ready to run directly from your pinboard.
To run from the command line, you will need a couple of extra steps.

  • First select the filing system for your USB drive. This is likely to be the command *fat32fs

  • Then mount the disk with *mount 0 or *mount 1 depending on the number of USB devices you have. To get a directory listing try *dir :0 followed by *cat and hopefully you will see your file. This can be executed with CH."filename" or edited with LOAD"filename" and LIST or RUN.

If in doubt, RISC OS provides documentation with the *help command. To return to the main filing system type *SFDS

Data Centre

If you have BASIC programs on floppy disc on a vintage beeb machine, you can also get your code running on RISC OS using the brilliant Data Centre from RetroClinic.

The documentation that comes with your data center explains fully how to transfer disc images from floppies or Compact Flash cards onto your PC.

In my case, I am transferring files stored on compact flash drive under ADFS to virtual RAM drives under DFS. These can then be exported onto the USB stick.  Once you have the disc images you can follow the instructions on getting them running on your Raspberry Pi from above.


Although you will find that most of your BBC micro, Electron or Master BASIC programs will run on your RISC OS Pi or RISC OS pico machine, there may be some minor compatibility problems.

Most notably is that you are going to find that your programs run fast. Very fast! This might not be a problem, in fact it might be very welcome if your program involves a lot of graphics. It could be a problem if you wish to play a game but don't have the reflexes of a Jedi.

With a program that I wrote myself for the BBC Master I notice that the different keyboard layout of the BBC machine and a modern USB keyboard caused an issue. This was because my program uses the key combination SHIFT + '3' to reset a timer. On the BBC machines this combination of keys produces the octothorpe character '#' whereas on my IEEE keyboard, this combination produces the '£' character. This was a minor problem which was overcome by a quick patch of the code.

Another problem was that some BBC BASIC programs do not have well-defined exit strategies. Oftentimes the way out of the program is to reset the machine with the 'BREAK' key. Under RISC OS this may cause programs to hang forever requiring a full reboot of the machine.  In most cases you either need to put up with this, or write an exit strategy.

One way of doing this would be to program the 'ESC' key to act like the 'BREAK' key. Just add the following BASIC line into the start of your program:


If you have enjoyed this post then you might want to read other posts about the Raspberry Pi, or about the BBC micro systems, or just something at random from this blog.

RISC OS setup

Yesterday I wrote about how to get going with Raspberry Pi and Noobs. Today I have completed installing the operating systems I wish to use and it is time to configure them to match my own preferences...starting with...

RISC OS Pi is a version of the 30 year-old operating system that originally started life on the Acorn 32 bit machines that you may remember from their golden age in the early nineties- where they could be found as work-horses in nearly every school in the UK. It lives on today and is maintained by RISC OS Open.

And there is a version for your Raspberry Pi.

The RISC OS Pi desktop. It is very easy to think that this is a modern operating system, however it is actually thirty years old. Also, if you are expecting it to behave like Microsoft Windows then you are in for a surprise.

I wrote all about setting up RISC OS in a previous post last year where I talk about some of the essential productivity apps that you should download for your RISC desktop. Today I have downloaded all of the apps that I think will make my raspberry Pi as useful machine and then I then followed my own instructions for how to bind operations to the function keys.

Installing apps from the Pling store is usually a painless process, however some apps do require you to install additional packages (for example the Internet Radio app requires the Mplayer package) which can be installed with the !PackMan program, or may require additional resources to be merged with the operating system resources folder. Thankfully, most apps have very helpful help files included. I haven't managed to install the News app with success this time round, and I do not know what is wrong with it.

It's not Windows

If you are expecting RISC OS to behave like Windows, then you are in for a surprise. Here are some of the main differences.

  • You need a mouse to operate RISC OS. Furthermore you need a mouse with three buttons. If your mouse is one of the two-button varieties with a scroll-wheel, then the scroll wheel will probably act as a middle button. If you have no suitable mouse, then I would recommend the light-weight RISC OS Pico which will boot (in a few seconds) into a RISC BASIC prompt with more memory than you could possibly need.
  • The left mouse button is used for selecting items. The middle mouse button brings up a menu. The menu is always associated with whatever item is currently under the mouse pointer, so you do not need to aim at a separate menu bar at the top of the program. In fact, RISC OS programs typically do not have a menu bar as in Windows or Apple software which makes them look more minimalist. In effect, the menu is always just under the mouse pointer. The right menu button is for adjust. Often it behaves like the right click, but most often it provides you with more options that can be performed on an item under the mouse pointer.
  • When you launch an application, it doesn't actually open. This can seem very strange to a contemporary user who general expects their apps to open on demand. In RISC OS, when you launch an app, an icon will appear on the Icon Bar. This tells you that the app is running and ready for you. Selecting it with the left mouse button will usually open it as a window, otherwise you can drag files onto it or use the middle mouse button to generate a menu.
  • There is no desktop. You will get strange looks when you talk about the desktop. In RISC OS world, the part of the screen with the icons on it is called the 'pinboard'. Windows can be 'minimised' like in Windows operating systems and they become pinned to the pinboard instead of appearing as an icon on the icon bar.
  • Menus are interactive. Unlike other operating systems menus in RISC OS are an interactive experience. Often times you will be dragging icons into a menu, in order to get something to work, or you may be typing into an edit box in the menu itself as shown below.
Here the text file is saved by dragging the file out of the menu and into the folder that you want to save into.

Other useful stuff to know

  • RISC OS can rebooted by pressing CTRL + Pause/Break at the same time.
  • Pressing F12 will open the command line shell.
  • CTRL + F12 will bring up the TaskWindow.
  • If you have a USB storage device plugged into your Pi, you can access the files on this disk through the GUI or from the command line using the *fat32fs command. Go back to the main file system using *sdfs
  • If you have a ram disc set up, your can access this file system from the command line with the *ram command.
  • A BASIC program containing scripts can be set to run on boot-up by dragging the basic file into the !Configure > Boot > Run folder.
  • You can set the date/time using the following commands:

TIME$ = "Thu,30 Mar 2017,17:30:49"

...or whatever is the current time for you.

Well, that's all for now. I hope this post has inspired you to try out some RISC OS goodness, or has helped you get started with RISC OS on the Raspberry Pi.  See you next time.

Getting started with Raspberry Pi

My Raspberry Pi ran into some problems and I have found need to reinstall the operating system(s) and start again. I shall document the steps I have taken on this blog so anyone else can follow in my footsteps.

Part one - installing Noobs.

With your new shiny Raspberry Pi computer will need an operating system. This, as I am sure you know, is the software that runs the computer by providing an interface and managing resources such as file structures, memory and processor threads.

I have chosen to use a 32GB SD card for the operating system and apps and an 8GB card for data. You don't need to use a card this large for the OS, however I want to try out several operating systems at once (and I definitely need RISC OS as well as Raspbian). First time users will probably just want to start with Raspbian and a single 8GB card.

Both of my cards have been formatted with SD Association's Formatting Tool running on my Windows machine, but there are versions for Linux machines as well. Make sure you set "FORMAT SIZE ADJUSTMENT" option to "ON" in the "Options" menu.

I then downloaded the latest version of Noobs which is an operating system installer which makes the whole process of installing the operating systems much easier.

Once the Noobs files have been extracted from the zip file they have been copied on the OS SD card. This card was then inserted into the Raspberry Pi and Noobs started when I powered up.

When you do this, a menu will appear and you can choose which operating systems you would like to install.

Then sit back with a good book and wait for the system to do its thing.  Talking of good books, I thoroughly recommend Raspberry Pi Manual: A practical guide to the revolutionary small computer (Owners Workshop Manual) (Haynes Owners Workshop Manuals (Hardcover)).

This book is an excellent introduction to all things Raspberry Pi, from setting up the machine and getting started with programming languages to building a web server and hardware hacking.  It is like a cross between a computer manual, a recipe book and a Haynes guide to a motor vehicle maintenance. It is written in plain English, with very easy to follow code examples and colourful pictures. There is plenty in here for many weekend Raspberry Pi projects and I thoroughly recommend that you go out and get a copy.

Well that's all for now, I'll be back later with more Raspberry Pi goodies.

A wiki for your desktop

I have recently been exploring alternative software to OneNote. OneNote works really well for me and it is my main note-taking app. I like how I can easily organise my thoughts into a hierarchical structure that synchronises across all my devices. In fact OneNote has for a long time replaced my own memory. I mainly use it as a 'rough work book' for my own ideas, as well as a collaborative space to work with colleagues. I really like how I can make a new quick note from the taskbar in Windows 10, or from my Windows phone or Android tablet when I am on the move. I can start with a quick idea when I am on my Lumia 950 and then finish the task as a 365 document later on. On my Surface device, the OneNote notebook works very well with the surface pen and feels almost exactly like a fine line pen on paper.

In fact, although this articles will deal with some interesting note-taking applications, I do think that OneNote is the king.

There is Evernote, of course, however I have always thought of this as a poor-man's alternative to OneNote. The free version currently only allows me to use the application on a maximum of two devices at once. This limitation has instantly turned me away from using Evernote and I am very unlikely to ever go back to it.

I have used TreePad a few times. The free version allows you to organise a set of notes as a hierarchical tree structure. Your notes can be exported as HTML for sharing with others. The free version has a look and feel similar to your default text editor albeit with a tree structure for organisation. The paid for versions have more advanced features including a full word-processor style of interface and custom styles amongst many other features.

TreePad Lite (free version) running in Windows 10 showing the tree structure.

TreePad document structure of TreePad PLUS (paid for version) showing custom icons/font and other goodness. 

Treepad files (including the node structures) are plain text files, and so it is fairly easy to generate treepad files programmatically in the language of your choice.

Action Note - note taking in your action center

Another note taking app I use is Action Note for Windows. This is a note taking app that sits in your action center. I use this for taking quick notes on my phone and synchronising with my PC. I have already written a blog post covering Action Note last year.


Zim is a 'wiki for your desktop'. Just like in OneNote and TreePad you maintain your notes as a hierarchical tree structure. Each page can include text and images, with a bunch of plug-ins available including task manager and equation editor.

Zim pages are formatted in a wiki structure that allow links to other pages in the document. Creating a new node is as simple as linking to a non-existent page. Links are maintained in a simple mark-up syntax, such as :Notes:page1 or +newpage.

Zim notebooks can be exported as HTML pages with various pre-set templates. Indeed the Zim website itself was written in Zim.

I have only just discovered Zim, and as such have not got much to show for it, however I can already see that it has many advantages over TreePad most notably the fact that it is a free download; can run across Linux and Windows, not to mention the simple node creation and exporting features. Until discovering Zim, I was considering paying for the full version of TreePad PLUS, however now I don't think I will bother.

The Zim manual, written using Zim.
Video Time

Taping from the radio in 2017

How things have changed. Long ago, when I was grass-high to a knee-hopper, I used to record tunes from the radio onto compact cassette (If you are the copyright people reading this, then, no, no I didn't). I would then put the cassettes in my portable stereo and listen to them on the way to geek school. If you were young in the 70s, 80s or early 90s, then it is likely that you did the same.

An actual compact cassette tape actually from back in the actual day

When compact cassettes became obsolete, I didn't miss them. By the mid 90s I had a growing collection CDs and a decent PC hooked into my stereo amplifier in place of a tape deck; and the transition to digital format was seamless, albeit, streaming had replaced recording from the radio.

Today, however,  I found myself doing what I once had always done, except instead of recording tunes from the FM radio onto compact cassette, I was listening on digital radio on my LaMetric Time device. And instead of compact cassette I am using the feature of Cortana on my phone to identify music and then head over to the Groove app to place them into a playlist.

Cortana at work on my Lumia 950
When I said that I don't miss compact cassettes, that is something of a lie. I do. I think that there is something intangible about music on cassette. There is a joy to using them akin to tinkering with a vintage car, or keeping a retro computer alive. It has something to do with the clunk click of the rewind mechanism, or the feel of a chunky plastic cassette in your hands, or maybe it was because you had to write the track listings on a piece of cardboard with a pen. Maybe it was this investment of effort that makes the format enjoyable. If someone gave you a mixtape back in the olden days, then it meant that they really liked you.

I have often considered buying a cassette player to relive my compact cassette days. Unfortunately, apart from a small revival movement amongst some genres of music, compact cassettes are not a viable storage medium beyond the sheer joy of operating them. I have encountered a couple of virtual cassette apps, but they really aren't the same. To the current date I have avoided taping digital radio onto virtual compact cassette, but it really is just a matter of time until I do!

Tape recorder for Windows Phone, available also for Windows 10, and yes, there are a load of cassette apps for Android devices as well, I've looked.
I am not sure what the future will bring. I am hoping for an embedded brain implant that - as soon as someone walks into the room - automatically plays their theme tune into my ear, and plays incidental music so I know when I am in peril.

I can dream.

Well, that's it for now. I will of course post the moment I get a new compact cassette player. Until then, you  might like to read about some more retro computing stuff, or, I don't know, perhaps you just find out your Starwars name or something.

New characters in Have Spell Will Travel

Following some feedback from players, I have implemented some new characters into Have Spell Will Travel (and I intend to add some more soon!).

What is Have Spell Will Travel? Only the best 2D text-based adventure game ever! In #HSWT you can choose one from over two hundred characters in an attempt to complete various quests. You have at your disposal 15 statistics that describe your character. Each challenge will require you to test these statistics, however you are never told how difficult the challenges are. It is up to you to work out how best to tackle a challenge, and up to you to decide whether you will use your magical items to assist you.

Character sheet for a Dwarf Adventurer. Dwarfs are good at 'Endurance' and 'Intuition' based tasks.
Here is an example of a challenge.  The Rabid sheep can be tackled by testing one of five of your stats, but some are more difficult to complete than others. Even though my Dwarf is better at combat than hiding, it may be the case that hiding is easier to complete than combat. Success at Have Spell Will Travel is a careful blend of luck, lateral thinking and extreme violence (well, not the last one).

I have recently added three new characters: The Treant, the Feline and the Robot. Where the Treant is strong and wise, the Feline is a stealthy warrior. The Robot on the other hand is extremely tough and intelligent, however it cannot eat or drink potions; nor can it visit the healer or be turned into a Vampire. This is Have Spell Will Travel the hard mode, because it has not escaped my attention that the robot cannot replenish lost lives in any way. Maybe I will fix this in the next version, with some sort of robot puncture repair kit.

If you have read this far, then it is likely that you will really want to just click this link and play it.

If you enjoy #HaveSpell, then do please let me know (especially if you defeat Warren Fogbender, meet Bert or find the whereabouts of the Armoured Weremole).

Depth First Search in Python

Well, it has been a while since I posted some code onto these pages, so what follows is some Python 3 code for a depth-first search as I taught it to some students today.

The code uses a stack to implement the depth first search. The output shows the nodes visited.

I shall use the following graph as an example. The graph has been coded as an adjacency list using a dictionary where the nodes are assigned integer keys and their value is a list containing the nodes that they are connected to.

A graph representing a maze with ten nodes featuring closed loops. You can ignore the path leading from 9. I have chosen a maze that cannot be solved by following the walls method (it will ignore node 5)

The code:
(Also available as a download from OneDrive because it is highly likely that it won't work well pasted from the browser.)

class mystack:
    def __init__(self, size):
        self.__stack = []
        self.__size = size
        for i in range (size):
        self.__tos = -1

    def peek(self):
        if self.__isEmpty():
            return (self.__stack[ self.__tos ])
    def push(self, item):
        if not(self.__isFull()):
            self.__stack[ self.__tos + 1 ] = item
            self.__tos += 1
            print("STACK OVERFLOW")
    def pop(self):
        if not(self.__isEmpty()):
            self.__tos -= 1
            return self.__stack[self.__tos + 1]
            raise StackEmpty("Stack is empty")
    def __isEmpty(self):
        return (self.__tos == -1)

    def __isFull(self):
        return self.__tos == self.__size-1

    def display(self):
        for i in range (0, self.__tos+1 ):
            print (self.__stack[i], end=", ")

class dfs(object):
    def __init__(self):
        #map is the adjacency list
        #visited keeps track of which nodes have been visited
        #stack is the stack of current nodes under investigation
        self.__map = {0: [1,5,4], 1:[2,0], 2:[3,1,6], 3:[2], 4:[0,8], 5:[0,6,9,8], 6:[2,7,9,5], 7:[6], 8:[4,5,9], 9:[8,5,6]}
        self.__visited = [False, False, False, False, False, False, False, False, False, False]
        self.__stack = mystack(10)

    def main(self):
        start = 0
        current = start
        solved = False
        while not(solved):
                print("exploring node", current, end='')
                if not(self.__completed(current)):
                self.__visited[current] = True
                next = self.__findNextNode(current)
                if next != None:
                    current = next
                    current = self.__stack.pop()
                    print("...deadend...backtracking to", current, end='\n')
            except StackEmpty as e:
                #assume maze is solved
                solved = True
        print("\nMaze fully explored by dfs :-)")

    def __findNextNode(self, p):
        #finds next unvisited node in the adjacency list
        nodes = self.__map[p]
        i = 0
        while i<len(nodes):
            if not(self.__visited[ nodes[i] ]):
                return self.__map[p][ i ]
                i += 1
        return None

    def __completed(self, p):
 #returns true if node p has been fully explored
        nodes = self.__map[p]
        i = 0
        while i<len(nodes):
            if not(self.__visited[ nodes[i] ]):
                return False
                i += 1
        return True


class StackEmpty(Exception):
    def __init__(self, value):
        self.value = value
    def toString(self):
        return self.value

app = dfs()

The output

exploring node 0
exploring node 1
0, 1,
exploring node 2
0, 1, 2,
exploring node 3...deadend...backtracking to 2
0, 1,
exploring node 2
0, 1, 2,
exploring node 6
0, 1, 2, 6,
exploring node 7...deadend...backtracking to 6
0, 1, 2,
exploring node 6
0, 1, 2, 6,
exploring node 9
0, 1, 2, 6, 9,
exploring node 8
0, 1, 2, 6, 9, 8,
exploring node 4...deadend...backtracking to 8
0, 1, 2, 6, 9,
exploring node 8
0, 1, 2, 6, 9, 8,
exploring node 5...deadend...backtracking to 8
0, 1, 2, 6, 9,
exploring node 8...deadend...backtracking to 9
0, 1, 2, 6,
exploring node 9...deadend...backtracking to 6
0, 1, 2,
exploring node 6...deadend...backtracking to 2
0, 1,
exploring node 2...deadend...backtracking to 1
exploring node 1...deadend...backtracking to 0

exploring node 0
Maze fully explored by dfs :-)


Blog Archive