When all that is required is for the program to wait until
Enter or Newline is pressed, you only need the following line&nsbp:
10 IF INP(0) AND 2 THEN 10
This will loop until Enter is pressed.
… and a naughty way.
The Basic interpreter must be modified if a genuine INKEY
function is required. The Microsoft Basic that the Nascom uses
was adapted from a program written in 8080
machine code. The
8080 doesn’t have an ‘IN r,(C)’ instruction, so a small skeleton
subroutine is used instead. The subroutine looks like this:
This resides in RAM, as can be seen from the addresses. If
DBH is changed to DFH, a Nas-Sys RST SCAL will be executed. The
monitor subroutine called being dependent on the number passed
by the INP() function. Any subroutine that doesn’t require an
argument can be used. The useful routines and their numbers
are:
Example
Line 30 is required when using SCAL IN as this routine returns
values greater than 128 when no key is pressed.
Well, you now have no excuse for ever being a USR again! The
two ways of detecting a key press from Basic are so incredibly
obvious, I can’t imagine why no one else has ever thought of
then before!