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

  1. ; 16 jly 85 esj converted
  2. ;;;;;;;;;;;;;;;;;;              KGETLIN             ;;;;;;;;;;;;;;;;;;;;
  3.       E'F A:S(NWLS)
  4.       E'O KGETLIN.(BUFFER,UNIT)
  5.  
  6. ;     read a packet with a SOH in it and DON'T wait for the prompt
  7. ;     before returning it
  8.  
  9. ;     BUFFER is an integer array that will hold the incoming packet
  10. ;     UNIT tells this routine which device to read the packet from
  11.  
  12. /INCLUDE BYU.PROG.KERMIT.SYM.EQU.KERCOM
  13. /INCLUDE BYU.PROG.KERMIT.SYM.EQU.KERDEF
  14.  
  15.       I'R BUFFER(*),STATUS,GASOH,COUNT,IBYTE
  16.       I'R X,LCLSTATE
  17.  
  18. ;      E'E TYPEHEX.(.ADDR.BUFFER)
  19.       STATUS=YES
  20.       GASOH=NO                          ;we have not gotten a packet yet
  21.       COUNT=0
  22.       W'E (STATUS.EQ.YES)
  23.           IBYTE=0
  24.           X=TGETCH.(IBYTE,UNIT)            ;read a byte from the I/O port
  25.           W'R (IBYTE.EQ.MYEOL .AND. GASOH .E. YES) ;we got the required MYEOL
  26.              STATUS=NO
  27.           O'R (IBYTE .E. SOH)
  28.              BUFFER(0)=IBYTE        ;store the SOH into buffer
  29.              COUNT = 1              ; rest buffer pointer to first soh
  30.              GASOH = YES
  31.           O'R (GASOH .E. YES)       ; get char into buffer iff gasoh=yes
  32.               BUFFER(COUNT)=IBYTE       ;it is not MYEOL, but another
  33.               COUNT=COUNT+1             ;data of the incoming packet
  34.           E'L                         ;store it and increment pointer
  35.       E'W
  36.       BUFFER(COUNT)=EOS                 ;add an EOS into end of buffer
  37.       LCLSTATE=OK
  38. ;      E'E TYPOUT.(2,$KL$)
  39. ;      E'E TYPEHEX.(COUNT)
  40.  ;     E'E TYPEHEX.(.ADDR.(BUFFER(COUNT)))
  41.   ;    E'E STACKDMP.
  42.       F'N LCLSTATE
  43.       E'N
  44.