6 ms·
Documented source code for Elite on the NES
- raytopia 3y ago18305 lines of assembly for bank 0... I have no clue how you'd keep that in your head.
- LeoPanthera 3y agoBack when I was writing 6502, you didn't keep it all in your head, you kept it in reams of tractor-fed dot matrix paper, usually with a lot of scribbled pencil notes and corrections.
- yetanotherloss 3y agoWe were out better selves back then. Seriously though any project of size almost had to involve large amounts of code written or printed on paper. Lots and lots of paper.
- anthk 3y agoWell, it depends. On some environments such as Lucas Arts they used Unix based OSes to develop SCUMM. With grep and such, editing and porting the engine could have been a breeze.
- yetanotherloss 3y agoHalf joking, by the time of the NES port he would have certainly had many available options for all that , but even with access to a timesharing system with real storage and all that in the earlier 80s having at least sections on paper for easy reference against printed manuals was handy.
- PUSH_AX 3y agoCan anyone explain this to a modern engineer? Why would you need to hold this in your head?
- imjonse 3y agoPossibly lack of tools that make code search/navigation easy.
- ajxs 3y agoI've done a bit of embedded development for 8-bit machines in the modern era, and I sincerely tip my hat to the engineers who were doing it in the 80s. Even with the best tooling available, you'd have needed an enormous amount of organisation and discipline to keep track of your code. I was doing some research about the assemblers available for the Hitachi 6303[0]/Motorola 6800[1] in the early 80s, and I'm amazed by what people accomplished with the limitations of these tools. Just to name one thing, the two assemblers I've linked to only supported SIX character labels, and no local-only labels within subroutines either. To compare, in my own work I was limiting myself to FORTY characters for the sake of being descriptive. 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_Hitachi_6301_6801_Assembler_Text_Editor_Users_Manual.pdf http://www.bitsavers.org/components/hitachi/_dataBooks/U24_H... 1: http://www.bitsavers.org/components/motorola/6800/exorciser/M68MASR_Macro_Assemblers_Reference_6800_6801_6805_6809_Sep1979.pdf http://www.bitsavers.org/components/motorola/6800/exorciser/...
- chongli 3y agoThis code is extremely well organized and documented. I don’t know what the original code would have looked like in terms of documentation, but I imagine there was a lot of it printed on paper with handwritten notes and stuff. 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.
- LeoPanthera 3y agoIan Bell, author of Elite, claimed that the NES version was his personal favorite 8-bit version of Elite. (He liked the 32-bit Archimedes port the best overall.)
- pipes 3y agoBut they removed trading slaves and narcotics! :) (I think)
- MarkMoxon 3y agoIndeed - "slaves" got changed to "robot slaves", while "narcotics" became "rare species" and "liquor/wines" became "beverages". You can still trade firearms, though, so its not entirely squeaky clean...
- toast0 3y agoNintendo would have had a hell of a time censoring firearms from videogames. Nudity, slavery, narcotics, and alcohol are easy; violence and firearms form the basis of many/most popular video games. Probotector is Contra @50Hz with all humans replaced by robots, but still lots of firearms and violence.
- pipes 3y agoI never understood why UK and Europe got probotector instead of contra, maybe it was due to Germany's very strict game censorship?
- toast0 3y agoYeah, that's my guess. Violence towards humans in video games was often prohibited in Germany, so drop it for the whole region, because two releases is hard.
- dabeeeenster 3y agoArch Elite is the pinnacle for sure.
- Apocryphon 3y agoIn contrast, here's the source code for Oolite, the open source Elite clone written in Objective-C: https://github.com/OoliteProject/oolite https://github.com/OoliteProject/oolite https://oolite.space https://oolite.space https://news.ycombinator.com/item?id=7894145 https://news.ycombinator.com/item?id=7894145
- BrissyCoder 3y agoI played it on the C64 as an 8 year old. 30 years later I don't understand this code.
- Dwedit 3y agoMaybe someone can finally port it to run on NTSC consoles. Would still take a lot of scanlines to cut out though.
- djmips 3y agoMaybe try this NTSC version from Ian Bell's website? http://www.iancgbell.clara.net/elite/nes/ http://www.iancgbell.clara.net/elite/nes/
- MarkMoxon 3y agoAlas, the NTSC version doesn't actually work on NTSC consoles. The NMI timings have been changed to work with some (but not all) emulators in NTSC mode, but it isn't a full NTSC conversion, it's an NTSC emulation (at least, that's what the authors call it in that version's scroll text). There's a full list of differences between the PAL and NTSC versions here: https://github.com/markmoxon/nes-elite-beebasm/tree/main#differences-between-the-variants https://github.com/markmoxon/nes-elite-beebasm/tree/main#dif...
- Dwedit 3y ago"NTSC Emulation" Elite was intended to be used with Nesticle only, as there was a "NES Timing" dialog where you could change the number of scanlines during vblank time. At the time, no emulators supported emulating the PAL NES.
- abainbridge 3y agoMany years ago, when I worked at Frontier, David Braben told me a fun anecdote about NES Elite. He said they initially got the game working using the hardware timer in the NES to keep track of real time so that the in-game physics progressed at a constant rate regardless of the frame rate, which varied. When they submitted the game to Nintendo for pre-release checks, Nintendo said they couldn't use the hardware timer because a few of the earliest NESs didn't have working ones. So Bell/Braben had to make the functions in the game maintain their own estimate of how many clock cycles they each took that frame. At the end of the frame they were all added up and used as an estimate for how much real time had elapsed. 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.
- NobodyNada 3y agoYes, I bet you’re misremembering something — no released NES has a “hardware timer”, in any revision. 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_Timer 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).
- anthk 3y agoNot libre. Too bad, if I were the Elite creator I'd put all the game ports under a libre license. Anyway, nowadays you can play Oolite on a cheap netbook and have the exact same fun, if not more due to the huge addon list for it.
- lstodd 3y agoThat's Braben being a dick about copyright. Bell on the other hand was a nice guy and released most that he himself wrote.
- mattlondon 3y agoThere is quite a lot of history around the releases that goes back several decades. Braben et al didn't want to weaken the copyright I guess since they were doing Elite 4/Elite: Dangerous.
- chrisjj 3y ago> There is quite a lot of history around the releases that goes back several decades. Much generously documented by Ian Bell e.g. David Braben sues Ian Bell for libel https://groups.google.com/g/uk.legal/c/ZmgmhpuitXQ https://groups.google.com/g/uk.legal/c/ZmgmhpuitXQ David Braben sues EMAP for copyright infringement https://web.archive.org/web/20160328014216/http://www.elitehomepage.org/archive/a/b5082800.png https://web.archive.org/web/20160328014216/http://www.eliteh... David Braben threatens the Elite Home Page https://web.archive.org/web/20230824005005/http://www.iancgbell.clara.net/elite/cix/index.htm https://web.archive.org/web/20230824005005/http://www.iancgb...
- ralferoo 3y agoI like how the start of every bank contains a bank switch shim like this: 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 NOP
- qwery 3y ago> it seems to me that the only reason the JMP is even needed is because of the instruction pipeline It 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.
- MarkMoxon 3y agoAlso, the JMP BEGIN approach will still work even if you move the BEGIN routine elsewhere in bank 7, so presumably it's done this way so things won't break during development when you're still trying to work out which bit of code goes where. 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...
- ttctciyf 3y agoI embarked on Elite: Dangerous, the successor game, recently. It has its share of problems, granted, but nonetheless is a pretty amazing experience. 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!
- matheusmoreira 3y agoI really enjoyed Elite Dangerous as well. Haven't played it since they dropped consoles. I really miss flying those ships with friends despite all the grinding and shallowness. Manually docking a spacecraft to the sound of Blue Danube is always a relaxing experience. 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.
- xioxox 3y agoI enjoyed X3 and X4 quite a lot. However, I didn't like the UI and lack of jump drive in X4. It also has its share of bugs and the universe can get slow when the game progresses. It's still a very engrossing game, however.
- matheusmoreira 3y agoThanks for the recommendation. I was under the impression the X games were strategy games for some reason. I'll definitely check it out.
- NikkiA 3y ago> 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.
- vidarh 3y agoThere's also Elite - The New Kind, a C version that is mostly faithful to the original: https://github.com/fesh0r/newkind https://github.com/fesh0r/newkind It was done by Christian Pinder: https://www.christianpinder.com/games/ 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: http://www.ianbellelite.com/ http://www.ianbellelite.com/
- MarkMoxon 3y agoA shout-out is definitely due to Ian Bell and his website. This is where you can find the original source code for the BBC Micro version. Those original disks form the basis for all my Elite commentaries, including the NES project we're talking about here. 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...
- throaiej21834 3y ago[dead]
- danielovichdk 3y agoAll source code should be documented as this.