aboutsummaryrefslogtreecommitdiff
path: root/eval.go
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2017-06-17 15:06:56 +0200
committerDimitri Sokolyuk <demon@dim13.org>2017-06-17 15:06:56 +0200
commit5b734a8aa3a02c87012e90f9c97b71914c776214 (patch)
tree4b252b05bfc384a96e28dd6e54bca44bddc90522 /eval.go
parent5b10c8a1a3f14beafe5e9b47663bc5dc67bb6409 (diff)
Compile
Diffstat (limited to 'eval.go')
-rw-r--r--eval.go13
1 files changed, 10 insertions, 3 deletions
diff --git a/eval.go b/eval.go
index eedffd4..da962f5 100644
--- a/eval.go
+++ b/eval.go
@@ -27,10 +27,17 @@ func (vm *J1) Reset() {
vm.rsp = 0
}
+// Depth of stacks
func (vm *J1) Depth() uint16 { return (uint16(vm.rsp) << 8) | uint16(vm.dsp) }
-func (vm *J1) T() uint16 { return vm.st0 }
-func (vm *J1) N() uint16 { return vm.dstack[vm.dsp] }
-func (vm *J1) R() uint16 { return vm.rstack[vm.rsp] }
+
+// T is top of the data stack
+func (vm *J1) T() uint16 { return vm.st0 }
+
+// N is sendond element in data stack
+func (vm *J1) N() uint16 { return vm.dstack[vm.dsp] }
+
+// R is top of return stack
+func (vm *J1) R() uint16 { return vm.rstack[vm.rsp] }
// LoadBytes into memory
func (vm *J1) LoadBytes(data []byte) error {