Skip to main content

In the beginning



Many moons ago (1983 to be exact), I wrote a program on the BBC B in 6502 assembler which would allow people to not only find the route and times of a service, but also gave the fares.

This program was around 12K in size (it had to be small as the BBC only had 31K available in Mode 7) and the data was held on a single double sided 5 1/4" floppy. As you can imagine though, to store such a large amount of data and do such things, the data had to be heavily compressed and more than that, as it was copyrighted, needed to be encrypted.

I still have the program and the notes for the data, but the encryption decoder has long since died, so I have all of the Merseyside timetables, but it's completely unusable.

Let's start this though at the beginning...

IN THE BEGINNING

Well before the privatisation of buses, Merseyside had a public transport system that worked together instead of competing against itself so that punters had a service that could (more-or-less) be relied on, irrespective of the day. It was cheap (due to massive subsidies) to use as well.

The problem was that Merseyside had tonnes of bus services as well as trains and ferries and short of having folders full of timetables, it was not simple to know what services ran to where and when and worse, if you wanted to get from A to B, then it was almost impossible to know what to catch.

ENTER THE MICRO

Home computers were coming more and more common and thanks to a large amount of investment in computers, so had schools. Most common was the Commodore 64, Spectrum and BBC Micro (there was also the likes of the Dragon 32, Oric and the MSX machines). For schools, they had the BBC Micro.

There were three issues with the computers at the time.

1. Memory - it was tiny compared to today having between 31 and 40K of available memory
2. File access - the Commodore floppy drive was hideously slow and expensive, there was no fast speed storage on the Spectrum (the micro drive was years off). The BBC drives were good, but expensive.
3. Speed - in BASIC, they were slow. For Assembler, they were much quicker but still not simple to learn.

I plumped for the BBC as I had access to one at home and at school. It also had a built in assembler and the drives were fairly quick.

There was an additional problem - the data schema. While the BBC had a number of database products (with some in ROM), having an additional burden would mean fewer people are able to access it - the point of the program was to have it in schools, colleges and possibly even Merseytravel.

THE DATA SCHEMA (version 1)

Before I detail this, don't judge me on it - I was 12 at the time and knew nothing about relational databases, so this was all just done on what made sense to me.

One consideration is to try and keep the data size as small as possible.

Merseyside is split into 5 areas; Liverpool, Sefton, Knowsley, St Helens and the Wirral. Knowsley was included in the Liverpool area meaning there are 4 areas. Merseyside is also has Halton to the south of Liverpool, Cheshire (south of the Wirral), therefore there the services would start LI (Liverpool/Knowsley), SE (Sefton), HA (Halton), CH (Cheshire), WI (Wirral) and SH (St Helens). Anything from Greater Manchester were given GM

Next we had 3 main service providers; Crosville, Ribble and MPTE. To make things just a little bit harder, some services were shared between two providers (such as the 89 - Speke to St Helens run by Crosville and MPTE). The way this was worked around was to again use two characters for each provider (MP, CR and RI. A shared service would be the MC [MPTE & Crosville] with the larger service provider having the first letter). Services from Wigan and Manchester were provided by GM Buses

Next the service numbers. These were any number up to 3 characters and could be letters or numbers (for example H20, 1, 26, 10A and 479). This meant that in total services would have 5 to 7 characters. This was problematic as it meant data for the area, provider and route number was never a fixed length and worse, data on discs are aligned to 8 byte blocks.

Up next, the route. This was more interesting to get right. There are a couple of issues with the routes

1. Repetition - If you take Picton Clock, there were a large number of routes that go to there, so on each time table for that route, there would be a number of occasions that it would appear. Multiply that up for the likes of the Pier Head or any other terminus.
2. Not all points have a timetable point
3. Timetables with sub-routes on (for example, the 79 route had the A, B, C, D and E routes) were usually on the same timetable which caused a few minor issues. To round to 8 characters, @ was used

To solve the issue of the routes two different tables were used; one giving the actual names, the other a tokenised name. Given the number of route places, a 5 figure number with an optional character for a timetable point was used. Arbitrarily, the Pier Head was taken as 00000* (the * meant a timetable point).

To get a route correct, all points were separated with a colon.

The timetable was going to be dificult. There had to be a way to break these down. It was not unusual to have a particular route running only on a Tuesday and Thursday or just of a weekend. These were typically always on the same timetable. Thankfully, most of the time it was only after 6pm and Sundays when things changed, but it's always the "edge cases" that needed to be catered for. Routes would also have regular times (typically written as "and then at these minutes past the hour").

Unlike the route, you couldn't have 24 hours by 60 minutes and associate that with a route point. That would be very wasteful. But let's pause and think how the timetable would be put together

ROUTE NUMBER |
             -Provider Code
             -Route Figure -> Route Map -> Route Names
                           |
                           -> Map time map -> Time point map
                                           |
                                           -> Time

If the time was an every, it would be preceded by a # with the Days signified with MUWTFASEL (E = everyday, L weekend only). If a day is not on the map, it is replaced with a #

So, for the 79 at the Pier Head, the time table would be

LI79@@MP|0000*:00001:00002:00003:00004*...->Pier Head:James Street:Victoria Street:Hood Street Gyratory...|0000|->00001:00010->MUWTF##|0515:0530:0545...*10:*20:*30:*40:*50:*00:1800:1820:1840...2320

Possibly not the best way to do it, but it would be refined - and I'll tell you how next time!

Comments