fspinolo wrote:First of all, why does the stack pointer start at FD instead of FF in this log? Is there some execution that happens before this log starts?
Reset on a 6502 always subtracts 3 from the stack pointer. If the emulator made the arbitrary choice to initialize the stack pointer with $00, subtracting 3 gives $FD.
Second, (and probably related) why do we start at scanline 241?
Arbitrary choice, possibly associated with the fact that the PPU asserts the NMI signal at the start of line 241. (NMI tells the CPU that the
vertical blanking interval, or vblank, has begun.) But for validation of a 6502 emulator's timing against nestest.log, all you need to worry about is that a change from one scanline to the next is associated with an expected subtraction of 341 (the length of a scanline including both active picture and horizontal blanking) from CYC.
Why does the cycle count reset every time the scanline count updates?
Because it counts PPU cycles since the left side of the screen. There are 341 PPU cycles per scanline and 3 PPU cycles for each CPU cycle.*
If my questions have been answered elsewhere, I have been unable to find the answers using the forum search tool.
There's also
a wiki. Have you looked through there?
* Exceptions: On NTSC systems, when rendering is turned on, every other frame is shorter by one dot to realign the color subcarrier phase. And on PAL NES (but not PAL famiclones), there are 3.2 PPU cycles per CPU cycle. (Source)