top | item 24611341

Fully documented source code for Elite on the BBC Micro

356 points| gjvc | 5 years ago |bbcelite.com

125 comments

order
[+] jlokier|5 years ago|reply
Hehe.

When I was about 12, I printed out the entire disassembly for the Disk version of Elite on the BBC, on a dot matrix printer.

Because dot matrix paper is continuous with perforations, the printout filled much of my room, and I pored over it, writing notes and getting to learn all the little tricks and algorithms!

So I had my own fully documented source code for Elite back in the day :-)

[+] drclau|5 years ago|reply
Heh. When I was 12, I had a Romanian Z80 based computer, that would run BASIC. Because I didn’t have a tape drive for it, I was writing entire programs and then write them down on paper, and “reload” them after the computer would reset, or if I were lucky, just the next day.

At one point I figured out the opcodes for Z80 were at the end of the somewhat thin manual, and that I can read/write straight into memory. That was so much fun. This was a lifetime ago, I hope what I remember is correct.

Later on, I got a second hand 8086 based PC, which came with a full setup: central unit, display (monochrome), keyboard and mouse, and 5.25” floppy disk drive. Oh, right, and it had a big, loud, slow 20MiB HDD. It came with some early DOS and GEM desktop environment.

On this machine I encountered the first computer virus, named Romania.856. By that time I had access to BBS through some friends, and I got to download various docs about assembler and so on. I had and loved F-Prot antivirus for its database of virus descriptions.

So I set myself to reverse engineer this virus (I had no idea it’s called reverse engineering), by using the old debug.com (or was it exe?) that came with DOS. I wish I still had my notes from back then. At some point I got Turbo Debugger too, that made things so much easier.

I was merely 14 years old, and spent a whole summer doing things like that, while other kids were doing whatever other kids normally do. I learned everything about that virus, and later about others.

[+] quickthrower2|5 years ago|reply
That's crazy. When I was 12 I tried to learn assembler on BBC from a book and just didn't get it at all, even the basics. How did you even grok a printout like that?
[+] stevesimmons|5 years ago|reply
When I was 12 - probably a few years before you - I didn't have a dot matrix printer so I wrote out the entire disassembly of the Vic-20 ROM in school exercise books.

That took the first few days of the 1983 summer holidays.

The rest of the holiday was spent happily analysing it and annotating my source code, figuring out how BASIC worked, including the floating point routines.

[+] peignoir|5 years ago|reply
That’s impressive indeed! When I was 12ish I was just struggling with BASIC and PASCAL on PC. No documentation nothing... had to wait a couple of years to learn assembler on an hp48 and later to have a pirate version of Borland C and some books to make sense of the things I would randomly understand ... oh and I loved elite :)
[+] 72deluxe|5 years ago|reply
I remember designing glyphs on grid paper and an animating a character to walk across the screen thanks to an "advanced bbc micro techniques" book I found in the library.

I didn't understand the section on 3D objects at all though! I still don't, although I did find the book and port it to C++ the other year to draw a poor-man's 3D system in wxWidgets.

Fascinating.

[+] DEADBEEFC0FFEE|5 years ago|reply
You must have been very proficient, my understanding is the Elite code was particularly optimised.

I tried 6502 on the beeb but really found it a slog.

[+] jacquesm|5 years ago|reply
Same here, but with the source code for Microsoft basic on a Dragon 32, and then later again with the MOS and Basic roms for the BBC Micro.

It is really nice to be able to say you know what every byte in your computer is for.

[+] currymj|5 years ago|reply
the original creator of Elite made a new version of the game, called Elite: Dangerous. It's the same essential game, but online and with modern, realistic graphics:

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

The really cool thing about it is that it's set in a 1:1 scale model of the Milky Way. Most known stars are in there, approximating to a large extent their true astronomical properties. Whatever isn't known is procedurally generated in a way that's motivated by real science. They even put in the TRAPPIST exoplanets, which you can go visit.

If you liked any of the old Elites or are a space nerd, you really ought to consider playing it.

[+] spacedcowboy|5 years ago|reply
My cousin is one of the directors of the company. One Xmas I got a signed copy from David :)

