How did I write 350 lines of code in one day to create a (mostly) working CPU ? It's thanks to a long and careful preparation, using diagrams like this one :

I use different colors to show the separate paths for control, address, data etc.

With this kind of general diagram, it's easy to code : just follow the wires and code the corresponding function...

A cleaner version will appear later :-)