# Code analyser

Code analyser analyses the code of the simulated program and tries to figure out which address contains valid instruction.
Analyser starts analysing of the code with address 0 which always must contain an instruction because reset of the device sets zero into program counter. So, analyser marks address 0 that it contains an instruction. Then it marks the address of the next instruction and so on. If the analyser finds a jump instruction it continues with destination address of the jump instruction. If it finds a call instruction, it recursively analyses destination address as well as next instruction follows the call one.
Analysator stops if it finds an address which is already marked or if it finds a return instruction or an indirect jump which is impossible to follow. All these mean that it is impossible to discover all instructions of the program.

This problem is solved in very simple way. If the execution reaches an unmarked address, the analyser is called to analyse the code starting at actual address pointed by the PC.