vpnes

Discuss emulation of the Nintendo Entertainment System and Famicom.

Moderator: Moderators

Post Reply
x0000
Posts: 43
Joined: Thu Feb 28, 2013 11:14 am
Contact:

vpnes

Post by x0000 » Thu Apr 04, 2013 3:00 am

Hi everyone

I want to introduce my NES emulator called VPNES. It's written in C++, uses SDL 1.2 and freetype2 libraries, should be cross-platform but GUI was implemented only for win32.

Right now it can run simple NES games. Implemented mappers are: nrom, mmc1 (sxrom), uxrom, cnrom, mmc3 (txrom), axrom.

My program is not really precise and certainly not fast. Last weeks I worked on my PPU (rewrote from scratch again) and now gonna revise my APU (especially DMA). So later I can fix sprites timings. Maybe then I will try to optimize it a bit.
Every time I start work on the program I always end up playing NES games instead, so don't expect much progress. =(

You can download the latest win32 build from here.
Project page: http://vpnes.googlecode.com/

Even tho it passed a year since I started the project I overcame myself and decided to ask your opinion.

And yes, I started this to learn C++ language just like everyone. ;-)



Edit: Please stop talking about penises, that joke is not funny.
Last edited by x0000 on Thu Apr 04, 2013 10:21 pm, edited 2 times in total.

User avatar
thefox
Posts: 3141
Joined: Mon Jan 03, 2005 10:36 am
Location: Tampere, Finland
Contact:

Re: vpnes

Post by thefox » Thu Apr 04, 2013 6:58 am

I can't help but reading it as vpenis. That's all.
Download STREEMERZ for NES from fauxgame.com! — Some other stuff I've done: fo.aspekt.fi

User avatar
Dwedit
Posts: 4408
Joined: Fri Nov 19, 2004 7:35 pm
Contact:

Re: vpnes

Post by Dwedit » Thu Apr 04, 2013 7:05 am

Whenever I try out a new emulator, I always test out Slalom and Battletoads. Slalom reveals all the noob scrolling mistakes (even Bizhawk had problems with this in its first release), and Battletoads is a test to see if the emulator is serious enough to work correctly.
This emulator works great! My Chu Chu Rocket game even worked perfectly. I saw a few problems with Micro Machines, but that game is a real stress test for any emulator.
Small bug with Zelda 2's title screen: Reads to $2007 during rendering should advance the VRAM address (V) by one scanline.
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!

x0000
Posts: 43
Joined: Thu Feb 28, 2013 11:14 am
Contact:

Re: vpnes

Post by x0000 » Thu Apr 04, 2013 8:12 am

Dwedit wrote:Small bug with Zelda 2's title screen: Reads to $2007 during rendering should advance the VRAM address (V) by one scanline.
I don't see any problems there. Also afaik during rendering 0x2007 clocks both V and H at the same time but it could be my mistake.

tepples
Posts: 22278
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: vpnes

Post by tepples » Thu Apr 04, 2013 9:08 am

thefox wrote:I can't help but reading it as vpenis. That's all.
Reminds me of an old splash screen that I created for PocketNES, an NES emulator for GBA:

Image

Photo of a large collection of NES Game Paks, captioned "how big is your p.nes"? The implication was that someone who fills up a GBA flash card with a hundred NES ROMs may be compensating for something.

So anyway, I ran it in Wine on Ubuntu. I found a few problems with some ROMs:

Mapper 34 (Deadly Towers) does not work at all. Mapper 34 with no CHR ROM represents the BNROM board and its oversize variants. This behaves the same as mapper 7, except with normal fixed H/V mirroring instead of 1-screen mirroring. I ask about this because one of my multicart projects currently uses mapper 34 (but will eventually switch to mapper 28). I also made BNTest, a test ROM for certain behaviors in mappers 7 and 34.

The builder for this multicart allows specifying custom reset vectors and preloading a specific 8 KiB bank of the original ROM's CHR ROM into CHR RAM before the game starts. This allows multiple NROM-128 games to share a single 32 KiB bank of PRG ROM if built properly. So I built a ROM with Thwaite and Lawn Mower. It's a CNROM (mapper 3) that normally boots to Thwaite, but a Game Genie code to change the reset vector allows playing Lawn Mower. This ROM works fine in FCEUX but has very screwed up graphics in vpnes. It's as if only odd addresses in CHR ROM are being used. I have attached the ROM.

