Documenting startup images.
This commit is contained in:
@ -488,6 +488,11 @@ See <a href="https://github.com/flagxor/eforth/blob/main/ueforth/esp32/web_inter
|
|||||||
|
|
||||||
<h3 id="autoexec">Autoexec.fs</h3>
|
<h3 id="autoexec">Autoexec.fs</h3>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
NOTE: This section describes one mechanism for running code at startup.
|
||||||
|
See <a href="#dictimages">this</a> for an alternate option.
|
||||||
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
The system will automatically attempt to mount SPIFFS filesystem at <code>/spiffs</code>.
|
The system will automatically attempt to mount SPIFFS filesystem at <code>/spiffs</code>.
|
||||||
It will then at start attempt to load <code>/spiffs/autoexec.fs</code>
|
It will then at start attempt to load <code>/spiffs/autoexec.fs</code>
|
||||||
|
|||||||
@ -107,3 +107,55 @@ N ( -- ) Move to the next block
|
|||||||
SEE ( "name" -- ) Attempt to decompile a word
|
SEE ( "name" -- ) Attempt to decompile a word
|
||||||
ECHO ( -- a ) -- Address of flag that determines if commands are echoed
|
ECHO ( -- a ) -- Address of flag that determines if commands are echoed
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
|
<h5 id="dictimages">Dictionary Images and Startup</h5>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<b>WARNING: Danger ahead.</b><br/>
|
||||||
|
Snapshotting the dictionary may not be stable across reinstallations of the C build of Forth.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
A collection of non-standard words is provided that allow snapshotting
|
||||||
|
the dictionary and restoring it at startup, with a start word.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<pre>
|
||||||
|
SAVE ( "name" -- ) Saves a snapshot of the current dictionary to a file.
|
||||||
|
RESTORE ( "name" -- ) Restore a snapshot from a file.
|
||||||
|
REMEMBER ( -- ) Save a snapshot to the default file
|
||||||
|
(./myforth or /spiffs/myforth on ESP32).
|
||||||
|
STARTUP: ( "name" -- ) Save a snapshot to the default file arranging for
|
||||||
|
"name" to be run on startup.
|
||||||
|
REVIVE ( -- ) Restore the default filename.
|
||||||
|
RESET ( -- ) Delete the default filename.
|
||||||
|
</pre>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Here's an example usage:
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<pre>
|
||||||
|
: welcome ." Hello!" cr 100 0 do i . loop cr ;
|
||||||
|
startup: welcome
|
||||||
|
bye
|
||||||
|
|
||||||
|
( Next boot will run a custom startup message )
|
||||||
|
|
||||||
|
reset
|
||||||
|
|
||||||
|
( Reset removes the custom message )
|
||||||
|
</pre>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
The <code>INTERNALS</code> vocabulary has some additional words
|
||||||
|
for more control.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<pre>
|
||||||
|
SAVE-NAME ( a n -- ) Save a snapshot if the current vocabulary to a file.
|
||||||
|
RESTORE-NAME ( a n -- ) Restore a snapshot from a file.
|
||||||
|
'COLD ( -- a ) Address of the word that will be run on startup.
|
||||||
|
REMEMBER-FILENAME ( -- a n ) Deferred word specifying the platform specific
|
||||||
|
default snapshot filename.
|
||||||
|
</pre>
|
||||||
|
|||||||
Reference in New Issue
Block a user