Thanks for the explanation. Very nice project. I guess self-modifying code does not work with this technique, does it? (I don't know much about DOS games and how common self-modifying code was on PCs).
Concerning access to video memory: I saw that you treat them "manually" in some cases. I am wondering whether you could avoid that by using virtual memory. You could mark the pages as invalid and when an instruction tries to access them, you catch it and replace the memory[...] access instruction by a call to memoryVideoGet. The JIT-Compiler of the Amiga emulator uses a similar technique for indirect accesses to hardware registers.
Good point. In the set of games (10 in total, release date up to 1991) I was porting I found only one that used this nasty technique. And it was just rewriting only single byte of code (something like rewriting nop instruction into return). So very simple case so far. Of course using cicoparser doesn't mean that you get working code without any manual work. You will always need to fix some issues by hand.
Virtual memory does not solve anything in this case. Writing to EGA video ram means that you want to display some pixels. But the write operation goes through some extra logic which decides what to do with the byte being written (extra rotation, masking...) and by reading the same addrees you are not guaranteed to get the same value back. EGA control registers handle this process and you simply need to emulate this behaviour somehow.
Concerning access to video memory: I saw that you treat them "manually" in some cases. I am wondering whether you could avoid that by using virtual memory. You could mark the pages as invalid and when an instruction tries to access them, you catch it and replace the memory[...] access instruction by a call to memoryVideoGet. The JIT-Compiler of the Amiga emulator uses a similar technique for indirect accesses to hardware registers.