Hacker News new | ask | show | jobs
by geocar 4084 days ago
Your game could dynamically modify the instructions.
1 comments

Sure, but wouldn't that incur a loss of performance ?
On a modern pipelined CPU with separate instruction/data caches self-modifying code does have a rather large penalty since it has to flush the pipeline and the caches, but on the original 8088 PC which has no cache and no pipeline (there's only a 4-byte prefetch queue), the penalty is much smaller.
Some, but maybe not very much: The screen is redrawn much more frequently than a key is pressed.
You might get noticeable latency though.