-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #110 from TG9541/lib-fix
Lib fix
- Loading branch information
Showing
4 changed files
with
70 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,30 @@ | ||
\ STM8eForth : MARKER MM-170929 | ||
\ STM8eForth : MARKER for words in RAM MM-170929 | ||
\ ------------------------------------------------------------------------------ | ||
|
||
RAM : _ ; \ dummy word to ensure that last points to RAM, not Flash | ||
|
||
HERE \ ( -- xt ) | ||
] RAM DUP @ last 2- ! 2+ DUP @ last ! 2+ @ last 10 + ! [ $81 C, | ||
\ get CP stored by MARKER, get last & context from the mark's link field | ||
] RAM DUP @ last 2- ! 2+ @ DUP last ! last 10 + ! [ $81 C, | ||
|
||
: MARKER ( "name" -- ) | ||
\ The marker "name" removes itself and all later defined words from RAM. | ||
RAM HERE last 2- @ , last @ , last 10 + @ , | ||
RAM HERE last 2- @ , \ store CP, then define a mark | ||
: [COMPILE] LITERAL ( xt ) LITERAL CALL, [COMPILE] ; | ||
; | ||
|
||
\ ------------------------------------------------------------------------------ | ||
\ Last Revision: MM-170930 Dummy word _ added. dofence made headerless | ||
\\ Example: | ||
|
||
RAM | ||
: _ ; \ dummy word to ensure that last points to RAM, not Flash | ||
|
||
MARKER myMarker | ||
|
||
: tempWordRAM ; | ||
|
||
NVM | ||
: wordFlash ; | ||
|
||
RAM | ||
myMarker | ||
|
||
\ tempWordRAM and myMarker are removed, wordFlash is still in the dictionary |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
\ Scaffolding for temporary RAM usage during compilation | ||
\ refer to github.com/TG9541/W1209/blob/master/LICENSE.md | ||
|
||
RAM | ||
#require MARKER | ||
|
||
\ Mark dictionary in RAM | ||
MARKER tempRAM | ||
|
||
\ assume default target if not defined by the application | ||
#require TARGET | ||
|
||
: ENDTEMP ( -- ) | ||
\ tear down scaffolding if we've been compiling to NVM | ||
HERE 0< IF | ||
RAM tempRAM NVM | ||
THEN | ||
; | ||
|
||
\ --------------------------------------------------------- | ||
\\ Example: | ||
|
||
\ uncomment for NVM as the compilation target | ||
\ : TARGET NVM ; | ||
|
||
#include STARTTEMP | ||
\ use RAM | ||
: temporaryWordInRAM ; | ||
TARGET | ||
: wordInTargetMemory ; | ||
ENDTEMP |