Implement ring buffer overflow behavior.
Move interrupt queue queuing to handleInterrupt.
Move everything to emulator package.
Move helpers to emulator.utils.