The other day, I was caught short for something to read
while trying to beat my Rubics cube record of 45 minutes. So,
while manipulating my cube with the right hand, I picked up the
nearest thing handy... Can you guess what it was ? No, it was
the Basic manual. I was suprised to find that basic provides no
less than 18 error messages. Of course, I had no seen any of
these in years, but I was suprised to find a function that I had
almost forgotten about! For some reason, I couldn’t remember
ever using it – and I doubt if anyone else has ever used POS
POS() returns the ‘x’ position of the printhead and because
printers don’t usually backspace or have full cursor movement,
POS() will not necessarily return an ‘x’ value corresponding to
the cursor position on the screen. Cursor and printhead are
independent creatures. This can cause problems if POS() is used
in input routines, but POS can be useful in output routines:
Run it, break when you have a screenful of data and enter
each DATA line displayed. Run it again if there is more data to
follow. Don’t anyone mention USR!
Doctor Knowall’s Definitive Guide to INKEY$ without USRs.
USRs are people who run versions of Pascal written in Forth,
which in turn are written in Basic! In short, USRs don’t like
Basic. For the benefit of purists struggling along without an
INKEY$ function, T plunge into the depths of my immense pool of
knowledge ... and find not one, but two ways of detecting single
key presses from Basic.
The Quick and VERY Simple way –
If you don’t mind using a limited range of keys, the
keyboard can be read directly from port 0 using the INP()
function. Because of timing, only the first row of keys can be
read this way. The following program shows which keys are used
and the bits that are assigned to then.