Fix return value storage in finish_routine

This commit is contained in:
Jared Miller 2026-02-09 23:04:54 -05:00
parent fa31f39a65
commit 6e62ca203b
Signed by: shmup
GPG key ID: 22B5C6D66A38B06C

View file

@ -199,9 +199,9 @@ class ZStackManager:
if exiting_routine.return_addr == 0: # type: ignore[possibly-missing-attribute]
# Push to stack
self.push_stack(return_value)
elif 0 < exiting_routine.return_addr < 10: # type: ignore[possibly-missing-attribute]
elif 0 < exiting_routine.return_addr < 0x10: # type: ignore[possibly-missing-attribute]
# Store in local var
self.set_local_variable(exiting_routine.return_addr, return_value) # type: ignore[possibly-missing-attribute]
self.set_local_variable(exiting_routine.return_addr - 1, return_value) # type: ignore[possibly-missing-attribute]
else:
# Store in global var
self._memory.write_global(exiting_routine.return_addr, return_value) # type: ignore[possibly-missing-attribute]