trillek-team/trillek-vcomputer-module

Rethink devices-CPU protocol when a interrupt is generated

Zardoz89 opened this issue · 1 comments

Rethink / reimplement devices-CPU protocol when a interrupt is generated, so we can try to remove a "duplicate" variable referent to interrupts, and avoid that a device need polling in Tick(), if can generate a interrupt.

I set that a device haves a method called when the VitualComputer checks for possible interrupts/update devices. If this method (DoesInterrupt () ) return true, it will set a var to the interrupt message.

This does two things :

  • Avoids the continuous check if can throw a interrupt in the device Update method. Generatinga interrupt from a device is lazy now.
  • A device now not needs a pointer/reference to the CPU to call ThorowInterrupt() method (This was the biggest obstacle to removed ICpu class)