[Apparently the hardware was modified slightly with an extra wire/signal for vertical retrace detection, and this modification is supported in the emulator as well.]
The version for the Model 3 runs on stock hardware as it shipped in 1980. It has a interrupt that fires every second vblank. Thus it is possible to get in sync with the beam but to remain in sync the program must keep track of every cycle it executes.
The Model 1 version does require a hardware mod to get access to vsync.
I wrote those programs and couldn't have done it without something of a virtuous circle of trying stuff on the real hardware and then improving the emulator to more accurately model the hardware and so on.
http://48k.ca/128x192.html
http://48k.ca/ball.html
https://github.com/hallorant/bigmit/tree/master/ta19demo
[Apparently the hardware was modified slightly with an extra wire/signal for vertical retrace detection, and this modification is supported in the emulator as well.]