lib/haxor/vm/stack.rb in haxor-0.1.0 vs lib/haxor/vm/stack.rb in haxor-0.2.0
- old
+ new
@@ -5,25 +5,25 @@
value = @vm.subsystem(:mem).read addr
push_value value
end
def push_value(value)
- sp = @vm.subsystem(:mem).read 'sp'
+ sp = @vm.subsystem(:registers).read 'sp'
sp -= Consts::WORD_SIZE
- @vm.subsystem(:mem).write 'sp', sp
+ @vm.subsystem(:registers).write 'sp', sp
@vm.subsystem(:mem).write sp, value
end
def pop(addr)
value = pop_value
@vm.subsystem(:mem).write addr, value
end
def pop_value
- sp = @vm.subsystem(:mem).read 'sp'
+ sp = @vm.subsystem(:registers).read 'sp'
value = @vm.subsystem(:mem).read sp
sp += Consts::WORD_SIZE
- @vm.subsystem(:mem).write 'sp', sp
+ @vm.subsystem(:registers).write 'sp', sp
value
end
end
end