NES emulator in FreeBASIC
-
- Posts: 85
- Joined: Jun 18, 2006 19:48
NES emulator in FreeBASIC
EDIT 5-1-11: skip down to my new post containing a complete rewrite! do not download the link at the bottom of this post. get this instead: http://rubbermallet.org/moarnes-0.11.5.7.zip
i started working on this about a month ago, and it's built around the 6502 core used in my FB apple 2 emulator that i posted some time ago.
it's far from finished, but it's getting there. thought some people here might be interested in this project. :)
currently it only will work with mapper 0 and 2 ROMs. very few games actually go completely in-game, and the ones that do can be glitchy. i have the best luck so far with "Starship Hector" and "3D Battles of World Runner"
here are some screenshots to give you an idea of the progress:
aaaaand, here is the source code:
http://irc.rubbermallet.org/extranes-freebasic.rar
i started working on this about a month ago, and it's built around the 6502 core used in my FB apple 2 emulator that i posted some time ago.
it's far from finished, but it's getting there. thought some people here might be interested in this project. :)
currently it only will work with mapper 0 and 2 ROMs. very few games actually go completely in-game, and the ones that do can be glitchy. i have the best luck so far with "Starship Hector" and "3D Battles of World Runner"
here are some screenshots to give you an idea of the progress:
aaaaand, here is the source code:
http://irc.rubbermallet.org/extranes-freebasic.rar
Last edited by Mike Chambers on May 13, 2011 17:14, edited 3 times in total.
-
- Posts: 8586
- Joined: May 28, 2005 3:28
- Contact:
-
- Posts: 85
- Joined: Jun 18, 2006 19:48
thanks for the comments guys. :)
i've officially abandoned this as of a couple days ago. i love FB, but i thought it was a good idea to can this and start over in C. i've already gotten much farther and i can even completely play all of mega man 1.
plus i'm using SDL, and i've been able to compile it in windows, linux, OS X (on a G3), and even on an ANCIENT powermac 6100/60. (1st gen PPC)
it seems to work fine on any platform SDL can be used on. portability is the biggest reason for the switch, but it's also so much faster than the FB version it's crazy.
screenshot of it on a linux box:
i've officially abandoned this as of a couple days ago. i love FB, but i thought it was a good idea to can this and start over in C. i've already gotten much farther and i can even completely play all of mega man 1.
plus i'm using SDL, and i've been able to compile it in windows, linux, OS X (on a G3), and even on an ANCIENT powermac 6100/60. (1st gen PPC)
it seems to work fine on any platform SDL can be used on. portability is the biggest reason for the switch, but it's also so much faster than the FB version it's crazy.
screenshot of it on a linux box:
-
- Posts: 85
- Joined: Jun 18, 2006 19:48
hey all, bumping this after a long time because even though i moved my NES emu to C, recently i decided to give it another go in FB, and the results are looking okay right now.
current status:
-most mapper 0, 1, 2 games are working more or less fine
-audio emulation is working (and it sounds pretty decent)
-a few graphical bugs in some games, occasional palette weirdness, sprite priority problems in some games
-possible 6502 CPU core glitches, but mostly seems fine
need to do:
-add a lot of other game mapper chips support!!
-speed up the PPU engine
-improve the audio emulation
well-tested games:
-mega man 2 (other mega man games should be good as well)
-contra
-starship hector
-donkey kong
-chip and dale rescue rangers
-many others should work as well
the biggest problem right now is how SLOW the PPU engine is. the actual rendering to screen is very fast, that uses SDL. the slow part is the code to emulate the NES hardware parts that looks at whats supposed to be on the screen and evaluates/draws it to a buffer. any dual core machine should run it FINE but i've found that all but the fastest pentium 4 systems need to use frameskip to run full speed. i really need to work on that. it's the stuff in modPPU.bas if you look at the source.
download:
compiled win32 binary - http://rubbermallet.org/moarnes-0.5.1.11.zip
sourcce code - http://rubbermallet.org/moarnes-0.5.1.11-source.zip
just run moarnes.exe to see how to use the command line. the first time you run a game it will ask you to configure your control keys.
i'd love to get comments and suggestions! enjoy! :)
my C version is far more advanced but i like the idea of having a pure FreeBASIC NES emu that is viable as well!
current status:
-most mapper 0, 1, 2 games are working more or less fine
-audio emulation is working (and it sounds pretty decent)
-a few graphical bugs in some games, occasional palette weirdness, sprite priority problems in some games
-possible 6502 CPU core glitches, but mostly seems fine
need to do:
-add a lot of other game mapper chips support!!
-speed up the PPU engine
-improve the audio emulation
well-tested games:
-mega man 2 (other mega man games should be good as well)
-contra
-starship hector
-donkey kong
-chip and dale rescue rangers
-many others should work as well
the biggest problem right now is how SLOW the PPU engine is. the actual rendering to screen is very fast, that uses SDL. the slow part is the code to emulate the NES hardware parts that looks at whats supposed to be on the screen and evaluates/draws it to a buffer. any dual core machine should run it FINE but i've found that all but the fastest pentium 4 systems need to use frameskip to run full speed. i really need to work on that. it's the stuff in modPPU.bas if you look at the source.
download:
compiled win32 binary - http://rubbermallet.org/moarnes-0.5.1.11.zip
sourcce code - http://rubbermallet.org/moarnes-0.5.1.11-source.zip
just run moarnes.exe to see how to use the command line. the first time you run a game it will ask you to configure your control keys.
i'd love to get comments and suggestions! enjoy! :)
my C version is far more advanced but i like the idea of having a pure FreeBASIC NES emu that is viable as well!
-
- Posts: 85
- Joined: Jun 18, 2006 19:48
hi mihal, yes that was the link to my very old first try at this last year. check my last post, it has the current link http://rubbermallet.org/moarnes-0.5.1.11.zipMihail_B wrote:Mikey this seems not to work ...
http://irc.rubbermallet.org/extranes-freebasic.rar
Mirror ?
thanks for checking it out! :)
-
- Posts: 1009
- Joined: Oct 11, 2008 7:42
- Location: ABQ, NM
- Contact:
"-possible 6502 CPU core glitches, but mostly seems fine"
Some games may be tricking the CPU using undocumented features.
I found just today, a 6502 glitch list, on an old apple website.
/
http://www.textfiles.com/apple/6502.bugs.txt
~Kiyote!
[edit 2more]
"looks at whats supposed to be on the screen and evaluates/draws it to a buffer. any dual core machine should run it FINE"
You should ask me in email.
I can go into detail how I figured out the NES sprite priority trick, it's how my 7x7x16 trick works from back in the day.
It requires an 8-bit 256 color palette, and works by making plaid stripes in the palette, to achieve sprite vs background priorities.
Some games may be tricking the CPU using undocumented features.
I found just today, a 6502 glitch list, on an old apple website.
/
http://www.textfiles.com/apple/6502.bugs.txt
~Kiyote!
[edit 2more]
"looks at whats supposed to be on the screen and evaluates/draws it to a buffer. any dual core machine should run it FINE"
You should ask me in email.
I can go into detail how I figured out the NES sprite priority trick, it's how my 7x7x16 trick works from back in the day.
It requires an 8-bit 256 color palette, and works by making plaid stripes in the palette, to achieve sprite vs background priorities.
-
- Posts: 8586
- Joined: May 28, 2005 3:28
- Contact:
Mike i changed your NESi :-)
download: moarnes_fb_mode.zip
for the -lang FB mode
but i don't get the bolder dash ROM working.
Do you know what are wrong with your emulator ?
Before i can help you to make it really fast
the logic must be ok, you know?
Joshy
download: moarnes_fb_mode.zip
for the -lang FB mode
but i don't get the bolder dash ROM working.
Do you know what are wrong with your emulator ?
Before i can help you to make it really fast
the logic must be ok, you know?
Joshy
-
- Posts: 85
- Joined: Jun 18, 2006 19:48
hi joshy, just peeked in that zip file - good stuff thanks. i have a nasty habit of writing everything in fblite. you should have a look at this latest version.. lots of bug fixes and the background rendering code has been optimized by changing it to mostly assembly.D.J.Peters wrote:Mike i changed your NESi :-)
download: moarnes_fb_mode.zip
for the -lang FB mode
but i don't get the bolder dash ROM working.
Do you know what are wrong with your emulator ?
Before i can help you to make it really fast
the logic must be ok, you know?
Joshy
http://rubbermallet.org/moarnes-0.11.5.6.zip
not sure why boulder dash doesn't work. it does work in the C version of MoarNES though. i'll have to compare the code from the two and see what the deal is there.
thanks for havin a peek at the emu, i think it's a solid start to having a decent FB NES emu! :) plenty of work to go though..
Last edited by Mike Chambers on May 06, 2011 15:38, edited 1 time in total.
-
- Posts: 85
- Joined: Jun 18, 2006 19:48
hey kiyote you just reminded me to actually check my email i hadn't in a few days! lol. i didn't know you did any NES deving.kiyotewolf wrote:"-possible 6502 CPU core glitches, but mostly seems fine"
Some games may be tricking the CPU using undocumented features.
I found just today, a 6502 glitch list, on an old apple website.
/
http://www.textfiles.com/apple/6502.bugs.txt
~Kiyote!
[edit 2more]
"looks at whats supposed to be on the screen and evaluates/draws it to a buffer. any dual core machine should run it FINE"
You should ask me in email.
I can go into detail how I figured out the NES sprite priority trick, it's how my 7x7x16 trick works from back in the day.
It requires an 8-bit 256 color palette, and works by making plaid stripes in the palette, to achieve sprite vs background priorities.
-
- Posts: 1009
- Joined: Oct 11, 2008 7:42
- Location: ABQ, NM
- Contact:
-
- Posts: 289
- Joined: Oct 10, 2006 7:19