Each time TextMode is called, the current video mode is stored in LastMode. Also LastMode is initialized at program startup to the then-active video mode.