home *** CD-ROM | disk | FTP | other *** search
/ PDA Software Library / pdasoftwarelib.iso / PSION / 1997 / 1997.ZIP / 874.opl < prev    next >
Encoding:
Text File  |  1997-01-13  |  861 b   |  50 lines

  1. rem irchat.opl - Martin Roberts 1997
  2. proc irchat:
  3.     global rbuf$(255),tbuf$(255),dbuf$(255)
  4.     global stat%,len%
  5.     local k%
  6.     stat%=-48 rem to start first I/O req
  7.     lopen "sir:i" rem open IrDA port
  8.     print "IRCHAT - psion-x to exit."
  9.     while 1
  10.         if checkrx%: >= 0
  11.             style 4
  12.             print rbuf$
  13.             style 0
  14.         endif
  15.         k%=key
  16.         if k%<>0
  17.             if k%=$200+%x
  18.                 break
  19.             endif
  20.             if (k%=13) or (len(tbuf$)>254)
  21.                 irsend:
  22.                 print ""
  23.             else
  24.                 tbuf$=tbuf$+chr$(k%)
  25.                 print chr$(k%);
  26.             endif
  27.         endif
  28.     endwh
  29.     lclose
  30. endp
  31.  
  32. proc irsend:
  33.     lprint chr$($c0); rem BOF
  34.     lprint tbuf$;
  35.     lprint chr$($c1); rem EOF
  36.     tbuf$=""
  37. endp
  38.  
  39. proc checkrx%:
  40.     local lstat%,prbuf%
  41.     lstat% = stat%
  42.     if lstat% <> -46 rem I/O pending
  43.         prbuf%=addr(rbuf$)
  44.         pokeb prbuf%,len%
  45.         dbuf$=rbuf$
  46.         ioa(-1,1,stat%,#uadd(prbuf%,1),len%)
  47.     endif
  48.     return lstat%
  49. endp
  50.