So, what is an emulator? This is a special program, which pretends to be what in fact its not. Many years ago, there were various computers: "DVK", "Microsha", "Pravets", "Sinclair" and so on. As a teenager many of us spent a lot of time with them and i can not say that they spend it for nothing. Even now, many of realized then ideas on these computers will be interesting. You did not find that time? It does not matter. There is another issue - the emulator of cell phones. Imagine that in your computer live a whole armada of mobile handsets, which behave exactly like the real - show screen saver, are switched in the menu, working with Java-games and applications, and can even call. And even look like the real phone. Fans of hacking can create an emulator of the real computer in order to deceive the old programs of the nineties. Often that programs have been protected, had interesting algorithms, clever tricks of programming. Emulator could unravel the mysteries which are hidden by these programs. There is nothing more exciting than moment when the cheated program starts on your pseudo computer- emulator.
So, we have determined with ideas. Lets once again enumerate benefits from processor emulator:
- Increase of own self-concept;
- Ability to work with documentation on the target processor;
- The benefits of research of cheated program;
- Pleasant memories about the past days.
How to build an emulator. In principle, it is a common program. Targeted program, which emulator must execute is fed on its input. To do this, you must program the program's response to all possible kinds of CPU codes, ie create a disassembler, analyzer and performer. Disassembler is needed to convert the machine code into a more understandable code for circuit analysis, the analyzer has to decide wether to execute code directly or emulate the action of the real processor, and the performer conducts direct operation. All these three algorithms can be realized in one. The first step: for pseudo computer is allocated memory (in real memory or on disk). After that, research program is loaded "into the memory" and then an emulator starts to perform it from the first address "in this memory". And if you do everything right and do not make a mistake, you will see a small miracle - an emulator will walk at the addresses, jump in the case of transitions, write and read data from cells, work with input/output ports... You can always stop it, see dump (snapshot) of memory, experiment, increase the operating speed or slow down it, read the report on completed operations. For example, if the program is working with ports, then in real program is very difficult to "catch" these codes, and in the emulator - its no a problem! You can even specifically configure an emulator so, that it will enter a separate report for each operation with these ports or other registers you're interested in. Especially interesting visual effect appears when the program displays information on the screen. It is best to start with processors emulators, which were installed in computers, which have no graphics (for simplicity). Next - for those who have worked with graphics.
Of course, now there are a lot of different emulators, and they all are working. And old programs can be downloaded from the Internet or found in old dusty disks. But its more interesting to create an emulator by your own hands - alien program can not be compared with your own. And benefit of such "research" will be doubtless. And only then you can think about: how to develop this idea? Well, for example, to write an emulator of your work computer, which will emulate your working operating system. Or catch and "torturing" a virus? Or find loopholes in Windows and fix them? Is it weakly for you?