Skip to content

Commit

Permalink
An option to let write-to-zero pass (for the @glk opcode).
Browse files Browse the repository at this point in the history
This is not turned on by default.
  • Loading branch information
Andrew Plotkin authored and Andrew Plotkin committed Aug 23, 2016
1 parent 4b54634 commit 2e182f0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions exec.c
Expand Up @@ -622,6 +622,10 @@ void execute_loop()
value = inst[1].value;
arglist = pop_arguments(value, 0);
val0 = perform_glk(inst[0].value, value, arglist);
#ifdef TOLERATE_SUPERGLUS_BUG
if (inst[2].desttype == 1 && inst[2].value == 0)
inst[2].desttype = 0;
#endif /* TOLERATE_SUPERGLUS_BUG */
store_operand(inst[2].desttype, inst[2].value, val0);
profile_out(stackptr);
break;
Expand Down
5 changes: 5 additions & 0 deletions glulxe.h
Expand Up @@ -44,6 +44,11 @@ typedef int16_t glsi16;
game files from crashing the interpreter. */
#define VERIFY_MEMORY_ACCESS (1)

/* Uncomment this definition to permit an exception for memory-address
checking for @glk opcodes that try to write to memory address 0.
This was a bug in old Superglus-built game files. */
/* #define TOLERATE_SUPERGLUS_BUG (1) */

/* Uncomment this definition to turn on Glulx VM profiling. In this
mode, all function calls are timed, and the timing information is
written to a data file called "profile-raw".
Expand Down

0 comments on commit 2e182f0

Please sign in to comment.