For learning purpose i intend to start building a 8051 microcontroller emulator. I am comfortable programming in C/C++/C#. This is no class project etc but a learning initiative from my side.
I did found quite a lot of questions discussing this. However, I wanted to break it bit more on a granular level so that I can know which areas I need to focus before i actually start writing the code.
My initial requirements are:
text editor(can use editbox control) where the user can write assembly code
Validate if the syntax is correct
Have small window which shows the register values at run time.
when user starts the program, the instructions should be step by step updating the register windows.
More than the GUI element i am more interested to know how to emulate the microcontroller.
The way I understand I can further break it down:
I need to have a look up table for instructions or some other way to store available instructions and validate the syntax. Any pointers how to implement this, please let me know.
How do I emulate each instruction for 8051?
For registers, i can have the use un/signed integers based on the type and update the table.
Since microcontroller has limited RAM memory, how do I keep a check of the code length or rather the code which is executing in the memory to avoid and buffer overflow or other issues.
If there are some opensource projects which detail how an emulator is built ground-up, would appreciate.