Documented source code for Elite on the NES
github.com
github.com
Looking at the source github, it appears I misremembered, or likely didn't even understand what Braben was saying. elite-source-bank-7.asm has a comment saying, "Update the NMI timer, which we can use in place of hardware timers (which the NES does not support)". It looks like they somehow implemented their own real time (ish) clock by counting non-maskable interrupts.
The earliest revisions of the NES CPU do remnants of a buggy and disabled programmable interval timer on the die: https://www.nesdev.org/wiki/RP2A03_Programmable_Interval_Tim.... This was fully removed in later revisions. Perhaps this was enabled on a dev kit or something — relying on functionality that never worked on consumer units certainly would have led to Nintendo rejecting it during testing.
But even if released consoles had a PIT, it would only be very useful for sub-frame measurements for e.g. timing precise raster effects. Counting NMIs would be by far the most sensible way to measure real time. The NMI fires at the start of each video frame, which is extremely consistent at 60.0988 Hz, and not affected by in-game processing (i.e. game engine may run at a slower/variable framerate if it can’t keep up, but nothing that happens CPU-side can affect the timing of the video signal in any way; the rendering process runs off a fixed timer in hardware).
(FWIW, the audio hardware also has the ability to generate timer interrupts, and many expansion chips have scanline counters that can generate timer interrupts if you need fine-grained synchronization to the rendering process. There’s no shortage of ways to measure time on the NES if you need it).
Wouldn’t that be different on a PAL NES? The parent mentioned that they wanted "to keep track of real time [...] regardless of the frame rate, which varied".
Instead there's an NMI counter (nmiTimer) that counts every VBlank and wraps around every 50 ticks, so it's effectively a seconds counter on the 50Hz PAL version. And in the NMI handler, they keep a running total of cycles spent so they know when VBlank has finished and can stop sending data to the PPU, picking up where they left off in the next VBlank (see the NMI routine in bank 7).
They also use sprite 0 collision detection to flag when the screen redraw has reached the icon bar, so it can force the PPU to nametable and pattern table 0 (as the icon bar's tiles are only in table 0, with table 1 being used for the vector graphics). This is not unlike the original BBC Micro version's split-screen mode, just without any hardware timers (instead, the whole source is littered with macros that check the collision flag - not very elegant, but it works).
Having hardware timers would have made things a lot easier!
What a fun era of development.
When they were trying to get approval for Nintendo for some game, it turned out that one specific version of the USA NES wouldn't work, or the game was making the system overheat (I don't remember exactly). Andrew told me that they had to fly all the way to the Nintendo's HQ to deal with this since they were on a tight window to release. It also turned out that there were fewer than a hundred of that specific version of the NES in circulation.
Ah, it was a bit different. I found the note in my (unpublished) book:
Tests for games were not exclusive to gameplay either. Games had to be tested in each possible NES console they would be played on. Beam Software’s Andrew Davie recalls flying to Nintendo’s offices in Washington, in response to the game “The Three Stooges” causing problems on a NES system that they were testing it on. He recalls there being “something like 23 variations of the machine, with different chip manufacturers, etc.” that the game had to be tested on to pass Nintendo’s tests. Once the problem was diagnosed (the way Davie had programmed the game, due to the lack of official documentation, made the NES run too hot, which caused flickering sprites throughout the game; instead of writing the sprite data into RAM as the official documentation called for, Davie wrote the data every two seconds), the game was fixed and accepted for release; after this, the problematic NES console was removed from Nintendo’s testing line-up, with Davie being told that only around 5 consoles with that combination of chips was in circulation in the entire USA."The software development was chaotic. The chaos provided a lot of freedom and opportunity but caused some serious problems too."
Love this insight.
... but then you realised that anyone bright enough to work it out was unlikely to have accepted the promise or the job? :)
> I still don't understand.
Mr Braben's company Frontier did not own the Elite franchise.
You were amongst many deceived e.g. "Elite: Dangerous Role Playing Game" [1]. This company ceased its false claim to own the Elite franchise some years back.
Another problem facing Mr Braben's attempts to get a publisher for a further space game under his name was his reputation in the industry. His previous attempt, "Frontier: First Encounters", was famously characterised by PC Zone magazine as a bow-wrapped turd [2]. After Mr Braben's repeated patches, a recall, a reissue and another recall, the game's long suffering publisher gave up and sued him for damages of £722,834.63 plus interest [3].
[1] Elite: Dangerous Role Playing Game (ED RPG) is the subject of an intellectual property dispute https://web.archive.org/web/20170303095150/https://www.kicks...
[2] Frontier Worst Encounters, PC Zone https://web.archive.org/web/20231007232510/http://www.eliteh...
[3] Gametek V Braben https://www.pdf-archive.com/2017/10/20/gametek-v-braben-writ...
Seeing the continuity of game elements from the 1984 version (which I also sunk hours into) is weirdly moving. Seeing the same game objects like the ships and especially the Coriolis station transformed from vector graphics on a 16K memory-mapped screen (SOTA at the time!) to fully rendered 3D at 4K/60fps was more of an emotional ride for me than I expected. Finally experiencing the detailed Coriolis interior complete with advertising hoardings, plant and docking gear moistened my eyes somewhat I don't mind admitting.
Despite current difficulties the game is a precious institution, I really hope it sticks around in some form or other!
I wonder why space simulators and games always end up being so problematic. Elite Dangerous just seems to be going nowhere. Star Citizen is apparently a perpetual beta. Even KSP2 turned out to be a disappointment. Sigh.
Feature creep.
Everyone wants a space simulator.... then it must have atmospheric behaviour, and cities.... and well, we should be able to walk around on the ground... and shoot things.... make it a first person shooter, oh, and lots of aliens, make it a diplomacy simulator too.
And on it goes.
Solution: Never let such a designer run a project themselves, and instead pair them with a practical and empowered project manager.
I think there's a case to be made for galaxy-wide sandbox gameplay. The truth is that space is empty and it's up to us humans to make it not so. The Subnautica-like basebuilding found No Man's Sky is a major source of fun in that game. It's what makes the galaxy feel alive and dynamic. Elite Dangerous lets you land on planets but there's nothing to do but admire the scenery and take screenshots when you do.
Kerbal Space Program is a single player game which also has mostly empty worlds but it's also a sandbox game. I can build and launch a space station piece by piece. I can later use that space station as an orbital refueling station to reach more difficult planets. I can land on nearby planets and set up a mining operation to refuel the station for the benefit of future space missions. It goes on and on... KSP2 was disappointing not because it didn't have FPS or diplomacy gameplay but because it launched without these features of the original as well as massive peformance regressions.
There's a functionally infinite galaxy to explore but no player run economy that lets us colonize far away systems with player or squadron built space stations. Our reward for exploration is sweet screenshots and our names on the discovery. That's awesome and I spent a lot of time doing it but it could have been so much more. I used to play with one of the biggest squadrons in the game and at the end of the day it was nothing but grinding resources or little tasks to increase numbers so the economy simulator didn't decide we lost territory or something. Would've been a lot more fun if groups could build strongholds deep in the galaxy and you had to literally attack them to take them out instead of grinding missions.
I've listened in on discussions of relative merits of ship builds for the current anti-xeno initiative and they are deep and far-ranging.
I've watched combat streams from players who've practiced for literally a year to master the intricacies of no-flight-assist piloting.
There's a lot more to the game than "space trucking". After immersing myself over a couple of weeks in the various aspects and sub-communities it's amazing to me that people fall for the facile "mile-wide-inch-deep" truism. It's that critique that's shallow and uninformed, to my mind.
> I've watched combat streams from players who've practiced for literally a year to master the intricacies of no-flight-assist piloting.
We agree on these points. The ships and the piloting are the game's strongest qualities. They're what I miss most.
> After immersing myself over a couple of weeks in the various aspects and sub-communities it's amazing to me that people fall for the facile "mile-wide-inch-deep" truism.
The community of players is indeed awesome. Playing with others nearly makes up for all the deficiencies of the game. It makes everything that much more fun and more emergent. The sheer existence of groups like the fuel rats is something this game deserves praise for.
Doesn't make the game itself any less problematic. The problems still exist, they just don't seem so big because you're playing with friends.
> I've listened in on planning sessions for the "rather basic" "tally of points" (BGS) system, and it's far from basic, there's plenty of strategy and tactics involved and political thinking and negotiations with other player groupings are part of it - it's more like 3D Risk than what you describe.
Nah. I've played games like Risk too and they were far more interesting than this grind. Maybe it's "interesting" to the top squadron guys but I don't see how. They're essentially maintaining territory: have everyone in the squadron do a ton of little tasks so everything will stay more or less the same. Pretty much no impact on anything but which factions control which stations which doesn't mean anything anyway. It might sound fun to sign up for the empire princess faction and imagine you're gonna help her take over the galaxy but that quickly goes away when you join a community and discover they're in maintenance mode, only occasionally gobbling up territory when some other faction gets sick of the game and stops playing or something.
Compare that to eve online and its actual player run world and it's like night and day.
> There's a lot more to the game than "space trucking".
Maybe if you've already done everything else and have meta ships you can battle other players or thargoids with. Until then it's an endless grind. Buy at station, sell at another, repeat until number is big enough to buy new ship and modules. Land on planet, shoot and pick up rocks containing common elements until their quantity is big enough to upgrade existing ships and modules.
Space trucking is the most polite way I can describe this menial busy work.
Some thoughts I wrote 9 years ago: https://hypertexthero.com/elite-dangerous-education/
The Odyssey expansion is fun, too, and I hope they add EVA space walks and 0-G missions at some point!
It was done by Christian Pinder: https://www.christianpinder.com/games/
People might also want to check out Ian Bell's Elite homepage, which has a number of the original versions:
The core of the 1991 NES version (around 30% of the 128K ROM) is essentially the 1986 BBC Master version, which itself is a development of the original BBC Micro version from 1984. The Commodore 64 and Apple II versions are also cut from the same cloth (and they were developed on a BBC Micro, too).
Most of the code in banks 0, 1 and 2 is directly copied from the original BBC version, with a bit more in bank 7. There are new graphics, sound and controller routines bolted on the front, but the beating heart is still the Beeb version...
(He liked the 32-bit Archimedes port the best overall.)
(I think)
Probotector is Contra @50Hz with all humans replaced by robots, but still lots of firearms and violence.
Aw, blush :)
- Chris Jordan, publisher of Arch Elite.
My greatest published achievements technically would have to be fitting BBC Cassette "Elite" into 32K of RAM including the screen, and later the Nintendo Entertainment System conversion of "Elite" that used a character mapped display and a single NES controller. The NES is my favourite published conversion and was not thought technically feasible until we'd done it.
See http://www.elitehomepage.org/archive/b5081501.htm for the full interviewI interpret this as meaning his favourite version is the BBC Micro cassette version, while his favourite conversion is the NES one. But I'm a BBC fanboy, so that might just be me being hopeful. :-)
favourite /published/ conversion :)
SEI
INC $C006
JMP BEGIN
Then it goes into a lot of detail about how it does this to save space, but it seems to me that the only reason the JMP is even needed is because of the instruction pipeline, which could be flushed with just a NOP. So here's my 2 byte optimisation to this code: SEI
INC $FFFD ; use the C0 in the instruction vector instead
NOPIt does also make sense to a human -- execution begins in bank 7, so jump to bank 7.
Side note: on Game Boy the entry point is in ROM0, a fixed bank (at least on the common MBCs), so you don't have this problem in the first place.
There are quite a few remnants of code in the NES version that do nothing - I guess with 128K of ROM, the authors didn't need to go hunting for every single optimisation, unlike the BBC Micro version...
Seriously though any project of size almost had to involve large amounts of code written or printed on paper. Lots and lots of paper.
Having said all this, the relative simplicity of these architectures is really refreshing compared to embedded work on modern systems. There's something to be said for being able to roughly keep track of the whole system state in your head.
0: http://www.bitsavers.org/components/hitachi/_dataBooks/U24_H...
1: http://www.bitsavers.org/components/motorola/6800/exorciser/...
Overall though, assembly programming is much like any high level language: you organize your code into functions and blocks etc. Just writing one super long wall of code with a rat’s nest of jumps throughout is asking for serious trouble.
Braben et al didn't want to weaken the copyright I guess since they were doing Elite 4/Elite: Dangerous.
Much generously documented by Ian Bell e.g.
David Braben sues Ian Bell for libel https://groups.google.com/g/uk.legal/c/ZmgmhpuitXQ
David Braben sues EMAP for copyright infringement https://web.archive.org/web/20160328014216/http://www.eliteh...
David Braben threatens the Elite Home Page https://web.archive.org/web/20230824005005/http://www.iancgb...
There's a full list of differences between the PAL and NTSC versions here:
https://github.com/markmoxon/nes-elite-beebasm/tree/main#dif...
At the time, no emulators supported emulating the PAL NES.