From: Tim Vaughan Date: Sat, 23 Apr 2016 02:02:37 +0000 (+1200) Subject: Added CHAR and EXECUTE X-Git-Url: https://thelambdalab.xyz/gitweb/index.cgi?a=commitdiff_plain;h=77664f88335be474b0f4784e4d521e563b459fdc;p=forth.jl.git Added CHAR and EXECUTE --- diff --git a/src/forth.jl b/src/forth.jl index 69f703e..d6a10e6 100644 --- a/src/forth.jl +++ b/src/forth.jl @@ -824,6 +824,22 @@ QUIT = defWord("QUIT", INTERPRET, BRANCH,-2]) +# Odds and Ends + +CHAR = defPrim("CHAR", () -> begin + callPrim(mem[WORD]) + wordLen = popPS() + wordAddr = popPS() + word = getString(wordAddr, wordLen) + pushPS(Int64(word[1])) + + return mem[NEXT] +end) + +EXECUTE = defPrim("EXECUTE", () -> begin + return mem[popPS()] +end) + #### VM loop #### function runVM() jmp = mem[NEXT]