aboutsummaryrefslogtreecommitdiff
path: root/eval.go
diff options
context:
space:
mode:
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 {