version 1.1, 2006/03/26 22:54:19
|
version 1.2, 2006/04/01 17:30:32
|
Line 81 Create file-buf $40 allot
|
Line 81 Create file-buf $40 allot
|
Variable file-len |
Variable file-len |
|
|
0 Value term |
0 Value term |
|
0 Value term-fd |
0 Value termfile |
0 Value termfile |
Variable term-state |
Variable term-state |
|
Variable progress-state |
|
|
: term-end ( -- ) |
: term-end ( -- ) |
4 term emit-file throw |
4 term emit-file throw |
Line 95 Variable term-state
|
Line 97 Variable term-state
|
: end-include ( -- ) termfile 0= IF EXIT THEN |
: end-include ( -- ) termfile 0= IF EXIT THEN |
termfile close-file throw 0 to termfile ; |
termfile close-file throw 0 to termfile ; |
|
|
|
Create progress s" /-\|" here over allot swap move |
|
|
: term-type ( addr u -- ) |
: term-type ( addr u -- ) |
bounds ?DO |
bounds ?DO |
I c@ CASE |
I c@ CASE |
Line 102 Variable term-state
|
Line 106 Variable term-state
|
3 OF |
3 OF |
termfile IF |
termfile IF |
file-buf $40 termfile read-line throw |
file-buf $40 termfile read-line throw |
|
progress progress-state @ + c@ emit #bs emit |
|
progress-state @ 1+ 3 and progress-state ! |
ELSE |
ELSE |
0 0 |
0 0 |
THEN |
THEN |
Line 115 Variable term-state
|
Line 121 Variable term-state
|
5 OF abort ENDOF |
5 OF abort ENDOF |
term-state @ CASE |
term-state @ CASE |
0 OF emit ENDOF |
0 OF emit ENDOF |
1 OF $3F min file-len ! 2 term-state ! ENDOF |
1 OF $20 - $3F min file-len ! 2 term-state ! ENDOF |
2 - file-buf + c! 1 term-state +! |
2 - file-buf + c! 1 term-state +! |
term-state @ file-len @ 2 + = IF |
term-state @ file-len @ 2 + = IF |
open-include term-state off THEN |
open-include term-state off THEN |
Line 123 Variable term-state
|
Line 129 Variable term-state
|
0 ENDCASE |
0 ENDCASE |
LOOP ; |
LOOP ; |
|
|
: terminal ( "name" -- ) cr |
: term-loop ( -- ) |
parse-name r/w open-file throw dup to term dup >fd { term-fd } |
|
B38400 term-fd set-baud |
|
BEGIN |
BEGIN |
pad term-fd check-read term read-file throw pad swap term-type |
pad term-fd check-read term read-file throw pad swap term-type |
key? IF key term emit-file throw term flush-file throw |
key? IF key term emit-file throw term flush-file throw |
ELSE &10 ms THEN |
ELSE &10 ms THEN |
AGAIN ; |
AGAIN ; |
|
: terminal ( "name" -- ) cr |
|
parse-name r/w open-file throw dup to term dup >fd to term-fd |
|
B38400 term-fd set-baud ['] term-loop catch |
|
dup -1 = IF drop EXIT THEN throw ; |
|
|
|
|
|
|
|
script? [IF] terminal /dev/ttyUSB0 bye [THEN] |
|
|