It is currently Fri Nov 16, 2018 12:09 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Tue Sep 04, 2018 10:17 am 
Offline

Joined: Tue Sep 04, 2018 10:07 am
Posts: 3
Hey guys, I'm ironing out bugs in my emulator and I found a strange glitch in Super Mario Bros and was looking for some direction on where to look for the bug.

When Mario is running to the right, the moment you let go of the right button, instead of Mario slowing to a stop, he is pulled backwards and the animation looks as if he had just been running left and is making a sharp turn. If he's moving fast enough, he will do this incorrect behavior twice in a row.

I don't think it's a problem with controller input, because the same bug appears if you watch the title screen animation. I've attached a video of the issue below.

Thanks in advance for any help!

https://drive.google.com/open?id=1kontv ... c1vMkoOiKk


Top
 Profile  
 
PostPosted: Tue Sep 04, 2018 11:07 am 
Offline
User avatar

Joined: Mon Dec 29, 2014 1:46 pm
Posts: 822
Location: New York, NY
Does your emulator pass the CPU test ROMs?


Top
 Profile  
 
PostPosted: Tue Sep 04, 2018 11:17 am 
Offline

Joined: Tue Sep 04, 2018 10:07 am
Posts: 3
Apparently not. Nestest works completely, but the next I tried failed (branch_timing_tests). I'll work on getting those to run correctly for now. Is there a best order in which to tackle these tests?

Thanks!


Top
 Profile  
 
PostPosted: Tue Sep 04, 2018 11:51 am 
Offline
User avatar

Joined: Sun Sep 19, 2004 9:28 pm
Posts: 3682
Location: Mountain View, CA
Random brain dump:

Problems of this nature are usually incorrect emulation of 6502 opcodes, particularly CPU flags. Bad $4016/4017 implementation is certainly a possible too, but it's always best to rule out CPU instruction issues *first*.

That said, anything is possible, so sure, it could be your $4016/4017 emulation. If you could explain how you implemented it (read: don't dump code at us, or tell us to read your code as an explici answer), that would be good. Having code to reference is helpful, but the only one who truly knows it and what all your variables are for/do/etc. is you. Sometimes explaining something to others helps you work through what could be a mistake, inducing self-realisation of the problem.

Also, if SMB is the only game you're using to test, I suggest using something else. Try some mapper 0 (NROM) games for starters, first-gen titles (Donkey Kong, Mario Bros, Clu Clu Land, Ice Hockey, etc.). SMB is a particularly "rough" game to start with. If you find similarly odd quirks in other games relating to joypad input of this nature, then that may help you.


Top
 Profile  
 
PostPosted: Fri Sep 07, 2018 7:38 am 
Offline

Joined: Tue Sep 04, 2018 10:07 am
Posts: 3
Fixed it! There was a bug with how I was setting the negative flag. Blargg's instr_test_v5 was a big help tracking this down.

With that, all the NROM games I tested work, as well as a number of MMC1. Woohoo!


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: Google [Bot] and 3 guests


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