;***************************************************************************
;
;                                INKEY.M68
;
;
;                      Written By: James A. Jarboe IV
;                             1401 19th Street
;                           Huntsville, TX 77340
;                               409-295-5767
;
;                                 11/20/85
;
;****************************************************************************
; Description: gets a character from terminal if it is there
;              if no character then it returns to basic
;
; Type:        XCALL INKEY,STRING
;              Can take up to 1 variable in String and return character
;              input form keyboard.
; Example:
; 10 MAP1 STRING,S,1
; 20 TOP:
; 30 XCALL INKEY,STRING
; 40 IF STRING ="" THEN GOTO TOP
; 50 ? "WE HAVE ";STRING;" AS INPUT CHARACTER"
; 60 ? "IT'S VALUE IS ";ASC(STRING)
; 70 GOTO TOP

       SEARCH  SYS
       SEARCH  SYSSYM
       OBJNAM  .SBR


ASECT
=0
P.TOP:  BLKW    1
A.TYP:  BLKW    1
A.ADR:  BLKL    1
A.SIZ:  BLKL    1

       PSECT

       PHDR    -1,0,PH$REE!PH$REU
;
; Check for variable & set up registers
;

       CMMW    P.TOP(A3),#1            ; 1 variable
       JNE     BADPARM                 ; no then return
       MOV     A.ADR(A3),A0            ; A0 gets to be pointer
BEGIN:
       CTRLC   BADPARM                 ; exit on control c
       JOBIDX  A4                      ; job index
       MOV     JOBTRM(A4),A2
       ORW     #3,@A2
GETIT:
       TCKI                            ; is character there
       BNE     BADPARM                 ; no get ready to go
       KBD                             ; Yes then get it
       MOVB    D1,@A0                  ; put in variable
       RTN                             ;[101] : go home
BADPARM:
       CLRB    @A0                     ;[101] : STRING=""
       RTN                             ; go home
END