kosarev / z80

Fast and flexible Z80/i8080 emulator with C++ and Python APIs
MIT License
65 stars 10 forks source link

Make transistors to store their states, not nodes #54

Open kosarev opened 1 year ago

kosarev commented 1 year ago

The original https://github.com/trebonian/visual6502 code maintains separate states for nodes and transistors. 48a84a6a changed that to store transistors' states in their gate nodes, because these were always supposed to be the same. However, making nodes stateless and gates themselves be storing their states might be better idea.

Firstly, not all nodes are tied to gates. This means we waste time updating them. When a node 'state' is needed, we should be able to compute it on demand without having to store anything.

Secondly, storing gate states in nodes means there is no way for several gates connected to the same node to have different states, which we need to simulate various possible orders of switching transistor states (#51).