From 9a0bacd5815057e4799cdd6ccd4fca9650b69398 Mon Sep 17 00:00:00 2001 From: Jared Miller Date: Mon, 9 Feb 2026 21:46:52 -0500 Subject: [PATCH] Document write_word permission model in zmemory --- src/mudlib/zmachine/zmemory.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/mudlib/zmachine/zmemory.py b/src/mudlib/zmachine/zmemory.py index 6a19266..0c0a2e2 100644 --- a/src/mudlib/zmachine/zmemory.py +++ b/src/mudlib/zmachine/zmemory.py @@ -258,7 +258,12 @@ class ZMemory: return (self._memory[address] << 8) + self._memory[(address + 1)] 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): raise ZMemoryOutOfBounds value_msb = (value >> 8) & 0xFF