SirCmpwn/Tomato — pull request #44 by mikrohahn (2013-07-30 12:32:23+00:00)
Title: Possible fix for issue #43

This fix does not make use of the interrupt queue (though it uses similar behavior). Rather, it delays interrupt execution until the beginning of the next call to the Execute method, guaranteeing that changes made to the registers aren't immediately overwritten by instructions currently being executed as part of the normal control flow. To achieve this, it introduces a small data structure storing relevant data (handler address and interrupt message). Rather than changing the registers itself, FireInterrupt then enters the data into this structure from where it is retrieved at the same point where normally, queued interrupts would be dequeued.

The effect is equivalent to executing the old FireInterrupt after the execution of the current instruction. The fix was briefly tested with the test code from issue #43.