decrazyo / lng-fds

Famicom Disk System port of LUnix Next Generation
GNU General Public License v2.0
231 stars 4 forks source link

Real hardware US NTSC 60hz NES detected as PAL 50hz #3

Open famiclone6502 opened 7 months ago

famiclone6502 commented 7 months ago

On real hardware the startup message states the machine is detected as PAL 50hz, when it is actually an NTSC 60hz NES.

decrazyo commented 7 months ago

I updated the system detection logic so it will retry detection a few times if it fails. If all detection attempts fail then it will default to NTSC@60hz since that's more likely than PAL@50hz. I'm not sure if that will solve the issue but it's worth a try.

famiclone6502 commented 7 months ago

Tried the latest version, it still says PAL 50hz.

TakuikaNinja commented 7 months ago

The Famicom (and FDS by extension) is always NTSC@60Hz. There's no need for region detection in this case, not to mention the fact that the FDS BIOS has its own reset handler containing the vblank wait loops.

decrazyo commented 7 months ago

@TakuikaNinja True but I was trying to support the unlikely situation where someone had jerry-rigged an FDS to a 50Hz console, assuming that such a thing can be done, as well as any random Famiclones that might run this.

I implemented the detection method that was outlined in this forum post which works perfectly on emulators and my NTSC NES. https://github.com/decrazyo/lng-fds/blob/d31693ae76a9f8c881198539b369f08e0e3df906/kernel/nintendo/reset.s#L17-L61 I may need to use this technique on a new project I'm working on so it's worthwhile to me to figure out why this fails on a Famicom (or possibly just fails on a Famicom with Disk System? idk.)

TakuikaNinja commented 6 months ago

The first part of the BIOS reset handler (vblank wait loops, register init) always runs before the disk game's reset vector. I believe that's throwing off the timing here.