Emulating NES CPU and PPU on PIC32, too slow?

Let's talk about anything related to the 6502 microprocessor.
6502inside
Posts: 101
Joined: 03 Jan 2007
Location: Sunny So Cal
Contact:

Re: Emulating NES CPU and PPU on PIC32, too slow?

Post by 6502inside »

Still, nice work!
sburrow
Posts: 833
Joined: 09 Oct 2021
Location: Texas

Re: Emulating NES CPU and PPU on PIC32, too slow?

Post by sburrow »

6502inside wrote:
Still, nice work!
Thank you, I appreciate that.

I got the GitHub page up and running!

https://github.com/stevenchadburrow/AcolyteHandheld

It has been a LONG week of coding this thing. Everything from USB woes to LCD glitches, I've seen them all now. Meanwhile I had to replace two broken components as well: the SDcard holder just popped off for some reason, and I snapped a button stem when trying to force something.

I reprinted the case and buttons, looks better! Still needs a bit of improvement.

Overall it's running great. About 90% of older NES games run on it without issue, another 5% need some adjustments. I'd say around 50% of homebrew games run on my NES emulator, I just don't have as much luck with them for some reason. Speed-wise somehow Mario 3 got 10% slower, I don't know why. Not sure what I included in my new code to slow it down so much *shrug*. Little readjustments like that will come over time.

That's all I got for now! Thank you everyone :)

Chad
Attachments
HandheldPIC32-Image1.jpg
sburrow
Posts: 833
Joined: 09 Oct 2021
Location: Texas

Re: Emulating NES CPU and PPU on PIC32, too slow?

Post by sburrow »

Well, it's been some months, and a few more projects since then, but I have an update here:

https://github.com/stevenchadburrow/PICnes

I ported my NES emulator (which is now called PICnes) to OpenGL/GLFW and OpenAL, then made the project public domain. Yay! I wouldn't say this is the best emulator, by far, but it is very fast and despite it's glitches, bugs, and hacks is very playable and over 95% of games I have tried work well on it. I added other features like RAM saves, save-states, turbo buttons, fast-forward, and four player mode.

I don't know exactly what my next project will be at this point, but at least this one has a happy ending :)

Thank you everyone! :D

Chad
6502inside
Posts: 101
Joined: 03 Jan 2007
Location: Sunny So Cal
Contact:

Re: Emulating NES CPU and PPU on PIC32, too slow?

Post by 6502inside »

A happy ending indeed. :)
plasmo
Posts: 1273
Joined: 21 Dec 2018
Location: Albuquerque NM USA

Re: Emulating NES CPU and PPU on PIC32, too slow?

Post by plasmo »

Very impressive body of works! Please check back with us periodically, love to see where your projects are going.
Bill
TMorita
Posts: 217
Joined: 15 Sep 2002

Re: Emulating NES CPU and PPU on PIC32, too slow?

Post by TMorita »

sburrow wrote:
Hey everyone!

I'm posting on this topic again because... I've been working on my very own NES emulator! Over the past couple of days I've been coding the 6502 instruction set in C, using a lot of pre-compiler macros. Did you know that STA (d),y uses the indirect addressing to *store* a value, not read it?! Hm! That was 4 hours of debugging today :) [ It was actually an very simple oversight since all the other uses of that type of addressing read instead of write. I was just carelessly copying code it seems... ]

Anyways, see attached pictures. I really don't have any PPU set up right now, what I'm doing here is 'faking it', but it seems to work none-the-less. I haven't yet implemented sprites. palettes, audio, etc. I just barely have nametables, interrupts, and... that's about it.

But here's the thing: It is running at nearly the exact speed it needs to run, but I would expect it to be running much faster without all the fancy stuff I haven't yet added to it. On top of that, it is only drawing this in a tiny corner of screen. Read above why I stopped this last time: This PIC32, even at 200 MHz now, is just running too slow. It seems like I'm going to run into a similar problem again!

I'll be playing with it and will update you when I have something good (or bad) to report. Thanks everyone!

Chad
I did work for a company called Digital Media Cartridge.
They had a software Sega Megadrive simulator running on two ARM7s at 100 Mhz.
It did the 68000, Z80, and background/sprite planes and audio hardware at full MegaDrive speed.
The NES is less complicated than the Megadrive.
So it should be possible to run a NES emulation at full speed on a 200 Mhz MIPS processor.

Toshi
User avatar
BigEd
Posts: 11463
Joined: 11 Dec 2008
Location: England
Contact:

Re: Emulating NES CPU and PPU on PIC32, too slow?

Post by BigEd »

(Welcome back, Toshi!)
Post Reply