From time to time, a ROM will want to transfer new code to a location in memory which overwrites old code that was there previously. For the sake of simplicity, we refer to these situations as self-modifying code. Self-modifying code has the consequence of rendering invalid the code that we compiled for that location, since the virtual machine instructions at those addresses have been altered. One fast solution to this problem is memory protection. With memory protection, we can detect when these writes occur, and then invalidate blocks of compiled code. There are rare situations in which the protected memory detection method is not sufficient. For this reason, other slower options are available. Protect Memory is the default setting. Using No Check should be fastest, but is only feasible for some demos and is not recommended.
Check Self-modifying Code = int(0, 1, 2, 3, 4, 5, 6, 7, 8)
Check Self-modifying Code=8
||Memory QWORD and DMA
||Memory Block and DMA
||Protect Memory [Default]
- Self Modifying code is rom game code or other binary data that is changed at an address for one reason or another, when it was once something else. You can't emulate the old instructions since the memory has changed, so you need to detect when this occurs. Protect Memory is the fastest method for detection. Of course, No_Check should be fastest, but only some games like Mario and MarioKart will work with No Check, because they don't have self-modifying code.
page revision: 5, last edited: 18 Apr 2011 06:15