Line: 1 to 1 | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Calling C Functions from Forth and Vice Versa | ||||||||||||||||
Line: 17 to 17 | ||||||||||||||||
| ||||||||||||||||
Changed: | ||||||||||||||||
< < |
| |||||||||||||||
> > |
| |||||||||||||||
| ||||||||||||||||
Line: 57 to 57 | ||||||||||||||||
Calling Forth Words from C Functions | ||||||||||||||||
Changed: | ||||||||||||||||
< < | Data Stack Pointer SPS is in R7 and Top Of Stack TOS is in R6. R7 can't be a register variable, that's why R12 is used as a temporary storage.
register uint32_t TOS asm ("r6"); register uint32_t PSP asm ("r12"); TOS = TOS; PSP = PSP; | |||||||||||||||
> > | Data Stack Pointer SPS is in R7 and Top Of Stack TOS is in R6. R7 can't be a register variable, that's why R9 is used as a temporary storage. | |||||||||||||||
C function FS_include() from fs.c![]() FS_type and FS_evaluate .
| ||||||||||||||||
Line: 83 to 75 | ||||||||||||||||
FIL fil; /* File object */ FRESULT fr; /* FatFs return code */ | ||||||||||||||||
Deleted: | ||||||||||||||||
< < | register uint32_t TOS asm ("r6"); register uint32_t PSP asm ("r12"); TOS = TOS; PSP = PSP; | |||||||||||||||
memcpy(path, str, count); line[count] = 0; | ||||||||||||||||
Line: 116 to 102 | ||||||||||||||||
@ ----------------------------------------------------------------------------- Wortbirne Flag_visible, "include" | ||||||||||||||||
Changed: | ||||||||||||||||
< < | @ ( "filename" -- ) Interprets the content of the file. | |||||||||||||||
> > | @ ( "filename" any -- any ) Interprets the content of the file. | |||||||||||||||
// void FS_include(uint8_t *str, int count) @ ----------------------------------------------------------------------------- include: | ||||||||||||||||
Changed: | ||||||||||||||||
< < | push {r0-r3, lr} bl token // ( -- c-addr len ) | |||||||||||||||
> > | push {lr} bl token @ ( -- c-addr len ) incl: | |||||||||||||||
movs r1, tos // len -> count drop movs r0, tos // c-addr -> str drop | ||||||||||||||||
Changed: | ||||||||||||||||
< < | movs r12, psp // get psp | |||||||||||||||
> > | movs r9, psp // get psp movs r8, tos // get tos | |||||||||||||||
bl FS_include | ||||||||||||||||
Changed: | ||||||||||||||||
< < | movs psp, r12 // update psp pop {r0-r3, pc} | |||||||||||||||
> > | movs psp, r9 // update psp movs tos, r8 // update tos pop {pc} | |||||||||||||||
The C function FS_include() from fs.c![]() evaluate by the FS_evaluate() function. | ||||||||||||||||
Line: 137 to 126 | ||||||||||||||||
// void FS_evaluate(uint8_t* str, int count); .global FS_evaluate FS_evaluate: | ||||||||||||||||
Changed: | ||||||||||||||||
< < | push {r4, r5, r7, lr} movs psp, r12 // get psp | |||||||||||||||
> > | push {r4-r7, lr} movs psp, r9 // get psp movs tos, r8 // get tos | |||||||||||||||
pushdatos movs tos, r0 // str pushdatos movs tos, r1 // count bl evaluate | ||||||||||||||||
Changed: | ||||||||||||||||
< < | movs r12, psp // update psp pop {r4, r5, r7, pc} | |||||||||||||||
> > | movs r9, psp // update psp movs r8, tos // update tos pop {r4-r7, pc} | |||||||||||||||
-- ![]() |