"Racing the beam" — omg I know exactly what you mean. We used to set the beam to different color at the beginning and the end of our vsync'd routine to figure out how many scan lines worth of CPU time per frame we could afford to use. I remember the address $dff180 for this purpose (color palette 0, which would always show on the edges of the screen outside of the bitmapped area). We didn't have the Internet to teach us that trick either, all word of mouth! Didn't know there were people still trying to squeeze more out of that chipset nowadays.