After reading and researching numerous documents, and scanning other peoples source code for clues, I've produced one of the hardest projects I've ever worked on... a Nintendo Emulator. Yep, you can play the good ol 8 bit NES on your PC. It has both software rendering (StretchDIBits) and Hardware rendering (DirectX). It's practically the only NES emulator written in vb6 that actually has pure sound using DirectSound! I also put in a low pass filter for the sound. You can also seemlessly go from windowed to fullscreen and back with no issues in both software and hardware. And has Load States and Save States. I even included the classic Super Mario Bros so you can test it out right away.
Note: in IDE mode, it'll be way too slow for testing (6-8 fps with sound on, 12-15 fps with sound off). You must compile to exe and use the exe for a full speed of 60 fps. Another thing is that you must have the vb6 version of DirectX to even use the sound or hardware mode. In other words, you must have the dx8vb.dll on your computer over in your system folder and have it registered using regsvr32.exe. This is needed if you have Windows 7 or 8. Windows Vista and below should already have it preinstalled so you don't need the file let alone have to go through a process of registering it.
Note For Windows 7 & 8 users: this will not be shown in your References. And you will only need to do these parts once ever:
- Put the dx8vb.dll file in your Windows\SysWOW64 folder.
- Drag it into regsvr32.exe to register it in order to use it in VB6 from now on and have it shown in References.
- Go ahead and reopen Visual Basic 6 and check the References again to see if it's there.
If it's still not there, the best approach is to run Command Prompt as an Administrator and reference it, as sometimes simply dragging a file into regsvr32 is not enough. To do this:
- Goto your Start Menu.
- click on the bottom where it says > All Programs and goto Accessories
- Right click Command Prompt.
- Click Run as administrator (should be located under Open).
- Next type regsvr32 "YOUR FILE PATH HERE OF DX8VB.DLL" For example:
I still have a looooong way to go before its complete but here are the version numbers history of known issues and hot fixes:
- Fixed some of the nametable scrolling issues such as Super Mario Bros' scrollboard flickering
- Added the ability to view the frames per second in windowed and fullscreen. Although ghetto, itll suffice for now.
- Inlined some of the subs to speed things up a notch.
- Minor sound calibration tweaks.
- The ENTIRE color palette has been changed into authentic NES color to the actual NES. Although there is no true palette values from the actual NES, and too many sites produced misleading information on the palette, I found the true composite colors from a forum post, added it to my emulator, and compared it to my real NES. It was exactly the same, and the greens weren't too green like the real NES, the sky in Super Mario was exactly alike, etc. How do I know this when brightness, contrasts, and tint could be different from a TV and monitor? My computer is hooked into my TV through an HDMI cable. I can just bounce back and forth between HDMI and Video to compare.
- Fixed and added Noise channel. However, although sounds great on many games such as Double Dragon, I'm not hearing bricks breaking in Super Mario Bros.
- Added Mapper 2 support so you can play games such as Contra!
- Fixed the looping sound issue when you have focus on the menu.
- Reading and Writing from the address registers from $0000 to $FFFF has been inlined which produced a huge increase in emulator speed. No more minor slowdowns from time to time like before.
- Sound has been tweaked to make it a tad more authentic and consistant with the documentation.
- Sound Debugger got many more things added such as noise channel, and square channels now show sweep info.
- Code has been cleaned up a notch.
- Many other minor fixes I can't name from the top of my head.
Known Issues for v0.60:
- Legend of Zelda is saving a save file, and loading but in game, it shows no save game exist. Possibly need to play further to really know for sure.
- Square channels work great but doesn't sound authentic enough. Go into a pipe to see what I mean in Super Mario Bros.
- Noise channel works great but doesn't sound authentic enough such as no brick breaking noise in Super Mario Bros.
- DMC channel has NOT been programmed yet for voice samples. Play Kung Fu and you'll notice something missing to see what I mean.
- Added Mapper 1 support for games such as
-Castlevania 2: Simons Quest
-Legend of Zelda
..and much more. Again refer to the NES mapper list on Google to find out more Mapper 1 games.
- Fixed the Triangle sound channel. Now it plays and halts perfectly as should.
- Added a much more sophisticated sound debugger.
- Only mapper 0 games are supported in the mean time till I perfect everything.
-Super Mario Bros
-10 Yard Fight
-Robot Block (Stack-Up)
-Robot Gyro (Gyromite)
Google up NES Mapper List to see a complete list to find other mapper 0 games.
- Nametable Scrolling for the background is a little messed up. So you'll see anomalies such as flickering on the score board in Super Mario Bros ever other section of each level.
- The NES has 5 channels for sound. Rectangle 1, Rectangle 2, Triangle, Noise, and DMC. I shut off Noise by enabling it false cause it causes slowdown later on. This is a known issue thatll be resolved soon. I also didn't program the DMC yet. So only 3 sound channels are working.
- The sound itself is good but sometimes a tiny bit scratchy.
- 1942 (J) when paused causes the SamplingCount to skyrocket at warp speed even though no sound is playing, causing overflow if left for a short period of time.
I will be constantly updating this program with new revisions as I go along. Enjoy
[EDIT] I will no longer delete each old project to replace it with a new one. Instead I will have up just 5 of the latest just so the number of downloads don't keep getting knocked back to 0, and you can examine the old code for educational purposes. If the project gets complete enough, I may port this to VB.Net as well just so an NES emulator in VB.Net exists if it doesn't already.