It is currently Mon Dec 10, 2018 8:10 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Thu Aug 23, 2018 7:18 pm 
Offline

Joined: Thu Aug 23, 2018 7:10 pm
Posts: 2
Hello. I am new here, and I have been working on my NES emulator for the past month or so and am at the point where I can render donkey kong, and it'll play the opening animation.

The problem is that the opening animation does not run properly. Mario will grab the hammer, and run up to the first barrel, hit it, and then the animation will stop right there.

I tried inspecting the loop it's caught in, but I can't detect where it's supposed to escape.

Has anyone else run into anything like this? What was the resolution?


Top
 Profile  
 
PostPosted: Thu Aug 23, 2018 10:09 pm 
Offline
User avatar

Joined: Fri Nov 19, 2004 7:35 pm
Posts: 4108
Sounds like a bad CPU, so try to pass all the tests that would indicate that the operations are doing what they should be doing.

_________________
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!


Top
 Profile  
 
PostPosted: Thu Aug 23, 2018 11:16 pm 
Offline
User avatar

Joined: Sun Sep 19, 2004 9:28 pm
Posts: 3715
Location: Mountain View, CA
https://wiki.nesdev.com/w/index.php/Emulator_tests

You will need to read in great detail any documentation that each of these tests/suites comes with. They generally are not "generic magic smoke" that "just does magical things" to test your emulator.


Top
 Profile  
 
PostPosted: Tue Aug 28, 2018 5:22 pm 
Offline

Joined: Thu Aug 23, 2018 7:10 pm
Posts: 2
Okay, maybe you guys can answer a somewhat related question for me:

I use a catch-up model where the processor execute X number of cycles, and then hands off execution to the PPU for X*3 PPU dots. Is this a correct way to approach this?

The Catch-Up article on NESDEV seems to suggest that doing one cycle and then three dots is fine. It also goes into detail about some sort of predictive model of execution which I hadn't even considered.


Top
 Profile  
 
PostPosted: Tue Aug 28, 2018 5:56 pm 
Offline

Joined: Sun Feb 07, 2016 6:16 pm
Posts: 526
Nowadays the typical approach used by most emulators is to run the PPU for 3 ticks each time the CPU does a read or write operation. Since every CPU cycle implies a memory read or write, this keeps both components in sync. This does mean that you need to implement dummy read/writes properly first, which might be a bit of a pain when starting off.

If you don't want to bother with dummy read/writes right away, the simplest alternative is to run 1 full CPU instruction (which take anything between 2 to 7-ish? CPU cycles), and then run the PPU (for 6-21 cycles accordingly). This way you can use a lookup table that determines how many cycles a specific instruction uses, etc. This won't give perfect "accuracy" when it comes to some raster effects, etc. but it will work nicely for the vast majority of games.

Unless you are specifically aiming to make a super fast emulator, trying to predict the execution when it comes to the PPU is probably not worth the effort. There are so many different mappers that have hard-to-predict interactions with the PPU that doing so is a lot of extra code/effort (not to mention a source of potential bugs)

Predicting the APU on the other hand is relatively easy, and worth the effort for the extra performance it gives.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group