Implement stub opcodes for game compatibility
set_colour, piracy, erase_line, get_cursor, not_v5, print_table
This commit is contained in:
parent
b08ce668a6
commit
6d29ec00fb
1 changed files with 27 additions and 16 deletions
|
|
@ -463,8 +463,8 @@ class ZCpu:
|
||||||
self._call(routine_addr, [arg1], False)
|
self._call(routine_addr, [arg1], False)
|
||||||
|
|
||||||
def op_set_colour(self, *args):
|
def op_set_colour(self, *args):
|
||||||
"""TODO: Write docstring here."""
|
"""Set foreground and background colors (no-op for text MUD)."""
|
||||||
raise ZCpuNotImplemented
|
pass
|
||||||
|
|
||||||
def op_throw(self, *args):
|
def op_throw(self, *args):
|
||||||
"""TODO: Write docstring here."""
|
"""TODO: Write docstring here."""
|
||||||
|
|
@ -716,8 +716,8 @@ class ZCpu:
|
||||||
self._branch(expected_checksum == actual_checksum)
|
self._branch(expected_checksum == actual_checksum)
|
||||||
|
|
||||||
def op_piracy(self, *args):
|
def op_piracy(self, *args):
|
||||||
"""TODO: Write docstring here."""
|
"""Anti-piracy check. Always branches true (all interpreters pass this)."""
|
||||||
raise ZCpuNotImplemented
|
self._branch(True)
|
||||||
|
|
||||||
## VAR opcodes (opcodes 224-255)
|
## VAR opcodes (opcodes 224-255)
|
||||||
|
|
||||||
|
|
@ -913,16 +913,17 @@ class ZCpu:
|
||||||
self._ui.screen.erase_window(window_number)
|
self._ui.screen.erase_window(window_number)
|
||||||
|
|
||||||
def op_erase_line(self, *args):
|
def op_erase_line(self, *args):
|
||||||
"""TODO: Write docstring here."""
|
"""Erase current line on screen (no-op for text MUD)."""
|
||||||
raise ZCpuNotImplemented
|
pass
|
||||||
|
|
||||||
def op_set_cursor(self, x, y):
|
def op_set_cursor(self, x, y):
|
||||||
"""Set the cursor position within the active window."""
|
"""Set the cursor position within the active window."""
|
||||||
self._ui.screen.set_cursor_position(x, y)
|
self._ui.screen.set_cursor_position(x, y)
|
||||||
|
|
||||||
def op_get_cursor(self, *args):
|
def op_get_cursor(self, table_addr):
|
||||||
"""TODO: Write docstring here."""
|
"""Get cursor position into table. For MUD, always write row=1, col=1."""
|
||||||
raise ZCpuNotImplemented
|
self._memory.write_word(table_addr, 1) # row
|
||||||
|
self._memory.write_word(table_addr + 2, 1) # col
|
||||||
|
|
||||||
def op_set_text_style(self, text_style):
|
def op_set_text_style(self, text_style):
|
||||||
"""Set the text style."""
|
"""Set the text style."""
|
||||||
|
|
@ -1004,9 +1005,10 @@ class ZCpu:
|
||||||
self._write_result(0)
|
self._write_result(0)
|
||||||
self._branch(False)
|
self._branch(False)
|
||||||
|
|
||||||
def op_not_v5(self, *args):
|
def op_not_v5(self, value):
|
||||||
"""TODO: Write docstring here."""
|
"""Bitwise NOT (VAR form). Same as op_not."""
|
||||||
raise ZCpuNotImplemented
|
result = ~value & 0xFFFF
|
||||||
|
self._write_result(result)
|
||||||
|
|
||||||
def op_call_vn(self, routine_addr, *args):
|
def op_call_vn(self, routine_addr, *args):
|
||||||
"""Call routine with up to 3 arguments and discard the result."""
|
"""Call routine with up to 3 arguments and discard the result."""
|
||||||
|
|
@ -1055,7 +1057,12 @@ class ZCpu:
|
||||||
offset = pos + word_len
|
offset = pos + word_len
|
||||||
|
|
||||||
def op_encode_text(self, *args):
|
def op_encode_text(self, *args):
|
||||||
"""TODO: Write docstring here."""
|
"""Encode ZSCII text to Z-encoded string (V5+).
|
||||||
|
|
||||||
|
This opcode converts ZSCII text into Z-machine's packed text format
|
||||||
|
(3 characters per 2 bytes). Complex operation, rarely used.
|
||||||
|
Not implemented - will raise ZCpuNotImplemented if any game calls it.
|
||||||
|
"""
|
||||||
raise ZCpuNotImplemented
|
raise ZCpuNotImplemented
|
||||||
|
|
||||||
def op_copy_table(self, first, second, size):
|
def op_copy_table(self, first, second, size):
|
||||||
|
|
@ -1080,9 +1087,13 @@ class ZCpu:
|
||||||
for i in range(count - 1, -1, -1):
|
for i in range(count - 1, -1, -1):
|
||||||
self._memory[second + i] = self._memory[first + i]
|
self._memory[second + i] = self._memory[first + i]
|
||||||
|
|
||||||
def op_print_table(self, *args):
|
def op_print_table(self, zscii_text, width, height=1, skip=0):
|
||||||
"""TODO: Write docstring here."""
|
"""Formatted table printing (no-op for text MUD).
|
||||||
raise ZCpuNotImplemented
|
|
||||||
|
Spec: print width chars per line for height lines from zscii_text.
|
||||||
|
Skip bytes between rows. For now, no-op to avoid crashes.
|
||||||
|
"""
|
||||||
|
pass
|
||||||
|
|
||||||
def op_check_arg_count(self, arg_number):
|
def op_check_arg_count(self, arg_number):
|
||||||
"""Branch if the Nth argument was passed to the current routine."""
|
"""Branch if the Nth argument was passed to the current routine."""
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue