aboutsummaryrefslogtreecommitdiff
path: root/ABC/Driver.icl
diff options
context:
space:
mode:
Diffstat (limited to 'ABC/Driver.icl')
-rw-r--r--ABC/Driver.icl26
1 files changed, 26 insertions, 0 deletions
diff --git a/ABC/Driver.icl b/ABC/Driver.icl
new file mode 100644
index 0000000..aa89ae1
--- /dev/null
+++ b/ABC/Driver.icl
@@ -0,0 +1,26 @@
+implementation module ABC.Driver
+
+import StdEnv, StdDebug
+
+import ABC.Machine
+
+boot :: ([Instruction], [Desc]) -> State
+boot (prog,descs)
+ = { astack = as_init
+ , bstack = bs_init
+ , cstack = cs_init
+ , graphstore = gs_init
+ , descstore = ds_init descs
+ , pc = pc_init
+ , program = ps_init prog
+ , io = io_init
+ }
+
+fetch_cycle :: State -> State
+fetch_cycle st=:{pc,program}
+//# pc = trace_n pc pc
+| pc_end pc = st
+| otherwise = fetch_cycle (currinstr {st & pc=pc`})
+where
+ pc` = pc_next pc
+ currinstr = ps_get pc program