phibiaNES emulator.

Discuss emulation of the Nintendo Entertainment System and Famicom.

Moderator: Moderators

nIghtorius
Posts: 54
Joined: Tue Apr 29, 2014 1:31 pm

phibiaNES emulator.

Post by nIghtorius »

I am currently working on a NES emulator. This is my first emulator in general. Working already some time on it.
It is in the state that it becomes a bit usefull.

Currently emulating:

* 6502 CPU
* 2A03 APU (Sampling up to 192kHz, but 96kHz downto 44.1kHz recommended, 192kHz strains apu emulation too much)
* NES PPU ( still not happy about it, performance wise )
* VRC6 extended audio (Castlevania 3 JP version, Esper Dream 2 - Aratanaru Tatakai and Mouryou Senki Madara)
* Mapper support list: 0, 1, 2, 3, 4, 5(partially), 7, 8, 21, 23, 24, 25, 26, 31, 34, 44, 52, 69, 71, 73, 85, 87
* Image enhancement filters: 2xSAI, Super 2xSAI, 2xBRZ, 3xBRZ, 4xBRZ, TV Scanline 50/75/75SR, Blargg NTSC, Doubler and Tripler.
* GPU acceleration thru Direct2D
* Loading and saving of gamestates ( still needs bug fixing, sometimes you have to load a state 5 a 6 times due PPU issues, needs looking into )
* Rewind emulation in steps of 5 seconds. Able to go back up to 100 seconds.
* Write APU logs
* Write APU Wave
* Loads really fast. ( got that goin' )
* Play considerable amount of NSFs
* AVI recording / on the fly encoding.
* Game Controllers (Gamepads, WIImote, etc)
* 1:1 / 8:7 aspect ratio.
* Very little PAL nes support. It does something but don't expect it to work perfectly.
* Phosphor lag emulation.
* 60 -> 30 fps pulldown for AVI recording also 30 fps (frameblend) option is available!

New release of phibiaNES beta #9 (unstable release)

added/changed:

* VRC7 audio
* ROM browser ( functional, but unstable )
* Open File now combines NSFs and ROMs (therefore removing the Open NSF option)
* Recent ROMs also show recent NSFs.
* Lots of emulation improvements.
* Fixed mapper #31 (CHR_ROM emulation)


Current issues:

* Very little PAL support.
* No Lightgun support. (can't figure that one out)
* Pausing emulation doesn't pause audio (sorry for that, repeating samplebuffer issue, should be easily fixed, but very low priority) <-- still not fixed @ 10-02-2015 (02-10-2015 american)

Included in the file:

* The emulator itself
* The "dropped" project.. The emulator for developers ( no waaaaay done yet... should not use it )
* My "NSF" player firmware routine for my emulator. (Folder resources)
* My "NSF" player source code for my emulator (Folder "Resources - Source")

Any ideas about it will be greatly appreciated. This is project for me too learn the innards of computing in general. I have to say.. It sounds easy to emulate/simulate a NES but it actually far from it. But very educational :D

To see a very old version in action:
https://www.youtube.com/watch?v=4Oi5FHf0V8M

Me playing / recording Crisis Force on my emulator:
https://www.youtube.com/watch?v=eZ83eJ-fvY8

>>> Latest beta download BETA 9b22 (unstable) <<<
pNES-beta9b2.7z
(925.57 KiB) Downloaded 613 times
>>> beta download BETA 9 (unstable) <<<
phibiaNES-beta9_unstable.7z
(912.79 KiB) Downloaded 656 times
>>> Latest stable beta download BETA 8b1 below <<<
pNES-beta8b1.7z
(931.73 KiB) Downloaded 707 times
Last edited by nIghtorius on Thu Jan 05, 2017 3:54 pm, edited 8 times in total.
User avatar
koitsu
Posts: 4201
Joined: Sun Sep 19, 2004 9:28 pm
Location: A world gone mad

Re: phibiaNES (pNES) emulator.

Post by koitsu »

Be careful with your emulator name, it's already been used; doesn't matter if it's an abandoned project or not, when I saw the name I was like "there's already an emulator by that name, I remember it" -- http://www.3e8.org/pnes.html | http://freecode.com/projects/pnes

Stick with just calling it phibiaNES in full. :-)

P.S. -- Congratulations for being one of the (few) people who implemented Vsync (i.e. no tearing) correctly while in windowed mode on XP. It deserves mention because it's remarkable how many people screw this up. Edit: Oh, I take that back, it does have tearing but in a very bizarre way and very gradual, but it's still tolerable. You might be limited by SDL in this regard, so no hard feelings.
tepples
Posts: 22708
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: phibiaNES (pNES) emulator.

Post by tepples »

That and use as an abbreviation for PocketNES, not to mention what a ROM or cartridge collection allegedly compensates for. During the GBA era, I made this title screen for PocketNES:
Image
Not my photo.
User avatar
koitsu
Posts: 4201
Joined: Sun Sep 19, 2004 9:28 pm
Location: A world gone mad

Re: phibiaNES (pNES) emulator.

Post by koitsu »

Don't worry Tepples, pNES and A/NES will soon combine forces. ;-) Just had to say something like this because of the text on the pnes home page: I just wanted to finally expose pNES to the public (yeah sure, that wasn't intentionally phrased at all, nosiree...)
x0000
Posts: 43
Joined: Thu Feb 28, 2013 11:14 am
Contact:

