aboutsummaryrefslogtreecommitdiff
path: root/Driver.icl
blob: aa89ae12f3be01f02457883d26b00cbe09e0adc2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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