home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / computervision / kermit.ibmgetln < prev    next >
Text File  |  2020-01-01  |  2KB  |  43 lines

  1. ;;;;;;;;;;;;;;;;            IBMGETLN           ;;;;;;;;;;;;;;;;;;;;;;;;
  2.       E'F A:S(NWLS)
  3.       E'O IBMGETLN.(BUFFER,CH)
  4.  
  5. ;     read a packet with a SOH in it and wait for the prompt
  6. ;     before returning it
  7.  
  8. ;     BUFFER is an integer array that will hold the incoming packet
  9. ;     CH tells this routine which channel to read the packet from
  10.  
  11. /INCLUDE BYU.PROG.KERMIT.SYM.EQU.KERCOM
  12. /INCLUDE BYU.PROG.KERMIT.SYM.EQU.KERDEF
  13.  
  14.       I'R BUFFER(132),CH,STATUS,GASOH,COUNT,T,IBYTE
  15.       I'R X
  16.  
  17.       STATUS=YES
  18.       GASOH=NO                          ;we have not gotten a packet yet
  19.       COUNT=1
  20.       W'E (STATUS.EQ.YES)
  21.           W'E (GASOH.EQ.NO)          ;keep reading one byte at a tim
  22.             IBYTE=0                     ;the I/O port until you see the
  23.             X=TGETCH.(IBYTE,CH)          ;character , EOF is not expected
  24.             W'R (IBYTE.EQ.SOH)
  25.                GASOH=YES                ;I got the SOH
  26.                BUFFER(COUNT)=IBYTE      ;store the SOH into buffer
  27.                COUNT=COUNT+1            ;increment the buffer pointer
  28.             E'L
  29.           E'W
  30.           IBYTE=0
  31.           X=TGETCH.(IBYTE,CH)            ;read a byte from the I/O port
  32.           W'R (IBYTE.EQ.PROMPT)       ; we got the prompt
  33.              STATUS=NO
  34.           O'E
  35.               BUFFER(COUNT)=IBYTE       ;it is not a prompt, but another
  36.               COUNT=COUNT+1             ;data of the incoming packet
  37.           E'L                         ;store it and increment pointer
  38.       E'W
  39.       BUFFER(COUNT)=EOS                 ;add an EOS into end of buffer
  40.       LCLSTATE=OK
  41.       F'N LCLSTATE
  42.       E'N
  43.