New NES emulator!

Discuss emulation of the Nintendo Entertainment System and Famicom.

Moderator: Moderators

ultimate_coder
Posts: 4
Joined: Fri Apr 01, 2011 8:42 am

New NES emulator!

Post by ultimate_coder »

Hello,

My name is ultimate_coder. I am 13 and me and two of my friends have started making a new NES emulator. It's made in C and it's called UltiNES. Our goal is 100% compatibility and support for OpenGL. We need some help with sound, but my cousin knows how to make MIDI files, so he'll probably write that part.

We started the day after Christmas. My friend showed me an emulator, nestopia, and I knew we could make a better one. We got pretty far since then but need just a little bit of help. Can someone tell me where we should go from here? This is a part of our code. This is the part that does the emulating (but I didn't show our cpu code because it's super-fast and I think we're going to sell it to other emulator coders:

Code: Select all

FILE *fp;

fp = fopen("mario.nes", "r");
{
 printf("File is open\r\n");
 
 //ignore ines header because it doesn't work for
 //so many games.  hx0r is writing ZapFC support
 fseek(fp, 16, SEEK_SET);

 do {
  //read in operation code and next parameters
  //void execute_operation_code(int *code, int *next_byte1, int *next_byte2)
  int code = fgetc(fp);
  int next_byte1 = fgetc(fp);
  int next_byte2 = fgetc(fp);

  execute_operation_code(&code, &next_byte1, &next_byte2);

  if (code == 'H' && next_byte1 == 'L' && next_byte2 == 'T')
   return -1;
  
  //this doesn't do anything yet.  we're going to need a couple of more days
  //to write 100% accurate graphics.
  execute_ppu_integrated_circuit();

  if (artificial_intelligence == 4/1)
   autoplay_mario();

  get_keyboard_presses();
  draw_to_opengl();
  
  //my cousin will write this
  //play_sound();
 } while (true);
}
We made a ppu but it didn't work well, so we're going to start over. Can someone send us some sample code? We looked at other emulator source code, but they're way too complex. How do I get in touch with Loopy and Brad Taylor. I think they can help.

Also, I don't think our cpu is working right yet, but it makes my task manager show high cpu usage, so it must be working correctly. Does anyone have any ideas?

Oh if you want to join our team, we're looking for good developers. Let me know and we'll look at your code to see if you're good enough for the team.

bye! :D
User avatar
cartlemmy
Posts: 193
Joined: Fri Sep 24, 2010 4:41 pm
Location: California, USA
Contact:

Post by cartlemmy »

This looks great guys. I'm surprised no one has taken this approach yet, so simple. Simple and elegant solutions are sometimes the best. I don't have a lot of free time, but I'm very interested in joining your team.
User avatar
thefox
Posts: 3134
Joined: Mon Jan 03, 2005 10:36 am
Location: 🇫🇮
Contact:

Post by thefox »

Any chance you could make the code QBasic compatible because that's all I use? Just an idea.
Download STREEMERZ for NES from fauxgame.com! — Some other stuff I've done: fo.aspekt.fi
User avatar
cartlemmy
Posts: 193
Joined: Fri Sep 24, 2010 4:41 pm
Location: California, USA
Contact:

Post by cartlemmy »

thefox wrote:Any chance you could make the code QBasic compatible because that's all I use? Just an idea.
Good point. C is hard to understand when you are used to Basic.
ultimate_coder
Posts: 4
Joined: Fri Apr 01, 2011 8:42 am

Post by ultimate_coder »

cartlemmy wrote:I don't have a lot of free time, but I'm very interested in joining your team.
Did you make your avatar with a ppu? Can you send us the code?
User avatar
cartlemmy
Posts: 193
Joined: Fri Sep 24, 2010 4:41 pm
Location: California, USA
Contact:

Post by cartlemmy »

ultimate_coder wrote:
cartlemmy wrote:I don't have a lot of free time, but I'm very interested in joining your team.
Did you make your avatar with a ppu? Can you send us the code?
Yes, it is my own custom PPU code. I can send a part of the code (It is in Perl, you think you can port it to C?) so you can decide if I am the sort of programmer you are looking for. (PMed)
ultimate_coder
Posts: 4
Joined: Fri Apr 01, 2011 8:42 am

Post by ultimate_coder »

thefox wrote:Any chance you could make the code QBasic compatible because that's all I use? Just an idea.
COOL -- I just looked at this on google and it's so much easier! We're going to switch! THANKS!!!

p.s. that Nibbles game looks awesome!
User avatar
cartlemmy
Posts: 193
Joined: Fri Sep 24, 2010 4:41 pm
Location: California, USA
Contact:

Post by cartlemmy »

ultimate_coder wrote:p.s. that Nibbles game looks awesome!
Woah, Nibbles is in Basic??? Somebody told me that basic couldn't do good graphics. They were WRONG!
ultimate_coder
Posts: 4
Joined: Fri Apr 01, 2011 8:42 am

Post by ultimate_coder »

cartlemmy wrote:I can send a part of the code (It is in Perl, you think you can port it to C?) so you can decide if I am the sort of programmer you are looking for. (PMed)
Thanks for the code. We voted and you can be on the team.

We're trying to convert it to QBasic. What does this part do?

Code: Select all

print pack('H*', '486170707920417072696c20466f6f6c73272044617921');
User avatar
cartlemmy
Posts: 193
Joined: Fri Sep 24, 2010 4:41 pm
Location: California, USA
Contact:

Post by cartlemmy »

ultimate_coder wrote:
cartlemmy wrote:I can send a part of the code (It is in Perl, you think you can port it to C?) so you can decide if I am the sort of programmer you are looking for. (PMed)
Thanks for the code. We voted and you can be on the team.

We're trying to convert it to QBasic. What does this part do?

Code: Select all

print pack('H*', '486170707920417072696c20466f6f6c73272044617921');
Hoo-rah!
Yeah, that part clears the screen buffer. In QBasic it is much simpler. You need to convert it like so:

Code: Select all

  Private Function HexToString(Value As String)
    Dim szTemp As String
    szTemp = Value
    
    Dim szData As String
    szData = ""
    While Len(szTemp) > 0
        szData = Chr(CLng("&h" & Right(szTemp, 2))) & szData
        If (Len(szTemp) = 1) Then
            szTemp = Left(szTemp, Len(szTemp) - 1)
        Else
            szTemp = Left(szTemp, Len(szTemp) - 2)
        End If
    Wend
    HexToString = szData
End Function

PRINT HexToString("49204c4f4c65642e205468652066756e6e79207468696e67206973207468617420746869732069736e2774206661722066726f6d207265616c20706f7374732e")
I'm a little rusty at Qbasic, so this may need some tweaking. The cool thing about QBasic is you get to create your own function for something like this. It goes down smooth, like an everclear habenero glass smoothie.
User avatar
clueless
Posts: 496
Joined: Sun Sep 07, 2008 7:27 am
Location: Seatlle, WA, USA

Post by clueless »

Something must be wrong. I'm testing your perl and qbasic code on my linux box. I was stupid and ran it as root, there was a shitload of disk activity, and now my kernel panicked. :( Please send help fast.
User avatar
qbradq
Posts: 972
Joined: Wed Oct 15, 2008 11:50 am

Post by qbradq »

:shock:


This whole thread is a joke, right?
User avatar
clueless
Posts: 496
Joined: Sun Sep 07, 2008 7:27 am
Location: Seatlle, WA, USA

Post by clueless »

qbradq wrote::shock:
This whole thread is a joke, right?
I hope not. I really want to see this new emu that is better than nestopia. I already lost 3 boxes to testing it. I've only got 25 more at our DR site left. Then I suppose I'll have to start testing in production. They get kinda pissy when I do that.

Hurry up with the code fixes!
User avatar
cartlemmy
Posts: 193
Joined: Fri Sep 24, 2010 4:41 pm
Location: California, USA
Contact:

Post by cartlemmy »

clueless wrote:Something must be wrong. I'm testing your perl and qbasic code on my linux box. I was stupid and ran it as root, there was a shitload of disk activity, and now my kernel panicked. :( Please send help fast.
Yeah, I run it under my linux box in Wine, and then run dos box inside of Wine for that extra layer of protection. It works great that way.
User avatar
clueless
Posts: 496
Joined: Sun Sep 07, 2008 7:27 am
Location: Seatlle, WA, USA

Post by clueless »

cartlemmy wrote:
clueless wrote:Something must be wrong. I'm testing your perl and qbasic code on my linux box. I was stupid and ran it as root, there was a shitload of disk activity, and now my kernel panicked. :( Please send help fast.
Yeah, I run it under my linux box in Wine, and then run dos box inside of Wine for that extra layer of protection. It works great that way.
I don't have wine, I don't like to drink.

But I can run dos in softpc inside a Mac LC-ii emulated on Basilisk running on my surviving linux box. Is that enough protection?
Locked