wedNESday #2

Posted on Wed 11 January 2017 in nes • Tagged with nes emulator python

Keep up

I've refactored the tests and extracted to CPU6502Spec, and them start playing with py65. Didn't take long to have most of the test working. Now I have the same test spec running with either ApplyPy or Py65 6502, and that's amazing. Although, let's keep in mind that the goal is a Ricoh 2A03 CPU, the NES CPU. And that lead us to deal with interrupts.

IRQ and NMI

IRQ stands for "Interrupt Request" and NMI for "Non-Masked Interrupt". As far as I know, and please someone correct me if I got it wrong. Interrupts are used for event handling. On the NES, you have two CPUs (Main and PPU for graphics) that runs in parallel. There fore, to accurately emulate a NES, we need to deal with several race conditional on the hardware. Or, for start, we can make then serial (NMI Thread on NESDev gives good tips in NMI only), and be able to run Super Mario Bros.

As usual, you can checkout the progress at wedNESday repository.

Next wedNESday

  • Create a fake PPU and a memory bridge and try to run a simple waitvblank program.
  • Create a pull request with CPUSpec and send to py65.

wedNESday #1

Posted on Wed 04 January 2017 in nes • Tagged with nes emulator python

Forewords

I've been hacking the NES for quite a long time, and since them, I've always been asked for writing an emulator. Although it was never a priority, everytime a question like that stands, I usually answer: "Why not?".

Let's think over. Why should I, and why you should to? There are already several good emulators available, why write another one?

Moreover, googling about the subject "write nes emulator", there are several good stories. I've put the most relevant links at the bottom. I also recomend you to read them.

Therefore. What to tell abount NES emulators that haven't already being told? Well, not saying that I do intend to fishish it, but let's explore more the ideia.

Press Start

In order to write the emulator, we need to keep up with the overall architecture that was involved. For now, let's focus on the CPU. NES had a ‎Ricoh 2A03 CPU with the same instruaction set of the 6502. Since we are talking about code. Let highlight the code from Niels Widger's Nintengo. It's very polished, and more important, it's filled with tests. So as a experiment, I've rewrote the tests and used on the James Tauber's ApplePy, most impressive, without mush effort, the test spec payoff, and show how well made ApplePy is.

You can checkout the progress at wedNESday repository.

Next wedNESday

  • Get a better understand on how IRQ and NMI works
  • try to do the same with py65.

The First Post

Posted on Sat 20 February 2016 in misc • Tagged with startover

This is not my first attempt to write a blog, nevertheless, shall be the last. However, in this brief time lapse before the next attempt I must overcome the mistakes that lead previous blog to fade after the "First Post".

One early mistake is the actual "first post". Usually, in the content is said what's the blog is about and dictate boundaries for what readers might find. This time, I won't put any restriction. I might write about books that I'm reading, code and hacks and whatever comes in mind.

My second mistake was the platform. Previous blogs were done with wordpress and "Meme", a discontinued Yahoo blog platform. Neither them suited me well. The first is jungle of templates and plugins that don't get along well and the second was discontinued despite being great, what also made me avoid other platforms like tumblr and medium.

Third mistake, was trying to being perfect. That end up with fewer post and lots of unfinished drafts. Most of then were kept as draft due to the fear of critcism.

As a coder, I found markdown generated blogs more suited for daily use. With trivial automated scripts, I can easily update content with a commit, friends could send fix and even submit article with pull requests.