[comp.sys.misc] keyboard ports

pham@PX3.STFX.CA (Hai Pham) (02/17/91)

>A friend of mine has a CP/M system made by Morrow.  An MBASIC program we
>would like to use makes use of the WAIT command, apparently checking the
>status of the keyboard and reading it if there is something to read.
>This isn't working: it doesn't wait for the user to type things, but goes
>ahead as if he did.  The documentation that came with the program says
>that the data port and status port numbers probably have to be changed.
>But we looked through all the documentation that came with the machine,
>and can't find anything about port numbers.  Is there a way to find out
>this information from the system or perhaps by looking inside the CPU
>box?

Bob,
The wait command wants a memory address where it can sit and wait for
the correct bit change to happen, so looking inside the CPU box won't
do you any good.  To find the right address location, you'll have to have
a memory map of the machine - you can usually find fairly good memory maps
in the reference guide that usually comes with early (pre 87 or so) micros.
I've never programed a CP/M machine, so I'm of no use to you here.
However, if all else fails, you can try a little trick I picked up while
struggling with Commodore's infamous v2.0 & v4.0 BASIC to have the computer
wait for a key press without all the fuss with WAIT or PEEKS:

Currently your WAIT sequence probably looks something like this:
...
100 wait 638,1: REM assuming that 638 is the keyboard register keeping
                    track of whether a key has been pressed or not.
                    (this could also be the keyboard buffer char count.)
...
You would replace this line with this:  
...
100 get a$: if a$ = "" then 100: REM wait for a non-null key press and
                                     assign it to a$.
...
              (I'm assuming here that your version of BASIC does not stop
               and wait for a key press before it assigns a value to a$
               when you use GET.  If it does stop, then just remove
               the IF...THEN sequence after the GET.)

I would also look around to see if MBASIC has a command that waits for
a key press.  For example, the Commodore 128 has a command, INKEY, that
sits and waits for a key press, then assigns the key press to a string.

Hope this helps.  Please Bug me if I haven't been as clear as I should
have been.

Best of luck,
hai.

Email: pham@phoenix.stfx.ca