I heard there are some documents that describe what the 6502 CPU is doing every cycle of each operation. Where can I find one? Also, is is possible to emulate the CPU in such way that you don't have to implement illegal opcodes separately and have them be a side effect of the coding, just like they are a side effect of the CPU's wiring/design. There seems to be some patterns in what bits have to be set to get certain opcode and addressing mode, but they seem to be most consistent with ALU operations and there are a lot of exceptions as well.