home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.uni-stuttgart.de/pub/systems/acorn/
/
Acorn.tar
/
Acorn
/
acornet
/
dev
/
forth
/
forthmacs
/
serial
/
serial~
/
!Forthmacs.lib.modem+
< prev
next >
Wrap
Text File
|
1995-01-26
|
1KB
|
35 lines
\ portable file definining modem extensions HS 01.07.94
\needs modem cr .( Load xxx.modem before this! ) abort
only forth also modem also definitions decimal
h# 10 constant buff-len
create m-in-buffer buff-len allot
create modem-string buff-len 4 + allot
variable found?
variable finding?
create 11-command h# 20 allot
: m-cr carret m-emit ;
: m-". count m-type ; ( str -- ) \ write a line to modem
: remember-m-key ( key -- key )
m-in-buffer dup 1+ swap h# 10 cmove
dup m-in-buffer [ buff-len 1- ] literal + c! ;
: received-string? ( str -- flag )
count m-in-buffer buff-len + ( addr1 count end-addr )
over - swap comp 0= ;
: string-found? ( key -- key ) \ set flag
modem-string received-string? if found? on then ;
\ redefinition of m-key
: m-key ( -- char )
m-key remember-m-key
finding? @ if string-found? then ;
\ wait for a string from the modem
: string-wait ( str msec -- true ) \ waits msec for string str to appear
finding? on found? off swap modem-string "copy
m-in-buffer h# 10 erase
0 ?do 100 ms found? @ if leave then 100 +loop
found? @ finding? off ;
only forth also definitions