Example 1b: Three new issues are examined in this improved version of example 1. First instead of having the user supply the desired mode as an argument in the command line, we query the BETATRON vesa system to find out what modes are supported. To do that we first have to call pl_initvesa() and then pl_getmodes(). pl_getmodes() fills an array with the supported modes and returns the number of records in this array. So we let the user choose the mode. The second thing is the call of pl_saveVESAstate() which saves the hardware state of the VESA mode in an internal buffer so it can be later restored by pl_restoreVESAstate(). pl_saveVESAstate() must be called after the desired mode has been set with TOworld::setmode(). There are several cases (especially when your program is running under windows 95 in a dos box) in which the video mode and the view is corrupted. You should always give the user the opportunity to restore the view and the VESA state. In this example the user can do so by pressing 'R'. Take a look at exitaction(). Finally we use the hardware keyboard handler of BETATRON which can detect multiple key presses. We set up the keyboard handler by calling pl_installkeys() and then use pl_testkey() to check if a key is down. Please not that when using the keyboard handler of BETATRON you can not use standard BIOS functions to get input from the keyboard.