Same as in my VIDEOPAC-emulator on the ZX Spectrum. Like Simon said, first emulate the code and store in a table the
'translated' addresses. Although RET and JP (HL) can be run directly these
codes are considered to be altered and through the RST-handled.
A check is made whether the Jp-address is translated. If so, the code is run,
otherwise the code is translated through the emulator. After playing a game
the (altered) ROM and table is stored, making the game run faster the next time it is loaded.

Dr Beep

Citeren Simon Owen <[EMAIL PROTECTED]>:

Stefan Drissen wrote:
Just curious, how do you detect the difference between code and data?

I was just assuming that the ROM wouldn't be self-modifying, so following
the possible execution paths from boot would catch almost everything.  That
doesn't cover look-up tables of jump addresses, though spotting code
patterns of PUSH rr followed by RET and maybe JP (HL) would perhaps spot
possible problem areas.

That might be enough to recognise exception blocks in popular titles, much
like my SID player has exceptions for some SID register writes.  I've not
actually examined any ROMs to know how likely it is - Dr Beep can probably
give you a real answer!

Si




Reply via email to