@ST_W - Yeah I did actually plan to put a release on GITHUB once I got scrolling working but I haven't quite gotten there yet. TBH I didn't expect anyone to really try to run it that quickly lol. So here are a few more things I forgot to point out:
Yes, there are dependencies as you guys have noted - specifically libz and freeimage. It's been so long since I set up my dev environment that I forgot to point that out. Sorry!
As for the crash - I really don't know why it would do that. Hmmm. Of course things are very much WIP here and there are bound to be bugs we don't know about but yeah off the top of my head I don't know what would cause that. It wouldn't surprise me if it was some type of array access out of bounds or something as I am bad to make off by 1 errors >_< Other than that I've ran it on Windows 10 x64, Windows 7 x64 personally. I've only compiled it with 32bit FB.
Now as for the games - the ones included in the source are just extremely simple demo programs that are made to test a 6502 emulator. These programs are free to distribute and have nothing to do with the NES and compatibility for those was only left in because I could. If you are having trouble with input not parsing you can try lowering the goal ops per second in the options mention(which btw I forgot to mention use mousewheel to change options that you mouse over). Anyway if you want to see real NES games you need NES roms - dumps of the cartridges that used to run on the NES. There is copyright law involved so I can't link them or put them in the source, but you can easily find them if you Google it.
Example of some NES games that work pretty much flawlessly(of course no sound):
Balloon Fight
Donkey Kong 1/2/3/Jr
Mario. Bros
Examples of some games that would work if scrolling was implemented(without it you can boot them but when the screen would scroll it will cause a lot of graphical problems - I think this is what you saw with Prince of Persia):
Super Mario Bros.
Contra
Megaman
Castlevania
Bomberman
So yeah. Anyway sorry I forgot to explain some things up above, I had been coding all day and was tired and just wanted to make a thread before I went to bed lol!
Edit: Oh and yes there are much more efficient ways to do the graphics. I just wanted something quick and dirty that would show the output and run at a reasonable speed. However I never expected to get fullspeed using PSET (or in this case using LINE to draw a scaled pixel). I was pleased that I was able. This is the actual code here:
Code: Select all
Sub ppuRender
Dim As UInteger xoff = screenx - (256*sf)
Dim As UInteger yoff = screeny - (240*sf)
For yyy As Integer = 0 To 239
For xxx As Integer = 0 To 255
For zzz As Integer = 0 To sf-1
If ppubuffer(xxx,yyy) <> oldbuffer(xxx,yyy) Andalso ppubuffer(xxx,yyy) <> -1 Then
Line nesbuffer, (xoff+(xxx*sf-sf),yoff+(yyy*sf-zzz))-(xoff+(xxx*sf),yoff+(yyy*sf-zzz)), masterpalette(ppubuffer(xxx,yyy))
ElseIf forcerender = 1 Then
Line nesbuffer, (xoff+(xxx*sf-sf),yoff+(yyy*sf-zzz))-(xoff+(xxx*sf),yoff+(yyy*sf-zzz)), masterpalette(ppubuffer(xxx,yyy))
forcerender = 0
End if
Next
Next
Next
Put framebuffer,(0,0),nesbuffer, trans
End Sub
What we are doing is having the emulated PPU (think of this as the GPU on the NES) write it's output as color values to an array. Then on scanline 241(i.e. the PPU has finished drawing a frame) we call this sub and dump the changed pixels out to an FB.IMAGE. It works well and is more than fast enough on modern hardware. Maybe at some point later I would make a faster way, but for now I am pleased with it.