Tuesday, April 07, 2009

Elite DS version 0.6

I've just cooked up a new release of Elite DS. This adds the music back in that I had to take out when my own GBA XM library proved too tricky/time consuming to port to the DS. I've updated the code so that it compiles with devkitARM r25 and the sound now uses devkitpro's default ARM7 core.

From a technical POV the changes aren't very interesting, but I'll waffle on about them anyway!

Prior to this release, I was using the DS's PSG sound system. This is the bleep-bleep-bleep square/triangle wave sound system that Nintendo has used in its handhelds since the dawn of time. I think it is pretty much unchanged since the original Gameboy ;-) The good thing about this "format" is that it is small - you can say "use this pitch", "play it!", "hold it!" in just a few bytes and the sound lasts ages. You just change the pitch after a given length of time to add new exciting effects. The bad part is that it sounds terrible! Also, the sound format is completely arbitrary/homegrown as you have to just poke registers with values to make the DS go BEEP.

Additional amusement creeps in as you have to poke the sound registers on the ARM7, but the sound events trigger on the ARM9. Like when you get shot or fire a laser. I used the inter-processor FIFO to pass the "bleep now dammit!" messages from the '9 to the '7. Most of the sounds were taken from running Elite under emulation in pocket beeb, capturing the sound values that were written to the BBC sound registers, converting them into the equivalent values for the DS registers and then using these values in Elite DS. They sound more or less like the original BBC sounds this way. This is not necessarily a good thing :-)

The new sound effects were easier to create. I used this simple (to use) sound generator. I spent a pleasant afternoon creating random sounds, some of which may be slightly above the "terrible" level. I forget where I stole the Elite music files from, I think they are nabbed from the NES version. Of course on the DS these all use the fantastic maxmod library. I wish this had been available years ago, it is very easy to use and works exceptionally well.

Ah, there was one random bug that had me scratching my head for a while - I used to use a bit of assembler to clear the screen. This sets all the ARM registers to zero and creates an unrolled loop to blit these zeroes to the video RAM. For some reason it caused crashes on hardware when I started using maxmod. The only thing I can think of is that somehow registers were getting clobbered that maxmod uses in an interrrupt, or vice versa. My fix was to replace that clear screen routine with a DMA fill. Speed is not an issue on the DS compared to the GBA :-) It's a bit cargo-culty but I was desperate and with that register-clobbering explanation I sort of convinced myself. Anyway, I've been playing 0.6 all afternoon and it hasn't shown any more crashes (of the game; there have been colisions between myself and a few Cobra Mk IIIs). Enjoy!


  1. Richard Brand12:06 am

    Thank you for your work on this. Long live Elite!

  2. OMG, you're the first that tries that. But why did you stick to the original Elite, the code for Frontier First Encounters is freely available on the web?

  3. Heh! If all that's needed is the source, where's your version of FFE? ;-)

    Clue: it is a bit trickier than that given the DS's crap amount of memory.

  4. Anonymous12:52 am

    You made my day... thanks for this!
    Question though: why remake when there are NES emulators (and a NES version of Elite) freely available?


Note: only a member of this blog may post a comment.