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:10] – [Contributions] willem | en:pfw:multi_tasker [2025-03-14 13:30] (current) – [Contributions] willem | ||
|---|---|---|---|
| Line 273: | Line 273: | ||
| **Primitives for noForth t on the RP2040** | **Primitives for noForth t on the RP2040** | ||
| - | Note that it is code directly from the noForth t metacompiler listing. | + | Note that this is code directly from the noForth t metacompiler listing.\\ |
| - | take there there are some meta specific words in it like ''> | + | So take there there are some meta specific words in it like ''> |
| <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 288: | 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 298: | 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 306: | 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 313: | 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 334: | 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.1740687031.txt.gz · Last modified: 2025-02-27 21:10 by willem