aaronmell wrote:
... I am not sure how to handle changing state, and interrupts.
If you've converted some straightline code to a faster implementation, and you want to handle an interrupt occurring part-way through that code, I think you'll need
- to account for the total clocks in the code
- notice that the interrupt fired during the code
- restore the machine state to what it was before the code
- emulate the code opcode-by-opcode until the cycle where the interrupt happens.
Or, if you don't need to be cycle-accurate, just handle the interrupt at the end of the straight-line section.
Ed