Elite on the Beeb was the game that started me coding, all those years ago, and now I work in R&D at Apple.

[+] memsom|5 years ago|reply
One pf the original creators. Braben was only one of the two developers, Ian Bell was the other one. There is a version of the trading portion of the game available in pure C on Ian's web site[1].

[1] http://www.elitehomepage.org/text/index.htm

[+] thom|5 years ago|reply
Also Frontier Elite II runs great in DOSBox and is my favourite in the series. I believe it was the last big commercial game to be written entirely in assembler and fit on a single floppy disk.
[+] Stevvo|5 years ago|reply
It has some beautiful moments, but for the most part the gameplay is uninspired and repetitive. 80% of your time is spent staring at a wormhole animation or floating dust in super-cruise.
[+] ffhhj|5 years ago|reply
Interesting! What engine did the use to make it?
[+] FandangoRanger|5 years ago|reply
After they abandoned my platform after supporting it and promising to always support it, and after they failed to support Linux, I decided not to pay for any of the newer versions and stop playing the game. Don’t get me wrong, it looks great and is decently fun, but it feels incredibly limited to even Frontier.
[+] abraxas|5 years ago|reply
Here's an excellent long read for those who need the background. Well worth your time to read even if you didn't grow up playing Elite:

https://www.theguardian.com/books/2003/oct/18/features.weeke...

[+] 082349872349872|5 years ago|reply
> There were only 150,000 or so BBC Micros in the world at that point, so the ratio was almost 1:1, one copy of Elite for every computer that could run it.

Now I'm curious. How many players who made it to Elite Elite are currently members of the anorak elite?

[+] oska|5 years ago|reply
> Braben was studying natural sciences, Bell was on the maths course. Neither went anywhere near the computer science department, which they had arrogantly but accurately decided offered them nothing useful.

They're talking about Cambridge in 1982. Was the computer science dept. really useless at that time? I doubt it. Obviously, I respect their DIY ethos and their genius for invention but they might have picked up some ideas for further invention if they had done some CS courses.

[+] simonw|5 years ago|reply
The level of detail and quality of writing in this is unbelievable. I can follow it really clearly, and I don't know anything about assembly on the BBC Micro.

Direct link to the most interesting file (which is 1.5MB so sadly doesn't open in GitHub's regular web interface): https://raw.githubusercontent.com/markmoxon/elite-beebasm/ma...

[+] aidenn0|5 years ago|reply
1.5 MB would take about 5 hours to load from cassette on the micro...
[+] IncRnd|5 years ago|reply
Indeed! This is very well documented, not necessarily by the comments per line but the explanatory information. It's a shame that most people nowadays write self-documenting code.
[+] firecall|5 years ago|reply
Can anyone tell from the source code what it took to become Elite?

I got this game when it came out in the UK! I was 11 at the time!

I never got beyond Deadly from memory.

But boy did I sink hours into this game on our BBC model B with those cool analogue joysticks you dont see any more!

[+] LeoPanthera|5 years ago|reply
I believe that I have the longest-lived still-played savegame, of possibly any game. I started playing Elite in 1985, and my savegame has survived to this day. I transferred it from the original 5¼" disk to a disk image a few years ago, and occasionally still load it up under emulation.

I am indeed rated "Elite", although I was very disappointed to learn that only kills are tracked to determine this rating. I had hoped that trading, distance travelled, or galaxies jumped would help as well, but it doesn't.

[+] duncanawoods|5 years ago|reply
A lot of vipers died to make me Elite. Its one of my proudest achievements but in truth, I sat outside a space-station and leant a book on one of the buttons of the analogue joystick!
[+] DrBazza|5 years ago|reply
Lots of kills. I even sent off to Acornsoft and received a badge through the post.

Or, there was the hack where you could just rewrite the save file which was published in The Micro User.

You could even tweak the missiles, power of the laser and a few other bits IIRC.

[+] Theodores|5 years ago|reply
It took Braben and Bell just over two years to write Elite. I imagine it would take me a lot longer than two years to document their code, putting it in a website as pleasing as this one.

When Elite was new it was good enough to spend two years playing it!

