From c0310064ea5b44674cb5cf36aa3f7b177479e4e3 Mon Sep 17 00:00:00 2001 From: "Michael D. Lowis" Date: Wed, 3 Dec 2014 21:24:01 -0500 Subject: [PATCH] Added support for constant definitions --- source/onward.ft | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/source/onward.ft b/source/onward.ft index 010eb2d..aa4a58d 100644 --- a/source/onward.ft +++ b/source/onward.ft @@ -1,3 +1,15 @@ +\ Runtime Words +\ ----------------------------------------------------------------------------- +: depth asp @ asb @ - ; + +: aligned + CELLSZ 1 - \ Calculate the value to add + dup ~ rot \ Calculate the bitmask + + & \ Apply the mask to align the number +; + +: align here dup @ aligned ! ; + \ Compiler Words \ ----------------------------------------------------------------------------- : immediate @@ -19,6 +31,10 @@ ' lit , , \ Compile the top item on the stack as a literal ; +: const word create [compile] literal 0 , ; + +: dump word find dumpw ; + \ Stack Manipulation Words \ ----------------------------------------------------------------------------- : nip swap drop ; -- 2.54.0