aboutsummaryrefslogtreecommitdiff
path: root/amforth-6.5/avr8/lib/forth2012/core-ext
diff options
context:
space:
mode:
Diffstat (limited to 'amforth-6.5/avr8/lib/forth2012/core-ext')
-rw-r--r--amforth-6.5/avr8/lib/forth2012/core-ext/avr-defers.frt20
-rw-r--r--amforth-6.5/avr8/lib/forth2012/core-ext/marker-test.frt18
-rw-r--r--amforth-6.5/avr8/lib/forth2012/core-ext/marker.frt23
3 files changed, 61 insertions, 0 deletions
diff --git a/amforth-6.5/avr8/lib/forth2012/core-ext/avr-defers.frt b/amforth-6.5/avr8/lib/forth2012/core-ext/avr-defers.frt
new file mode 100644
index 0000000..0421ab3
--- /dev/null
+++ b/amforth-6.5/avr8/lib/forth2012/core-ext/avr-defers.frt
@@ -0,0 +1,20 @@
+\ the following code works in the AVR only
+
+\ use the eeprom to keep the XT. Unlike the RAM/USER
+\ based locations, the EEPROM vector is available without
+\ initialization.
+: Edefer ( "name" -- )
+ (defer)
+ ehere dup ,
+ ['] Edefer@ ,
+ ['] Edefer! ,
+ cell+ to ehere
+;
+
+\ the flash is writable, not that often, but it is
+: Idefer ( "name" -- )
+ (defer)
+ ['] noop , \ a dummy action as place holder
+ [: @i execute ;] , \ XT is directly in the dictionary.
+ [: !i ;] ,
+;
diff --git a/amforth-6.5/avr8/lib/forth2012/core-ext/marker-test.frt b/amforth-6.5/avr8/lib/forth2012/core-ext/marker-test.frt
new file mode 100644
index 0000000..3a7c9b0
--- /dev/null
+++ b/amforth-6.5/avr8/lib/forth2012/core-ext/marker-test.frt
@@ -0,0 +1,18 @@
+#include dumper.frt
+#include order.frt
+#include marker.frt
+
+wordlist constant test-wl
+get-order test-wl swap 1+ set-order
+order
+marker empty
+
+' empty 4 - 10 idump
+
+: hallo ." Hallo " ;
+
+order
+words
+empty
+words
+order
diff --git a/amforth-6.5/avr8/lib/forth2012/core-ext/marker.frt b/amforth-6.5/avr8/lib/forth2012/core-ext/marker.frt
new file mode 100644
index 0000000..8d5756b
--- /dev/null
+++ b/amforth-6.5/avr8/lib/forth2012/core-ext/marker.frt
@@ -0,0 +1,23 @@
+\ Defines a word which resets the dictionary and removes itself
+\ when called.
+\ Better then forget but still has limitations.
+
+\ all information is in the first few EEPROM cells.
+\ (marker) is a value that holds the max eeprom address
+
+: marker
+ \ get information to remove the marker itself
+ get-current @e dp
+ \ create the wordlist entry
+ create
+ \ save all data
+ (marker) 0 do i @e , 2 +loop
+ \ save the marker-remove data
+ , ,
+ does>
+ \ restore data from saved state
+ (marker) 0 do dup @i i !e 1+ 2 +loop
+ \ purge the marker itself
+ dup @i to dp
+ 1+ @i get-current !e
+;