Some ROMs will self modify by rewriting code within the loaded ROM or by writing instructions to memory outside of the ROM, jump, and execute. 3D Viper Maze (62e204572ac05be3748a746ac7831d6844f43003) for example. Also, CHIP-8 test suite: Quirks test (402ea1ede1cc4ab1c074b89b2ed5e9845f056fc3). The quirks tests overwrites 0000 in the ROM with a real opcode during execution.
I was working on a cached interpreter and I have to detect when the ROM self modifies during runtime. When this happens I have to invalidate blocks of cached instructions that are referenced by PC. Since instructions in the block may have changed since cached. The cache overhead, without being able to fully cache, makes my cached interpreter run slower, instead of faster, than a pure interpreter.
Having a metadata flag specifying the ROM will self modify allows for automatic switching to use a pure interpreter for the given ROM.
Some ROMs will self modify by rewriting code within the loaded ROM or by writing instructions to memory outside of the ROM, jump, and execute. 3D Viper Maze (62e204572ac05be3748a746ac7831d6844f43003) for example. Also, CHIP-8 test suite: Quirks test (402ea1ede1cc4ab1c074b89b2ed5e9845f056fc3). The quirks tests overwrites 0000 in the ROM with a real opcode during execution.
I was working on a cached interpreter and I have to detect when the ROM self modifies during runtime. When this happens I have to invalidate blocks of cached instructions that are referenced by PC. Since instructions in the block may have changed since cached. The cache overhead, without being able to fully cache, makes my cached interpreter run slower, instead of faster, than a pure interpreter.
Having a metadata flag specifying the ROM will self modify allows for automatic switching to use a pure interpreter for the given ROM.