From 309dcb5a029d9b40c72fa8bc01a3009389b66e8e Mon Sep 17 00:00:00 2001 From: Julien Dessaux Date: Tue, 21 Sep 2021 00:27:57 +0200 Subject: Continued implementing the Instruction Pointer --- pkg/pointer/storage-offset.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 pkg/pointer/storage-offset.go (limited to 'pkg/pointer/storage-offset.go') diff --git a/pkg/pointer/storage-offset.go b/pkg/pointer/storage-offset.go new file mode 100644 index 0000000..0fcd9ed --- /dev/null +++ b/pkg/pointer/storage-offset.go @@ -0,0 +1,13 @@ +package pointer + +func (p Pointer) GetStorageOffset() (x, y int) { + return p.sox, p.soy +} + +func (p *Pointer) CalculateNewStorageOffset() { + p.sox, p.soy = p.x+p.delta.x, p.y+p.delta.y +} + +func (p *Pointer) SetStorageOffset(x, y int) { + p.sox, p.soy = x, y +} -- cgit v1.2.3