There appears to be no Zapper support. You can test various aspects of this with Zap Ruder.
Dwedit wrote:Whenever I try out a new emulator, I always test out Slalom and Battletoads.
And when I try a new emulator, I try a ROM that I created that plays sampled speech through timed writes to $4011. If this ROM doesn't work, then Big Bird's Hide and Speak will be unplayable. I was a regular on one forum related to PocketNES several years ago. I'd test each new version with Big Bird and report that it was still broken, and I occasionally got teased about this choice of test case.
Attachments
thwaite_mower_003.nes.zip
This ROM should play Thwaite. It plays very corrupt Thwaite.
(25.35 KiB) Downloaded 381 times

User avatar
Dwedit
Posts: 4408
Joined: Fri Nov 19, 2004 7:35 pm
Contact:

Re: vpnes

Post by Dwedit » Thu Apr 04, 2013 9:31 am

x0000 wrote:
Dwedit wrote:Small bug with Zelda 2's title screen: Reads to $2007 during rendering should advance the VRAM address (V) by one scanline.
I don't see any problems there. Also afaik during rendering 0x2007 clocks both V and H at the same time but it could be my mistake.
Yeah, it was correct, oops.
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!

x0000
Posts: 43
Joined: Thu Feb 28, 2013 11:14 am
Contact:

Re: vpnes

Post by x0000 » Thu Apr 04, 2013 10:15 am

tepples wrote:So anyway, I ran it in Wine on Ubuntu
You can run it without wine, just do this:

Code: Select all

$ svn export http://vpnes.googlecode.com/svn/trunk vpnes
$ cd vpnes
$ chmod 0755 configure
$ mkdir dest
$ ./configure --prefix=`pwd`/dest
$ make
$ make install
You must have SDL 1.2 to build main program and have freetype2 and SDL_ttf for TTF support.
To run a game:

Code: Select all

$ ./dest/bin/vpnes somerom.nes
tepples wrote:Mapper 34 (Deadly Towers) does not work at all.
Is not surprising, only 0, 1, 2, 3, 4 and 7 mappers are supported now.
tepples wrote:There appears to be no Zapper support.
And won't be for some time.
tepples wrote:This ROM works fine in FCEUX but has very screwed up graphics in vpnes. It's as if only odd addresses in CHR ROM are being used.
It was surprising. A very funny bug lol, how could I make that mistake?...
Last edited by x0000 on Thu Apr 04, 2013 11:38 pm, edited 1 time in total.

User avatar
cpow
NESICIDE developer
Posts: 1099
Joined: Mon Oct 13, 2008 7:55 pm
Location: Minneapolis, MN
Contact:

Re: vpnes

Post by cpow » Thu Apr 04, 2013 6:07 pm

thefox wrote:I can't help but reading it as vpenis. That's all.
And that makes me think about those crazies that bifurcate their members. V-penis?

lidnariq
Posts: 10238
Joined: Sun Apr 13, 2008 11:12 am
Location: Seattle

Re: vpnes

Post by lidnariq » Thu Apr 04, 2013 6:35 pm

cpow wrote:bifurcate their members.
Echidna.

Biology is weird.

x0000
Posts: 43
Joined: Thu Feb 28, 2013 11:14 am
Contact:

Re: vpnes

Post by x0000 » Mon Apr 08, 2013 9:30 am

I've changed my sprite evaluation algorithm (slightly differs from what is written on wiki).
0-63:
Fills secondary oam with 0xff (writes on odd dots). Sprite data buffer contains 0xff. PPU continues from the point it was stopped if rendering was disabled and then enabled again
64:
If PPU misses this tick it won't be able to find any visible objects on this scanline.
64-255:
Copies visible sprites to secondary oam.
1. On even clocks it reads data from primary OAM.
2. On odd clocks:
1) If value is in range copy value to secondary OAM and goto 2.
Otherwise OAM_addr = (OAM_addr & 0xfc) + 4. If address overflows goto 5.
If it is first sprite, set 0-object hit flag for the next scanline.
2) For 3 cycles copy data to secondary OAM and increment address. After copying is finished goto 5 if address overflowed or OAM_addr &= 0xfc otherwise.
3) If value is in range goto 4. Otherwise OAM_addr++; if ((OAM_addr & 0x03) != 0) OAM_addr += 4. If address overflowed goto 5.
4) For 3 cycles increment address. After this goto 5.
5) OAM_addr = (OAM_addr & 0xfc) + 4.
256:
Set 0-object hit flag for current scanline.
256-259, 264-267, ..., 312-315:
Reads data from secondary OAM and fills internal sprite data.
260-263, 272-275, ..., 316-320:
Fetches sprite patterns and loads it into shift registers
321-340:
Reads data form primary OAM.

I didn't test it tho so any comments are welcome.
Attachments
vpnes-0.4-win32-116.zip
VPNES Build 116 (r241_p1)
(1.07 MiB) Downloaded 400 times

Post Reply