Pineapple NES Emulator

A C++ based emulator for the CPU of the Nintendo Entertainment System that ran on the Ricoh 2A03, with limited PPU capabilities.

forthebadge made-with-python forthebadge

pineapple-EMU is a test MOS 6502 processor emulator for NES ROMs.

We wanted to play Mario on the NES but couldn’t, so we wrote an emulator for the NES on our own – or tried to, anyway. This is an abridged version of OneLoneCoder’s tutorial on a complete NES emulation, implemented and tested for the MOS 6502 chip aboard the original NES.

The snapshot below captures our emulator using the OLCPixelEngine to blit a live-feed of the emulation process.

Our NES Emulator

Aside: A little note from the devs.

Note that While we have a functioning Picture Processing Unit too, we were not able (yet) to connect the PPU to the cartridge, which is how sprites are blitted onto the screen.

In essence, each peripheral of the NES is to be thought of as an object connected to the Bus, which as most online resources rightly call, is the heart of the architecture of the NES.

We have emulated the processor (the ’6502), the PPU (the ’2C02), as well as the general functioning of the cartridges and the different kinds of RAM accessed by the bus during the working of the NES. Right now, our emulator can output to some degree of accuracy the functioning of the processor when given a .NES file, which is essentially a dump from a physical NES cartridge. We have tested it out with the NES testing suite, and our results corroborate well with the sources that we referred to. We believe our emulation is acccurate.

Paired with a disassembler function, our project is a good way to look at actual programs from the 1980s and see how they were written and structured.

The project would not have been possible without OneLoneCoder’s PixelGameEngine, which is an open-source tool that we used to display our emulated data on the screen.

<img 
  src="/assets/img/1.jpg"
  class="img-fluid rounded z-depth-1"  
  width="auto" 
  height="auto" 
   
   
   
   
   
  title="example image" 
  
  onerror="this.onerror=null; $('.responsive-img-srcset').remove();"
/>

</picture>

</figure>

</div>
<div class="col-sm mt-3 mt-md-0">
    <figure>

</figure>

</div>
<div class="col-sm mt-3 mt-md-0">
    <figure>

</figure>

</div>

</div>

Caption photos easily. On the left, a road goes through a tunnel. Middle, leaves artistically fall in a hipster photoshoot. Right, in another hipster photoshoot, a lumberjack grasps a handful of pine needles.
This image can also have a caption. It's like magic.

You can also put regular text between your rows of images. Say you wanted to write a little bit about your project before you posted the rest of the images. You describe how you toiled, sweated, bled for your project, and then… you reveal its glory in the next row of images.

You can also have artistically styled 2/3 + 1/3 images, like these.

The code is simple. Just wrap your images with <div class="col-sm"> and place them inside <div class="row"> (read more about the Bootstrap Grid system). To make images responsive, add img-fluid class to each; for rounded corners and shadows use rounded and z-depth-1 classes. Here’s the code for the last row of images above:

<div class="row justify-content-sm-center">
    <div class="col-sm-8 mt-3 mt-md-0">
        {% include figure.html path="assets/img/6.jpg" title="example image" class="img-fluid rounded z-depth-1" %}
    </div>
    <div class="col-sm-4 mt-3 mt-md-0">
        {% include figure.html path="assets/img/11.jpg" title="example image" class="img-fluid rounded z-depth-1" %}
    </div>
</div>

–>