home *** CD-ROM | disk | FTP | other *** search
- \ < Virtual terminal program.
- \ Edit line-modes to reflect your serial line configuration.
- \
- \ line-modes initializes the serial line.
- \ connect go into virtual terminal mode.
- \
- \ > Type ESC CR to get back to Forth.
-
- only forth also definitions
- \ needs modem fload ??environment??\modem.fth before this
-
- only forth also modem also definitions decimal
-
- 27 constant escchar
- 2 constant connect#channel
- variable help? help? on
-
- : >modem ( -- )
- help? @ if ??cr ." ascii terminal connection ... ESC quits" cr then
- multi
- begin begin key dup escchar <>
- while m-emit
- repeat drop
- help? @ if ??cr ." CR quits terminal connection" cr then
- key upc
- case
- carret of ??cr exit endof
- dup m-emit
- endcase
- again ;
- : ascii-emit ( char -- )
- single dup bl <
- if case
- d# 00 of endof \ nothing
- d# 07 of beep endof \ bell
- d# 08 of 1 backspaces endof \ bs
- d# 09 of 1 .tab endof \ tab
- d# 10 of down endof \ lf
- d# 11 of ??cr cr endof \ vt
- d# 12 of erase-screen endof \ ff
- d# 13 of at-xy? nip 0 swap at-xy endof \ cr
- h# 11 of beep endof
- h# 18 of delete-line endof \ can
- dup dark [char] @ + emit light
- endcase
- else emit
- then multi ;
-
- \ Listen to the modem and send the characters to the display
- forth definitions
- task: listener
- : modem> ( -- )
- listener activate multi
- connect#channel use-channel
- begin m-key ascii-emit again ;
- : line-modes ( -- )
- 57600-baud 1-stop-bit 8-bits no-parity rts/cts set-line ;
-
- defer log-in ' noop is log-in
- : connect ( -- )
- connect#channel m-open
- multi line-modes modem>
- log-in >modem
- listener sleep m-close ;
- : (test
- p" ATZ0 M0 V1 X5 &V1" m-". m-cr
- p" OK" d# 4000 string-wait if beep then ;
-