Re: phibiaNES (pNES) emulator.

Post by x0000 »

Well, my vpnes emulator sounds even more hilarious. I don't have any intentions to change the emulator's name though.
nIghtorius
Posts: 54
Joined: Tue Apr 29, 2014 1:31 pm

Re: phibiaNES (pNES) emulator.

Post by nIghtorius »

About the tearing and stuff.. I do use SDL for audio, but not for display. for Display I use GDI ( worst case scenario ) or direct2d (Not D3D, OGL)
maybe I would implement these later on. but for now.. I stick with D2D graphics as GPU acceleration option.

This means that accelerated options (and therefore proper vSYNC) is only supported with Windows 7 or higher. sorry bout that :)

With windows XP it probably will fallback to GDI with framerate syncronisation at precise 60fps. if your display does 59.9995 hz or something like that. You might see weird tearing (not your normal one though)

You can see the currently used render mode below the application screen:
pnesdown.png
pnesdown.png (2.19 KiB) Viewed 18940 times
For it to do its full glory it needs to be "Direct2D GPU mode"

Make sure that disable gpu acceleration is not enabled:
pnesopt.png
User avatar
cpow
NESICIDE developer
Posts: 1097
Joined: Mon Oct 13, 2008 7:55 pm
Location: Minneapolis, MN
Contact:

Re: phibiaNES (pNES) emulator.

Post by cpow »

What other kind of pnes options are there?

:beer:

Maybe a piercing? Circumcision? A ring? Bifurcation? Erectile assistance implant? :lol:
nIghtorius
Posts: 54
Joined: Tue Apr 29, 2014 1:31 pm

Re: phibiaNES (pNES) emulator.

Post by nIghtorius »

..... ok that's it.

OK guys. you had your fun :D
I will rename every p in front of NES to phibia.... Seems better that way... :?

Don't be too serious, ok?
tepples
Posts: 22708
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: phibiaNES emulator.

Post by tepples »

Thanks. Now there is no ambiguity. This should work.

So is there anything you need help with?
Grapeshot
Posts: 85
Joined: Thu Apr 14, 2011 9:27 pm
Contact:

Post by Grapeshot »

Congratulations on getting this far and, I'm sure, learning a lot along the way! Also congratulations at getting vsync working in a window, I still can't really manage that myself.
If you want some constructive criticism, I ran through my usual list of test games and here's what I saw.

First of all, here's a list of games I tried that didn't work at all.

Black screen:

