Fully documented source code for Elite on the BBC Micro
bbcelite.com
bbcelite.com
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 :-)
Near the back there was a two page table containing a dense opcode map (the byte values) of the 6502, its mnemonics, and a tiny notation hinting what they might do.
I've just looked it up. It's the "old" book of that name, not the "new" one. See pages 502-503 of this scan: http://bbc.nvg.org/doc/BBCUserGuide-1.00.pdf Poorly scanned, but I recognise the table.
I stared at that table, intrigued, not really knowing what it was, until I started guessing what the mnemonics stood for. Gradually it made sense - after months!
Eventually I was able to guess enough to write 6502 inside BBC Basic, and some time after that I was able to disassemble binaries in 6502 and Z80 (I had a Z80 second processor), and eventually graduated to hacking games to modify them, give them infinite lives, change the keys, things like that. No doubt there was the occasional bit of assembly language in magazine listings to provide a guide to the syntax.
I don't remember having a 6502 disassembler, but I don't remember writing one either. I did receive a lot of games and utilities so I might have received a disassembler too. Hacking games that don't want to be hacked required a fair amount of dedication though, so I might have written one among the other tools needed for hacking; I don't remember.
My favourite BBC Micro hacks were:
- Poking the ULA with a non-standard palette bit pattern, allowing me to produce a 7-colour mode in high resolution (contradicting the received wisdom about what was possible to pack into the pixel bytes), and similar colour graphics quality to a ZX Spectrum. I ported a game from the Spectrum using this technique, but never published it.
- Pixel-smooth vertical scrolling by poking the CRTC on timed interrupts to modify the character height dynamically, so as to squash a row at the top and expand a row at the bottom to shift the image with pixel precision (contradicting the received wisdom that the CRTC could only scroll character cells).
- "Super mode 7", running the Teletext mode with the pixel clock set to double frequency like in mode 0. This caused the Teletext character generator to process 80 characters per line instead of 40. But instead of showing 80 characters, it showed every alternate character, while still updating the colours or other attributes from the hidden characters. This allowed clean coloured text to be displayed without gaps between different colours as Teletext normally required. Proper syntax highlighting :-)
- Mixing graphics and Teletext on different rows using timed interrupts, so as to render something like a text editor with pixel graphics in between blocks of text. This is a variation of the technique used by Elite to show a colourful status area with a higher-resolution main 3d area.
- Modulating the volume on the sound channel at high speed, to turn the sound chip into a DAC, and therefore any audio waveform we wanted.
I miss those fun days, where we could prod and poke at things and all sorts of useful magic happened.
They included circuit diagrams, data sheets for individual chips, just about every detail of how the system worked.
You'd still have to figure out a lot just to understand those reference manuals, and guess a lot, especially with no internet and no good library (my local library did not have books like this!).
I only had a very small number of books. But I did have the Advanced Guide. Having so much detail available in reference manuals was great for a young mind!
Also when I was like 7-8 (edit: previously wrote 10) I was given the Ladybird book for young children: "The Computer (How It Works)".[1] A tiny book. In retrospect I learned a lot of great grounding from that book even though I hadn't yet seen an actual computer. I guess it gave me an appreciation for the video games I played with on show in the supermarket, and the pictures of minicomputers and microcomputers I saw in hand-me-down computer magazines.
[1] https://www.amazon.co.uk/Computer-Ladybird-How-Works/dp/0721...
I'm occasionally asked, by people who find learning this stuff frustrating, where did I learn about logic circuits, where did I learn about assembly, where did I learn about RAM and ROM, etc. and for a long time I couldn't put my finger on it. I think it started with being exposed to that book and some early computer magazines at a young age, without even seeing or touching a real machine for a year or so afterwards.
Edit: wrongola! Turns out, the last machine I worked with that had a real manual was either a MicroVAX, or a PDP-11, both of which I used in college. Writing ASM for the PDP-11 was great! I just wish I was better at program then, lol. :)
http://users.telenet.be/kim1-6502/6502/2ksa/2ksa.html
> "Cover: Schematics for a 5V, 3A regulated power supply and a 1K x 8 read/write memory block. The power supply and three such memory blocks can be added to the basic KIM-l microcomputer to provide the 4K RAM required by this assembler. Parts are available from Jameco Electronics."
https://www.youtube.com/user/MrCarlsonsLab https://www.youtube.com/user/gradyhillhouse
Also for history students Mike Duncans Revolutions is amazing
For example, the most recent demo led by VectorEyes, called Evil Influences, breaks new ground in BBC Micro video chip chicanery: https://bitshifters.github.io/posts/prods/bs-evil-influences...
Direct link to the video: https://www.youtube.com/watch?v=HvjhKY67fPI
If only there had been an internet then, rather than just me with my books and a few years to spare :-) I guess most of us were like that at the time.
I see the 6845 still has surprises yet. Now you've made me read the Wikipedia article on it, and I learned something new, that it can be tricked into reloading the display address in the middle of a frame. If only I'd figured that out that back in the day, that would have been very handy!
One of the students in the upper year levels gave a friend and I some POKE style commands that could be used to remotely reset the fileserver. We got immense joy out of resetting the fileserver when the teacher had his back turned away from us since it would prevent disk access for the entire class.
We would then chuckle to ourselves quietly while all the other students complained to the teacher that they couldn't load/save files over the network for a minute or two. The poor teacher became more and more exasperated, but never understood or figured out what was going on. This was very funny to my friend and I, being the immature 13 year olds that we were.
We had a classroom like yours, with BBC Micros and special BBC fileserver computer of some kind, with the important school stuff on it.
My fun command was a one-liner that repeatedly remote-PEEKed the server's keyboard buffer memory and displayed it on one of the classroom computers.
One day, when the teacher went over to the special server corner to type in the server password, I quickly entered this one-liner into a computer in the main area, and lo as teacher typed the password thinking it was all very private and special, it appeared key by key on my screen. Of course all the children were watching my screen, "hey watch this...".
Yes, the folly of youth :-)
That got me permanently banned from the computer room. I didn't expect that, I thought we'd all laugh it off and tell me not to do it again. Ironically, knowing more about computers than anyone else in the school, I wasn't allowed to study computers at school or use them.
Still won a programming competition there anyway, for making a pretty demo to tell a story :-)
The other hack which possibly contributed was writing a kind of "broadcast NOTIFY" that sent your keystrokes to all of the other machines on the network, allowing the user to remote control all the things. The service manual I just found online says that *NOTIFY is a dangerous command which the operator might want to remove - but in fact there was a system call which did the same thing and I used that instead.
I built a full-on remote hacking utility that got to the point where it would download the remote victim's RAM, upload the infamous laugh sound, play it, then restore the RAM so the victim was - usually - back to before they got freaked out.
A small group of us built a multi-screen text scrolling and image display sequencing tool for the various school open days. I still recall the nervous look on the teacher's face as we deconstructed the computer lab to get all the Microvitec Cub's lined up! Those were fun times.
http://chrisacorns.computinghistory.org.uk/Network/Pics/Acor...
Or if it was the early-mid '80s then an Acorn System 4 or 5 fileserver:
http://chrisacorns.computinghistory.org.uk/Computers/System5...
Heh, I still have mine.
https://www.dataserve-retro.co.uk/contents/en-uk/p92.html
Yeah, assembler killed my early interest too. If only the Beeb’d shipped with Logo instead of BASIC. That I (now) get.
Though for epic covers this one still can’t be beat:
https://www.amazon.co.uk/Zx81-Basic-Programming-Sinclair/dp/...
Elite… ahh, memories of misspent 6th-year biology. (Beebs were standard fixtures in 80s UK schools.)
Voltmace joysticks FTW, amirite
How frustrating that even today that is very hard for quite a few environments. I am working on something that requires a very smooth horizontal scroll of a large canvas in the browser. So far jagged edges are my lot, most tricks only work in a small subset of the cases.
I use this to asses:
but this doesn't give me a feeling that all browsers in common use will do "buttery smooth" any time soon:
[1] https://www.youtube.com/playlist?list=PLowKtXNTBypFbtuVMUVXN...
Glad to see I wasn't the only one (I mean that in a nice way!)
I tried 6502 on the beeb but really found it a slog.
I recommend everyone should read some well optimised code occasionally, and figure out how it works, to see how it's done.
I didn't know much in the way of assembler techniques before reading the Elite code. For example I didn't even know how to do things like multiply or square root, or draw lines efficiently. That's where I learned those things.
It did take quite a lot of studying the printout to get it. So many "aha! that's how they do it" moments.
I do remember seeing this in 68K.
Lots more info here:
https://www.bbcelite.com/explore/articles/deep_dive_pitching...
It is really nice to be able to say you know what every byte in your computer is for.
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.
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.
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.
The ZX spectrum Next looks amazing. Then there is the 8-bit guy's Commander X-16 which is being built by him and many other volunteers and should be ready for Kickstarter soon. Also there is the Mega65 project which is a very similar project to the Commander X16. Also there is the Color Maximite 2, which seems to be a screaming fast BASIC computer not meant to be fully compatible with any machine that I'm aware of. Some of these are implemented on FPGA and others on actual chips and some have the keyboard/computer integrated, while others do not. Either way, I'm really excited to finally be able to buy one of these fun old machines where you can fully understand the full system and easily make simple games.
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.
Elite on the Beeb was the game that started me coding, all those years ago, and now I work in R&D at Apple.
Same for me! Not that I could read the code, but my desire to try to cheat in the game led me to learning BASIC and then a career in software engineering.
Personally I find Elite Dangerous to be tremendous fun, and extremely good value for money considering how little I paid for it and how many hours of gameplay I got out of it. Having played the original, I am looking forward to the updates!
One of the reviews of the company (glassdoor?) mentions the mess of the codebase, and I can imagine that contributes to the slow releases, but I guess that's true of any legacy giant codebase; having worked somewhere where the code was 20+ years old and a few key architects were the only ones who knew/understood how anything worked, they became the bottleneck to development whilst the rest of the team were under constant pressure to produce output whilst being devoid of understanding of the code. With the "gatekeepers of knowledge" being the only ones that could help the rest of the team, they were too busy to educate others as they were producing 80% of the output to keep the business operating; I wondered from an outside perspective if this was what happens at Frontier a bit?
Simcity 2013 and Zoo Tycoon 2013 were such disappointments so I'm glad there is a trend along with cities skylines to revive classics in a way that doesn't stomp on what made the originals great.
Using CORBA in their COBRA system would be very witty.
https://sourceforge.net/projects/frontvm/
I put every version I could find there, it starts as a specialised emulator to run frontier based on the ST version, then it became a 68000 to i386 asm/C and then added in OpenGL rendering.
It’s pretty cool
http://www.elitehomepage.org/faq.htm#A3
This is what analysing the source made me feel:
"Every little step forward, I felt like I was unpicking a bit more of the story of two young developers creating a modern-day masterpiece; if you squint carefully, you can almost sense where the whole starts to become greater than the sum of the parts. Elite is the coding equivalent of 'A Day in the Life', a mash-up between the Acorn world's very own Lennon and McCartney, with results that are just as seminal in their field. They say you should never meet your heroes, but grokking their source code... well, that's another matter altogether."
Quote from: https://www.bbcelite.com/about_site/about_this_project.html
The flight model is great, you get detected by your heat signature which depends on the power your ship is using. You can turn off subsystems (like shields) to reduce your heat signature so you can't be targeted, or dump all the heat into a piece of metal that you eject from your ship and shows up on enemy radar. Mining is great too, but overall there's no overarching progression target. In good game design progression should open up new experiences, here (after you collect enough money, which can be done in a few hours) every part of the game is accessible, and none of them lead to anything worthwhile. You just keep doing the same things with more expensive equipment.
Also you don't need a powerful machine to play the game, it's runs flawlessly on my laptop in 1080p (Fedora + Intel HD520).
https://www.theguardian.com/books/2003/oct/18/features.weeke...
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.
Now I'm curious. How many players who made it to Elite Elite are currently members of the anorak elite?
Elite was pretty addictive, and I have a weak spot for that kind of mechanism that apparently has only one way to resolve it.
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...
This is version 1.0, really. There’s an awful lot more to say about this game - it’s endlessly fascinating.
Interesting question: did you find any bugs just by reading?
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!
This isn't new knowledge. I remember reading about that goal and the number 6400 in a magazine, probably BBC Micro User.
Right on Commander!
Were there actually any generation ships?
Oh that Lenslok[1] was a massive pain in the arse!
[1] https://i.ebayimg.com/images/g/s4UAAOSwmTVfUWyM/s-l1600.jpg
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.
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.
https://www.bbcelite.com/tape/workspaces/workspace_t_per_cen...
Used here to calculate the current tier:
https://www.bbcelite.com/tape/status/subroutine_status.html
Elite is 6400 kills.
This website is such a tremendous piece of work!
(Site author here, incidentally.)
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.
Sheds a tear and pours himself a drink.
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.
(currently a ἅπαξ λεγόμενον)
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!
Elite was also available on the C64 running at 1Mhz on a 6510.
Still, they are all quite impressive.
I was still useless at the game.