Plenty did.

Out of those players not many got as far as becoming Elite and not many did missions or anything else that got you anywhere near completing the game.

Then there were those that actually bothered to look at the code and hack the game or learn from the programming techniques. You would need to get a long way playing the game before taking it apart.

This 'let's take it apart' idea didn't come to the minds of most of the experienced players. So it was a tiny minority into hacking the game.

The thing I like about computer games is this ratio between those that write the game and those that waste their lives playing it! It is like real world sports where you have the eleven players on the team on the pitch, then the grandstands filled with thousands watching.

Games wouldn't work if everyone was so inclined to hack it and write their own. You have got to have audience, those people happy to spend all their free time playing the game rather than wanting to be the next developer.

[+] FpUser|5 years ago|reply
OMG. I want to go back in time when things were pure and clear. Thanks for sharing. That is what my code looked like in the beginning of time but for a different comp.

Sheds a tear and pours himself a drink.

[+] Tepix|5 years ago|reply
Elite was written by Ian Bell and David Braben.

Ian Bell has a homepage with nice old Elite stuff free to download at http://www.iancgbell.clara.net/

A chap called Christian Pinder reverse engineered the BBC version of Elite (written in Assembly) and faithfully reimplemented it as documented C code. It was called "Elite: The New Kind" and was even ported to IRIX!

Unfortunately he was then contacted by David Braben and asked to no longer spread this version.

[+] 082349872349872|5 years ago|reply
TIL about the pagoshamanic reclamation of divine colour.

(currently a ἅπαξ λεγόμενον)

[+] JdeBP|5 years ago|reply
If you want to see Elite running on a second processor, see https://www.youtube.com/watch?v=mP7fiaync5E . And that's where that video starts out. It later gets to the point of showing GEM, running on top of DR-DOS, on a 80286, emulated by a Rasberry Pi, connected via the Tube to a BBC Master doing all of the I/O.
[+] fit2rule|5 years ago|reply
Elite was one of those games that got ported to the other machines.

Except, it wasn't ported to the Oric Atmos, which wasn't considered worth the effort.

Until a few years ago, that is, when Chema and his crew made a pretty good version for the Oric:

https://defence-force.org/index.php?page=games&game=1337

Old computers never die - their users do!

[+] forinti|5 years ago|reply
Wow, that's an excellent port; the Oric only has a 1MHz 6502.
[+] mrlonglong|5 years ago|reply
Wow, this is like gold dust. I've had a look but I don't seem to know this also has code to handle the 6502 tube co processor?
[+] MarkMoxon|5 years ago|reply
I’m planning to analyse the 6502 second processor version next - the source files are on Ian Bell’s site, so hopefully I’ll be able to give it the same lavish treatment. I really want to know how the code for the “full” docking computer works... the tape one is just an instant-dock, which isn’t half as interesting.
[+] LeoPanthera|5 years ago|reply
No, this is not the "tube" version of Elite. The tube version was incredibly rare, and held a near mythical existence back in the 80s and 90s. It's much easier to find today.
[+] bsdooby|5 years ago|reply
I could not find the famous Fibonacci sequence method mentioned to seed the planetary systems generator (at first glance); might look harder...maybe someone spotted it in the code or is willing to explain the method?
[+] Scapeghost|5 years ago|reply
When I was a kid, discovering "complicated" games like Elite in my uncle's library was almost like digging into the adults' secret porn stash, things you weren't supposed to know about :)
[+] cptnapalm|5 years ago|reply
Christian Pinder translated the assembly into C; that version is called Elite: New Kind. Unfortunately, it also requires an older version of Allegro (3, I think).
[+] freediver|5 years ago|reply
What an aamzing work of art, mad props to Bell and Braben.
[+] DrBazza|5 years ago|reply
I can remember spending, many, many hours looking for non-existent space dredges (or whatever they were called), that was mentioned in the marketing blurb.
[+] JasonBlack555|5 years ago|reply
I had so much fun with this game and it's great that people still talk about it 36 years later !
[+] NCG_Mike|5 years ago|reply
Right On Commander!
[+] arde|5 years ago|reply
Get your iron ass over to Errius.