hi! i have a doubt in how to synchronize my emulator with VBlank.
i know there's an Allegro function called "vsync()" that automatically waits for VBlank, but as read it's very reliable. so how i know when vblank is happening? do i have to manually set $2002.7 to 1 when VBlank is happening?
thanks in advance for any reply
VBlank synchronization?
Moderator: Moderators
The refresh rate of your computer (which is what the Allegro functions are based on, I assume) has nothing to do with the refresh rate of the emulated machine (the NES).
You know when the NES VBlank happens when the time of a frame has passed. Your emulator has to keep track of time in the form of PPU cycles. Since each frame has a known number of scanlines, and each scanline has a known number of cycles, you'll know when a frame is complete, and at that time you set the VBlank flag.
You know when the NES VBlank happens when the time of a frame has passed. Your emulator has to keep track of time in the form of PPU cycles. Since each frame has a known number of scanlines, and each scanline has a known number of cycles, you'll know when a frame is complete, and at that time you set the VBlank flag.