Document write_word permission model in zmemory

This commit is contained in:
Jared Miller 2026-02-09 21:46:52 -05:00
parent 1bcb83961a
commit 9a0bacd581
Signed by: shmup
GPG key ID: 22B5C6D66A38B06C

View file

@ -258,7 +258,12 @@ class ZMemory:
return (self._memory[address] << 8) + self._memory[(address + 1)] return (self._memory[address] << 8) + self._memory[(address + 1)]
def write_word(self, address, value): def write_word(self, address, value):
"""Write the given 16-bit value at ADDRESS, ADDRESS+1.""" """Write the given 16-bit value at ADDRESS, ADDRESS+1.
_check_static() is sufficient for permission checking because the
dynamic memory region (which includes the header) is always writable
by the game per Z-machine spec.
"""
if address < 0 or address >= (self._total_size - 1): if address < 0 or address >= (self._total_size - 1):
raise ZMemoryOutOfBounds raise ZMemoryOutOfBounds
value_msb = (value >> 8) & 0xFF value_msb = (value >> 8) & 0xFF