I am thinking about programming an online machine, nothing as fancy as virtualbox or vmware, but something which can emulate an easy architecture, whether it is cisc or risc, the Zilog, SPARC, MIPS, or 80686 architecture models.
I guess using this method it might be easy to create an emulator of the identical kind, I am just thinking about by using this for experience a lot more than other things (being my first C project, I'd rather do that in C compared to other things)
Check what others have completed in el born area!
A great way to pick-up information on a specific kind of application (as well as in your situation a great way to get c idioms too) is as simple as searching in the structure and also the detail of the free project of the identical type. One might wish to basically look, briefly review after which "forget", to be able to start a person's own project on your own, but in most cases this kind of visit is advantageous.
Because you pointed out "simple architecture" and Zilog, I believed the Z80 processor might be a good match. For a number of reasons you will find many current and past projects within the Z80 emulator genre. BTW, a primary reason is the fact that many older slot-type video consoles were running on Z80, which motivated nostalgic players to create emulators to operate their old faves -)
A good example of this type of project is YAZE-AG including both a complete Z80 emulator in addition to C/PM. The entire factor is designed in C. It is also relatively mature (Version 5.by) and active. I am speculating this is actually the work of the really small team (possibly of 1 -) ).
Best of luck!
This isn't an item endorsement, but an observation...
I'd get a Deitel and Deitel book to begin with. (most likely that one if you are searching to get it done in C) They always appear to possess one chapter on creating a virtual machine, together with some instructions for writing assembler code for the virtual machine, no matter the word what they are teaching.
Edit - Added
(although I'd take a look in a library before purchasing it just in case I am misunderstanding what it's you need to write)
A couple of ideas:
- The older instruction sets is going to be simpler, so they could be a great starting point.
- Select a risc architecture: decoding the instruction stream is going to be much simpler.
- Ignore such things as interrupts, NMIs, etc.
- Almost always there is lots of tricky detail in precisely emulating startup. Rather, pick something quite simple like beginning execution at address zero, with all of registers set to zero.
- Real programs will require such things as real hardware emulation too, so avoid that.
- You might like to extend the instruction set having a couple of special i/o instructions to see several, write a personality (or perhaps a string), etc, to ensure that you are able to write simple test programs that really do quite simple i/o.
- Parsing an item extendable like elf could be a large amount of work simply by itself. With tools like objdump, you are able to most likely extract only the text section (ie, the instructions) as binary (a minimum of ascii hex).
- Begin by writing a disassembler for whatever instruction set you need to emulate, or at best for that initial subset you'll aim for. You will need it for debugging anyway.
- Discover ways to get gas (gnu assembler) for the selected instruction set working to help you produce known good object files and test programs.
Unless of course you've understanding of other programming languages, and/or perhaps a reasonable knowledge of assembler, this can be a pretty challenging first C project. Never the less, best of luck!
A typical being active is to construct an easy calculator. It's merely a small group of procedures (typically 4,
* / + -), one datatype (number) and also you most likely possess a good knowledge of the way it should work. Which makes debugging a great deal simpler.
Regardless of the simplicity, you already suffer from some rudimentary VM problems. You have to parse an sequence of command, store multiple objects you are focusing on, and cope with output.
Coincidentally, calculator ICs would be the forerunners of Processor chips, which means this approach also is sensible from the historic perspective.