Last year, I created a circuit simulator in C# based on Quics. I split the project into front-end (written in C# WPF) visual editor to create and edit the circuit elements, and back-end (written in C++) to do the matrix computations of the Modified nodal analysis. The connection is data driven through netlist file.
Now I'm considering adding AVR microcontroller simulation support that can interact with the rest of the elements in the circuit.
My problem is that I don't know how to do this in the current matrix formulation?
Note: What I want to achieve might be similar to this emulating 6502 of NES console. But the problem is I don't know how to emulate the IO's to work with the rest of the circuit.