I'm working in TASM 16-bit Assembly as an education course, and I'm making a game engine.
I'm using VGA 13h (320x200 256-colors) with DOSBox, and I can sometimes see the screen tearing, meaning my video memory is updating while my screen (which is 60Hrz) is updating.
For this reason, I would like to implement VSync, meaning I wait until the screen retraces and only then recalculate the screen and update video memory (On a 60Hrz screen, that gives me about 1,000 / 60 = 18ms to update the screen).
My question is, how can I, using assembly synchronize with when the screen updates so I won't have situations when I render at the wrong time?