Sitting at the DOS prompt with just a cursor blinking at you has never been
very fun. Although EBL-Plus allows you to improve the user interface an
order of magnititude, it would still be nice to give the user other
information while he is waiting such as the time of day or date. Credit
goes to Jim Fouch for solving this problem with a recent piece of code he
uploaded to the BAT-BBS. In simple menus, Jim could have waited for
a keypress by using the INKEY command. However, he enhanced this technique
by combining a simple loop with the KEYPRESSED() function.
Repeat Until Keypressed() |* Wait for a key End Repeat %9 = Charin() |* Get the key that was pressed Goto -%9 |* and go to appropriate routine
The GOTO -%9 command is a multi-way branch that goes to a label who's name is the key that was pressed. For example, the code after a label "-ESC" would be executed if you press the ESC key, and so forth.
Then Jim enhanced this simple loop by including the things that he wanted to update on the screen while the user was waiting, in this case the time of day.
Repeat Until Keypressed() |* While Waiting for a key
Locate 69 3 |* At upper right...
Type Left(Time(N),8) |* show the time of day
End Repeat
%9 = Charin() |* Get the key that was pressed
Goto -%9 |* and go to appropriate routine
Then came the delema. Once Jim improved that little cursor, he needed to shut it off. Why? Because when many things are being updated on the screen, the cursor will move to each place a change is made. In the above example, cursor moves to x/y and x/y. The net effect is like snow as the cursor moves around. Very distracting indeed. But since EBL-Plus didn't have a "CURSOR OFF" command, Jim came to us through the BAT-BBS to look for a solution.
Since EBL-Plus didn't have this command, the easiest way to turn off the cursor was to use the INT86() function. This function is very versitle, and is also dangerious. If you do not understand how to program using BIOS or DOS, then do not plug in random numbers into this function. However, it can also be a blessing in some cases, doing things that you didn't expect it to be capable of.
By looking at the IBM BIOS Technical Reference Manual in the video BIOS section (Interrupt 10h) we can find out how to control the cursor. The following values will allow us to turn the cursor on and off safely using the INT86() function.
CURSOR ON: INT86(10,100,0,0708)
CURSOR OFF: INT86(10,100,0,1000)
Now that we can turn the cursor on and off, Jim added this to his routine as follows:
Int86(10,100,0,1000) |* Cursor off
Repeat Until Keypressed() |* While Waiting for a key
Locate 69 3 |* At upper right...
Type Left(Time(N),8) |* show the time of day
End Repeat
Int86(10,100,0,0708) |* Cursor on
%9 = Charin() |* Get the key that was pressed
Goto -%9 |* and go to appropriate routine
If you have a favorite or interesting way to use INT86(), please let us know so we can share it with others. We are always interested in clever solutions to problems that you may have.