It is currently Sat Jun 23, 2018 8:34 am

All times are UTC - 7 hours

Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Thu May 31, 2018 9:56 pm 

Joined: Thu May 31, 2018 9:18 pm
Posts: 1
Hi all - yes, yet another beginner emu in progress.

I'm comparing my execution against FCEUX trace logs, so that I can be sure I don't have any bugs. I'm using the SMB1 NTSC rom. My problem is where the vblank flag changes (yes, this same old issue..)

I have all the cycle numbers, instruction numbers, registers, flags, and instruction opcode numbers matching the FCEUX trace logger output for the initial 6 instructions and the alternating LDA $2002/BPL $800A all the way up until a flag change happens.

I know vblank flag should be set at scanline 241 / dot 1. To me that first hits at total ppu dots in frame == 82181, and cpu tick 27394/instruction number 7828. I believe that one is skipped.

The next scanline 241/ dot 1 hits at the same ppu dots # in the frame, cpu tick 57174/instruction number 16337.

Therefore the trace log line of instruction 16339 is the first one where the A register changes to 90, e.g. the 0x80 flag is read in. That is my first log diff with FCEUX trace log.

In FCEUX's log, that doesn't happen until the line on cpu tick 59679 / instruction 17053 - so 714 instructions later.

I correctly have a total of 89342 dots per frame.

There's only a handful of instructions running up to that point and the cycle numbers/instruction numbers match, so there must be a bug somehow in the timing but I can't imagine what it would be given there's not much going on.

If anyone can check the math in their own project, I'd appreciate it - I have tried digging around other emulators to breakpoint where this would happen and look at the numbers, but I'm trying to stick with one I can compare trace logs with and I find FCEUX very hard to figure out the code for.

Thanks for your help..

PostPosted: Fri Jun 01, 2018 6:41 pm 

Joined: Sun Feb 07, 2016 6:16 pm
Posts: 420
relaxok wrote:
In FCEUX's log, that doesn't happen until the line on cpu tick 59679 / instruction 17053 - so 714 instructions later.
FCEUX is probably not the best emulator to be using to compare trace logs when it comes to the PPU's timing vs CPU. It's great for many things, but you shouldn't use it as your reference if you're trying to match the exact timings of the NES.

Mesen & Nintendulator both reach the instruction after the 2nd $2002 read loop ("8014 $A0 $FE LDY #$FE") at almost the same time (~57174 cpu cycles), which is essentially what you said you were expecting it to be. Bizhawk also has a trace logger (iirc) and should be essentially as accurate as those two, too.

Mesen's trace logger allows you to customize the trace log's output to be more or less whatever you need it to be, so that might help you if your trace log format is similar to FCEUX's, for example. This is a new feature that I just added, so you'll need to download this build if you want to try it out. If you're trying to debug your emulator, Mesen's debugging tools should be pretty useful in general, so you may want to take a look, if you have not yet. (Disclaimer: I'm Mesen's author, but I'm definitely not getting any money out of this :p)

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 7 hours

Who is online

Users browsing this forum: No registered users and 4 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