home *** CD-ROM | disk | FTP | other *** search
/ PDA Software Library / pdasoftwarelib.iso / PSION / 1997 / 915.ZIP / IRCHAT.OPL next >
Encoding:
Text File  |  1997-01-28  |  1.2 KB  |  68 lines

  1. rem irchat.opl - Martin Roberts 1997
  2. rem Modified/improved by Tim Wilde
  3. rem gwi1@cableol.co.uk
  4. PROC irchat:
  5.     global rbuf$(255),tbuf$(255),dbuf$(255)
  6.     global stat%,len%,tname%,name$(255)
  7.     local k%
  8.     dinit "What do you want to be sent as your name?"
  9.     dedit name$,"Name:",20
  10.     dialog
  11.     stat%=-48 rem to start first I/O req
  12.     lopen "sir:i" rem open IrDA port
  13.     print "IRCHAT - Psion-X to exit."
  14.     print "Type the string to send, then press (Enter)"
  15.     cursor on
  16.     tname%=1
  17.     while 1
  18.         if checkrx%: >= 0
  19.             style 4
  20.             print rbuf$
  21.             tname%=1
  22.             style 01
  23.         endif
  24.         k%=key
  25.         if k%<>0
  26.             if k%=$200+%x
  27.                 break
  28.             elseif (k%=13) or (len(tbuf$)>254)
  29.                 irsend:
  30.                 print ""
  31.             else
  32.                 tbuf$=tbuf$+chr$(k%)
  33.                 print chr$(k%);
  34.             endif
  35.         endif
  36.     endwh
  37.     lclose
  38. ENDP
  39.  
  40. PROC irsend:
  41.     local lenname%
  42.     lprint chr$($c0); rem BOF
  43.     if tname%=1
  44.         lprint name$
  45.         lenname%=len(name$)
  46.         while lenname%
  47.             lprint "-";
  48.             lenname%=lenname%-1
  49.         endwh
  50.         tname%=0
  51.     endif
  52.     lprint tbuf$;
  53.     lprint chr$($c1); rem EOF
  54.     tbuf$=""
  55. ENDP
  56.  
  57. PROC checkrx%:
  58.     local lstat%,prbuf%
  59.     lstat% = stat%
  60.     if lstat% <> -46 rem I/O pending
  61.         prbuf%=addr(rbuf$)
  62.         pokeb prbuf%,len%
  63.         dbuf$=rbuf$
  64.         ioa(-1,1,stat%,#uadd(prbuf%,1),len%)
  65.     endif
  66.     return lstat%
  67. ENDP
  68.