Fix 7-bit truncation bug in write_global corrupting game state
This commit is contained in:
parent
311a67e80a
commit
e5329d6788
1 changed files with 2 additions and 4 deletions
|
|
@ -5,7 +5,6 @@
|
|||
# root directory of this distribution.
|
||||
#
|
||||
|
||||
from . import bitfield
|
||||
from .zlogging import log
|
||||
|
||||
# This class that represents the "main memory" of the z-machine. It's
|
||||
|
|
@ -317,9 +316,8 @@ class ZMemory:
|
|||
raise ZMemoryIllegalWrite(value)
|
||||
log(f"Write {value} to global variable {varnum}")
|
||||
actual_address = self._global_variable_start + ((varnum - 0x10) * 2)
|
||||
bf = bitfield.BitField(value)
|
||||
self._memory[actual_address] = bf[8:15]
|
||||
self._memory[actual_address + 1] = bf[0:7]
|
||||
self._memory[actual_address] = (value >> 8) & 0xFF
|
||||
self._memory[actual_address + 1] = value & 0xFF
|
||||
|
||||
# The 'verify' opcode and the QueztalWriter class both need to have
|
||||
# a checksum of memory generated.
|
||||
|
|
|
|||
Loading…
Reference in a new issue