← Back to context

Comment by jordigh

18 days ago

The tech demo that really made me fall in love with Bad Apple was getting it to run on the NES.

https://somethingnerdy.com/downloads/

Here it is running from my Everdrive.

https://inversethought.com/jordi/video/badapple.mp4

Yes, with full audio. It's about one gigabyte of data. On a system where the typical game size is no more than a couple hundred kilobytes, and your CPU only has three 8-bit registers for you to do any calculation with.

Very cool. Having done a bit of NES dev I can imagine this wasn't super straightforward to make performant for the graphics, given you can typically only have a few sprites on a row before the NES starts to 'dissolve' them (not sure the term).

I wonder if it's using the background tile map for this instead of sprites, though that's also an impressive amount of graphics bandwidth.

> with full audio playback rate (44.2kHz)

The audio being so clear is also impressive, is that something that the card extends? IIRC the PCM channel on the NES isn't anywhere near that bitrate, and is also 8-bit sample size.

  • The channel can either play back delta-modulation samples from memory, or you can directly set the output as a 7 bit value.

    So by burning a lot of CPU cycles, you can keep up a perfectly good sample rate using the latter method.

  • The bitrate of the PCM is determined based on how quickly you can write a byte to the register. The fastest you could write general data is once every 6 cycles, which gives ~298 MHz of sample rate, so 44.2 kHz is easily doable if that's all you want to do with the CPU.

  • > I wonder if it's using the background tile map for this instead of sprites

    Yes, it's all background tiles being loaded continuously from the SD card. We created the tiles with a custom tile de-maker.