Well, since 64-bit mode doesn't allow use of the BIOS, we started implementing a method that emulates the x86 16 bit.
Here's the buggy source, but it may not be of any use now:
http://jamesseph.phpwebhosting.com/users/sanik/vm.c
(The reason it's buggy is due to an incorrent opcode table I had foolishly relied on)
Although, this core is an interpreter based core. To allow for speed, I am planning to rewrite the core so it uses look up charts instead of emulating the CPUs registers and flags. So the idea would be to convert/translate 16 bit opcodes to 32 bit ones and then have the CPU execute them.
Hence, allowing blazingly fast speeds for running DOS programs.
Conversion factors:
- Prefixes need to be changed to 32-bit. (0x66 would be removed when going from 16 bit to 32 bit, vice versa it would be added. Same for 0x67)
- The segment registers are not available. So one needs to filter prefixes, and apply the change in the regenerated mode-rm byte.
- The mode-rm byte has 256 possible combinations which could neatly fit into a conversion array.
One could even take the idea further and cut the program being translated into sections. When a section has been translated, it could be saved and reused again until that section has been changed.