aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--eval.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/eval.go b/eval.go
index d9c0e6c..c3891c3 100644
--- a/eval.go
+++ b/eval.go
@@ -47,16 +47,18 @@ func (vm *J1) LoadFile(fname string) error {
// Eval evaluates content of memory
func (vm *J1) Eval() {
+ var cycle int
ticker := time.NewTicker(time.Second / 10)
defer ticker.Stop()
for range ticker.C {
+ cycle++
ins := Decode(vm.memory[vm.pc])
if ins == Jump(0) {
return
}
vm.eval(ins)
- fmt.Println(ins)
- fmt.Println(vm)
+ fmt.Printf("%4d %v\n", cycle, ins)
+ fmt.Printf("%v\n", vm)
}
}