The Lambda Lab
/
projects
/
forth.jl.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
1c113d5
)
Added CHAR and EXECUTE
author
Tim Vaughan
<tgvaughan@gmail.com>
Sat, 23 Apr 2016 02:02:37 +0000
(14:02 +1200)
committer
Tim Vaughan
<tgvaughan@gmail.com>
Sat, 23 Apr 2016 02:02:37 +0000
(14:02 +1200)
src/forth.jl
patch
|
blob
|
history
diff --git
a/src/forth.jl
b/src/forth.jl
index
69f703e
..
d6a10e6
100644
(file)
--- 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]