en:pfw:multi_tasker
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
en:pfw:multi_tasker [2025-02-27 21:13] – [Contributions] willem | en:pfw:multi_tasker [2025-03-14 13:30] (current) – [Contributions] willem | ||
---|---|---|---|
Line 278: | Line 278: | ||
<code forth> | <code forth> | ||
code PAUSE ( -- ) \ 29 machine cycles, is 0.232 microsec. at 125 MHz | code PAUSE ( -- ) \ 29 machine cycles, is 0.232 microsec. at 125 MHz | ||
- | { ip sp tos } push, \ 4 - Save Forth environment | + | { ip sp tos } push, \ 4 - Save tasks Forth environment |
sun TP mov, \ 1 - TCB address to SUN | sun TP mov, \ 1 - TCB address to SUN | ||
day rp mov, \ 1 - RP to DAY | day rp mov, \ 1 - RP to DAY | ||
- | day sun 0C #) str, \ 2 - DAY to RP | + | day sun 0C #) str, \ 2 - DAY TRP ! |
begin, >box | begin, >box | ||
begin, | begin, | ||
Line 289: | Line 289: | ||
=? no until, | =? no until, | ||
TP sun mov, \ 1 - Next link address = new TCB | TP sun mov, \ 1 - Next link address = new TCB | ||
- | day sun 0C #) ldr, \ 2 - RP @ to DAY | + | day sun 0C #) ldr, \ 2 - TRP @ to DAY |
rp day mov, \ 1 - DAY to RP | rp day mov, \ 1 - DAY to RP | ||
- | { ip sp tos } pop, \ 4 - Restore Forth environment | + | { ip sp tos } pop, \ 4 - Restore |
begin, >box | begin, >box | ||
next, \ 6 | next, \ 6 | ||
Line 299: | Line 299: | ||
tp> , ( Address of main TCB ) | tp> , ( Address of main TCB ) | ||
code> | code> | ||
- | w w ) ldr, \ 2 - main to W | + | w w ) ldr, \ 2 - main TCB to W |
sun TP mov, \ 1 - Task to DAY | sun TP mov, \ 1 - Task to DAY | ||
sun w cmp, \ 1 - main = task? | sun w cmp, \ 1 - main = task? | ||
Line 307: | Line 307: | ||
{ ip sp tos } push, \ 4 - Save this tasks Forth environment | { ip sp tos } push, \ 4 - Save this tasks Forth environment | ||
w rp mov, \ 1 - RP to W | w rp mov, \ 1 - RP to W | ||
- | w sun 0C #) str, \ 2 - W to RP | + | w sun 0C #) str, \ 2 - W to TRP |
box> again, | box> again, | ||
end-code | end-code | ||
Line 314: | Line 314: | ||
tp> , ( Address of main TCB ) | tp> , ( Address of main TCB ) | ||
code> | code> | ||
- | w w ) ldr, \ 2 - main to W | + | w w ) ldr, \ 2 - main TCB to W |
tos w cmp, \ 1 - main = task? | tos w cmp, \ 1 - main = task? | ||
=? no if, > | =? no if, > | ||
Line 335: | Line 335: | ||
{ ip sp } push, \ Save noForth registers | { ip sp } push, \ Save noForth registers | ||
moon rp mov, \ Save RP | moon rp mov, \ Save RP | ||
- | ip sun mov, | + | ip sun mov, |
- | day tos 20 #) ldr, \ Read R0 to DAY | + | day tos 20 #) ldr, \ Read TR0 to DAY |
- | rp day mov, \ Use R0 as tasks RP | + | rp day mov, \ Use TR0 as tasks RP |
- | sp tos 24 #) ldr, | + | sp tos 24 #) ldr, |
{ ip sp tos hop } push, \ Initialise tasks return stack | { ip sp tos hop } push, \ Initialise tasks return stack | ||
day rp mov, \ Copy RP to DAY | day rp mov, \ Copy RP to DAY | ||
- | day tos 0C #) str, \ Set tasks RP too | + | day tos 0C #) str, \ Set tasks TRP too |
rp moon mov, \ Restore noForth registers | rp moon mov, \ Restore noForth registers | ||
{ ip sp } pop, | { ip sp } pop, |
en/pfw/multi_tasker.1740687182.txt.gz · Last modified: 2025-02-27 21:13 by willem