home *** CD-ROM | disk | FTP | other *** search
- rem irchat.opl - Martin Roberts 1997
- proc irchat:
- global rbuf$(255),tbuf$(255),dbuf$(255)
- global stat%,len%
- local k%
- stat%=-48 rem to start first I/O req
- lopen "sir:i" rem open IrDA port
- print "IRCHAT - psion-x to exit."
- while 1
- if checkrx%: >= 0
- style 4
- print rbuf$
- style 0
- endif
- k%=key
- if k%<>0
- if k%=$200+%x
- break
- endif
- if (k%=13) or (len(tbuf$)>254)
- irsend:
- print ""
- else
- tbuf$=tbuf$+chr$(k%)
- print chr$(k%);
- endif
- endif
- endwh
- lclose
- endp
-
- proc irsend:
- lprint chr$($c0); rem BOF
- lprint tbuf$;
- lprint chr$($c1); rem EOF
- tbuf$=""
- endp
-
- proc checkrx%:
- local lstat%,prbuf%
- lstat% = stat%
- if lstat% <> -46 rem I/O pending
- prbuf%=addr(rbuf$)
- pokeb prbuf%,len%
- dbuf$=rbuf$
- ioa(-1,1,stat%,#uadd(prbuf%,1),len%)
- endif
- return lstat%
- endp
-