Each time TextMode is called, the current video mode is stored in LastMode.
LastMode: word;
LastMode is initialized at program startup to the then-active video mode.
Crt Overview, TextMode