Bad Dudes
Bee 52
Bill and Ted's Excellent Adventure
Bucky O'Hare
Burai Fighter (makes some sick sounding noises, probably executing data)
Big Nose Freaks Out (which doesn't work in my emulator currently either so that's no big deal)
GI Joe
Gremlins 2
Kickle Cubicle
Robocop 3
Zombie Nation

Other issues:
Driar freezes at title screen
Kick Master has graphical glitches then freezes in Level 1
Break Time gets stuck on the title screen in an infinite loop
You've made a mistake with MMC3 CHR banks which you will see when you get Kickle Cubicle working
Unforgivably, the default A and B button settings are backwards :)

Sound issues:
DPCM bass samples in Sunsoft games are out of tune
Very obvious aliasing artifacts (especially audible in Solstice), need to use a resampler
Triangle channel makes popping noises when enabled and disabled
APU hardware envelope seems to be missing on the noise channel and the noise channel is just too loud in general

That's probably enough to keep you busy poking around for a while.
nIghtorius
Posts: 54
Joined: Tue Apr 29, 2014 1:31 pm

Re: phibiaNES emulator.

Post by nIghtorius »

Thanks,

I have really looked into the audio of the NES.. Playing a lot of NES captured videos for sound. I have the DPCM samples in tune now (Rounding errors). But now I have small popping noises through my audio output. Therefore I will completely revise the APU code. Right now I use approximation logic. So that I don't have to fully compute the APU on a clock-to-clock base. But it seems this won't do as the aliasing/popping and out-of-tune.. Especially in low sample rates (lower sample rate means more approximation logic) @ 96000Hz it becomes alot better.

Still revising as it is.

Still trying to get Kickle Cubicle to run. Still don't know why this game hangs. Been debugging it for hours.. :( ( tracing execution step-to-step, It just goes from subroutine to subroutine to subroutine, pffff )

To return a favor:
It seems your emulator has timing issues with Ducktales I (sprite #0 shows too much, and the glitch above the statusbar when walking around isn't visible. It shows on a real NES though) and especially with Shalom.. Artifacts due to timing errors in the track.

And about the B, A default button mappings. That is just the way I prefer it.. I am used having the 'B' button next to my d-pad. As it is mirrored on my keyboard. I default configured it to still be next to the "d-pad" :)
WedNESday
Posts: 1284
Joined: Thu Sep 15, 2005 9:23 am
Location: Berlin, Germany
Contact:

Re: phibiaNES emulator.

Post by WedNESday »

Bill & Ted (and a lot of other MMC1 games) won't run unless you limit 6502 -> MMC1 writes to 1 per opcode.

Edit: Go here for windowed vsync with Direct3D.

viewtopic.php?f=3&t=9262&start=47
nIghtorius
Posts: 54
Joined: Tue Apr 29, 2014 1:31 pm

Re: phibiaNES emulator.

Post by nIghtorius »

I keep with my direct2d code. With GDI fallback for vista and lower. Since I target only newer windows versions. Maybe when the emulator becomes really compatible and all the kinks are being worked out. i might implement Direct3D / OpenGL renderers.

Got Kickle to run. Yay that is something. Had IRQ emulation issues. Fixed that though. Most of the problem games are.... Still problematic, but Kickle runs. And I did not see any glitches or some kind. It ran without hiccups. Therefore I don't see what mistake I made with the mmc3 characterbanking.
Grapeshot
Posts: 85
Joined: Thu Apr 14, 2011 9:27 pm
Contact:

Re: phibiaNES emulator.

Post by Grapeshot »

You might have fixed it already, but the issue is that the mmc3 ignores the last bit of the CHR bank select registers when they're used for 2k banking. I've only seen this cause problems in Kickle Cubicle and the Capcom OST compilation ROM.
tepples
Posts: 22708
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: phibiaNES emulator.

Post by tepples »

Have you seen it cause problems in the MMC3 version of Holy Diver Batman mapper test?
Post Reply