Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
开发者_如何学C Improve this questionWriting emulators has always fascinated me. Now I want to write an emulator for an IBM PC and run MS-DOS on it (I've got the floppy image files).
I have good experience in C++ and C and basic knowledge of assembler and the architecture of a CPU. I also know that there are thousands of emulators out there doing exactly what I want to do, but I'd be doing this for pure joy only.
How much work do I have to expect? (If my goal is to boot DOS and create a text file with it, all emulated)
What CPU should I emulate ? Where can I find documentation on how the machine code is organized and which opcodes mean what, so I can unpack and execute them correctly with my emulator?
Does MS-DOS still run on the newest generations of processors? Would it theoretically be able to natively run on a 64-bit AMD Phenom 2 processor w/ a modern mainboard, HDD, RAM, etc.?
What else, besides emulating the CPU, could be an important factor (in terms of difficulty)? I would only aim for outputting / inputting text to the system via the host system's console, no sound or other more advanced IO etc.
Have you written an emulator yet? What was your first one for? How hard was it? Do you have any special tips for me?
Thanks in advance
To know what is required from your emulator to run DOS, I think the best place would be to turn to the FreeDOS project that has reimplemented a DOS clone. By studying the source, you should be able to come up with a list of requirements.
Concerning the opcode, you can consult X86 Opcode and Instruction Reference, or the Intel documentation. You should also consider using the recent processor capabilities for virtualization.
DOS should still be able to boot a modern PC, but would probably be unable to use most of the hardware (due to lack of drivers, or to inherent limitation of the "OS").
If you want to emulate completely a PC to be able to run MS-DOS (or a clone), I think you'll have to:
- decode and interpret opcode
- emulate memory controller
- emulate BIOS and VGA BIOS
- implement required BIOS syscall
Disclaimer: I didn't write an emulator.
Since MSDOS is pure 16 bit code it can not run on a 64 bit processor natively.
精彩评论