home *** CD-ROM | disk | FTP | other *** search
- \ 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?
-
- : m-cr carret m-emit ;
- : m-". count m-type ; ( str -- ) \ write a line to modem
- : remember-m-key ( key -- key )
- m-in-buffer dup char+ 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
-