aboutsummaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2017-05-28 15:17:02 +0200
committerDimitri Sokolyuk <demon@dim13.org>2017-05-28 15:17:02 +0200
commit42a28d800ef7959e5dedc58ef8cbf1614f48da4a (patch)
tree096b686a70a00632733d5e0c9f103146c57244d7 /cmd
parent72103d06b5f2ef5670c029ed50a99525375dd62f (diff)
package
Diffstat (limited to 'cmd')
-rw-r--r--cmd/dump/main.go18
-rw-r--r--cmd/eval/main.go13
2 files changed, 31 insertions, 0 deletions
diff --git a/cmd/dump/main.go b/cmd/dump/main.go
new file mode 100644
index 0000000..451b934
--- /dev/null
+++ b/cmd/dump/main.go
@@ -0,0 +1,18 @@
+package main
+
+import (
+ "fmt"
+
+ "dim13.org/j1"
+)
+
+func main() {
+ body, err := j1.ReadBin("testdata/j1.bin")
+ if err != nil {
+ panic(err)
+ }
+ for i, v := range body {
+ inst := j1.Decode(v)
+ fmt.Printf("%0.4X %0.4X\t%s\n", 2*i, v, inst)
+ }
+}
diff --git a/cmd/eval/main.go b/cmd/eval/main.go
new file mode 100644
index 0000000..14e2d53
--- /dev/null
+++ b/cmd/eval/main.go
@@ -0,0 +1,13 @@
+package main
+
+import "dim13.org/j1"
+
+func main() {
+ vm := new(j1.J1)
+ if err := vm.LoadFile("testdata/j1.bin"); err != nil {
+ panic(err)
+ }
+ for i := 0; i < 100; i++ {
+ vm.Eval()
+ }
+}