Permalink
Browse files

Fix timeout words

  • Loading branch information...
1 parent 5f71fdd commit c5869ba0368d05c509c4c0be9f5e407b6ba1d9e1 @ekoeppen committed May 29, 2012
Showing with 14 additions and 7 deletions.
  1. +1 −0 generic/CoreForth.s
  2. +4 −4 generic/multitasking.ft
  3. +9 −3 lm3s811/precompiled_words.s
View
1 generic/CoreForth.s
@@ -1664,6 +1664,7 @@ print_xt_suffix:
@ ---------------------------------------------------------------------
@ -- Main task user variables -----------------------------------------
+ defvar "TASK0WAKE-AT", TASKZWAKE_AT
defvar "TASK0UTOS", TASKZUTOS
defvar "TASK0STATUS", TASKZSTATUS
defvar "TASK0", TASKZ, 0
View
8 generic/multitasking.ft
@@ -6,6 +6,10 @@ CELL - DUP USER TOS \ task's top of stack when switching
CELL - DUP USER WAKE-AT \ ticks when to wake the task regardless
NEGATE CONSTANT USER# \ save amount of allocated user variable space
+: TIMEOUT! TICKS @ + WAKE-AT ! ;
+: TIMEOUT@ TICKS @ WAKE-AT @ - ;
+: TIMEOUT? TIMEOUT@ 0> DUP IF 0 WAKE-AT ! THEN ;
+
: PAUSE \ suspend task at current execution point and switch to follower
RP@ \ push current rp
SP@ TOS ! \ save sp to task's TOS
@@ -89,7 +93,3 @@ NEGATE CONSTANT USER# \ save amount of allocated user variable space
UP@ UART0-TASK !
['] STOP-FOR-KEY 'WAIT-KEY !
;
-
-: TIMEOUT! TICKS @ + WAKE-AT ! ;
-: TIMEOUT@ TICKS @ WAKE-AT @ - ;
-: TIMEOUT? TIMEOUT@ 0> 0 WAKE-AT ! ;
View
12 lm3s811/precompiled_words.s
@@ -759,11 +759,17 @@
defword "WAKE-AT", WAKE_AT, 0x0, USER_XT
.word 0xFFFFFFF4
- defword "WAKE-REASON", WAKE_REASON, 0x0, USER_XT
- .word 0xFFFFFFF0
+ defconst "USER#", USERNUM, 0xC
- defconst "USER#", USERNUM, 0x10
+ defword "TIMEOUT!", TIMEOUTSTORE, 0x0
+ .word TICKS, FETCH, PLUS, WAKE_AT, STORE, EXIT
+
+ defword "TIMEOUT@", TIMEOUTFETCH, 0x0
+ .word TICKS, FETCH, WAKE_AT, FETCH, MINUS, EXIT
+
+ defword "TIMEOUT?", TIMEOUTQ, 0x0
+ .word TIMEOUTFETCH, ZGT, DUP, QBRANCH, 0x14, LIT, 0x0, WAKE_AT, STORE, EXIT
defword "PAUSE", PAUSE, 0x0
.word RPFETCH, SPFETCH, TOS, STORE, FOLLOWER, FETCH, GTR, EXIT

0 comments on commit c5869ba

Please sign in to comment.