aboutsummaryrefslogtreecommitdiff
path: root/stack.go
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2018-08-26 12:36:17 +0200
committerDimitri Sokolyuk <demon@dim13.org>2018-08-26 12:36:17 +0200
commitc7d559ef790d89a6c4f7c6ce57daa964988d99ef (patch)
tree1279b3181bb273592c92c9b69be2f422928ede74 /stack.go
parente3be9e8d400ac9e045cab81113ce05734dcf0015 (diff)
Diffstat (limited to 'stack.go')
-rw-r--r--stack.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/stack.go b/stack.go
index c3709a3..b3b0922 100644
--- a/stack.go
+++ b/stack.go
@@ -5,6 +5,14 @@ type stack struct {
sp int8 // 5 bit stack pointer
}
+func (s *stack) readAt(addr uint16) uint16 {
+ return s.data[int(addr)]
+}
+
+func (s *stack) writeAt(addr, value uint16) {
+ s.data[int(addr)] = value
+}
+
func (s *stack) move(dir int8) {
s.sp = (s.sp + dir) & 0x1f
}