erkyrath / glulxe

The Glulx VM reference interpreter
http://eblong.com/zarf/glulx/
MIT License
114 stars 22 forks source link

An option to let write-to-zero pass #4

Closed erkyrath closed 8 years ago

erkyrath commented 10 years ago

As noted in this thread: http://www.intfiction.org/forum/viewtopic.php?f=18&t=4890&start=30

Some old Superglus games apparently write to address zero. It would be worth having an option that permits this (as a no-op) even in VERIFY_MEMORY_ACCESS mode.

However, investigate the situation first. If the games only do it for a single opcode, we should limit the exception to that opcode.

erkyrath commented 9 years ago

Game that demonstrates this problem: http://www.juegosaccesibles.es/pitufos.zip (unpack, run pitufos.blb).

erkyrath commented 9 years ago

Testing indicates (at least in pitufos.blb) that the only error case is the @glk opcode. Operand 2 is compiled as mode 15, width 4, address 0.

It should suffice to catch that case and change it to mode 0 (discard). But be sure to do it for both blocking (glk_select) and non-blocking. (Observed error on Glk calls glk_select, glk_request_line_event, glk_request_timer_events.)

erkyrath commented 8 years ago

Seems to work. I'm not turning this on by default, though.