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.

Thermometer
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:
      VDU23,1,0;0;0;0;
  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$)," "):
          COLOUR2:
          PRINTTAB(0,5)"PASSWORD INCORRECT!":
          guess$ = "":
          COLOUR120
  240     OTHERWISE
  250     IF LEN(guess$)<60 THEN guess$ = guess$ + CHR$(g)
  260   ENDCASE
  270 ENDWHILE
  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%)
  350 ENDWHILE
  360 =LEFT$(welcome$,78)

Explanation

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:

   //192.168.1.254/usb1 /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 http://192.168.1.162 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.

Compatibility

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:

  ON ERROR IF ERR = 17 OSCLI("DESKTOP")

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.



Label