DOS subsystem

Here you can discuss ReactOS related topics.

Moderator: Moderator Team

Post Reply
Posts: 3
Joined: Fri May 20, 2005 4:35 am

DOS subsystem

Post by SANiK »

Well, I am working with a couple of buds on an OS called Halfix, the 4.5 nanocore.

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:
(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.
The question is not how to emulate the x86, but instead how to translate the opcodes.

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.

Posts: 76
Joined: Sat Nov 27, 2004 8:45 pm

Post by Delfi »

but why couldn't reactos just bundle dosbox for much better compatibility also with games?

Posts: 34
Joined: Wed Dec 08, 2004 12:26 pm

Post by rastilin »

Rather than doing the work ourselves, it would be better to depend upon an application that is already proven to be reliable.

Posts: 224
Joined: Fri Nov 26, 2004 9:21 pm
Location: Sweden

Post by Harteex »

I'd rather see a nice native support for DOS instead of using an emulator...

So this could be a nice beginning :)

Posts: 360
Joined: Sun Dec 19, 2004 12:42 am
Location: Australia

Post by Phalanx »

Dosbox is an emulator, so it does not allow the applications to interact with all the rest.

Dr. Fred
Posts: 607
Joined: Wed Dec 22, 2004 10:09 pm
Location: Amsterdam

Post by Dr. Fred »
Phalanx wrote:Dosbox is an emulator, so it does not allow the applications to interact with all the rest.
Is that good or bad in your mind ?
Where do you want ReactOS to go today ?

Posts: 3
Joined: Fri May 20, 2005 4:35 am

Post by SANiK »

Yes emulators are slow, but Virtual 86 mode is not there on 64-bit machines.
What are you going to do? Keep switching to Rmode on/off when it's needed?

In Halfix, what we are currently attempting is to make a "software based virtual 86 mode." That means, interrupts can be executed in 32 bit mode using translation. No need for VM86 mode or Rmode switching. Heck, one can take it farther and execute entire programs! The above code was tested (but it's still interpreter based and was used as a testing ground) and it can be used to enter VESA using the interrupt. (I should say again that the code is buggy).

As for the DOSBox option.
DOSBox is great and all, but the emulator is interpreter based.
That means that for mostly every opcode there needs to be flags generated. Do you know how slow that is? By making a core that translates 16bit to 32bit, speed is gained significantly!

Posts: 154
Joined: Thu May 26, 2005 3:43 am
Location: Slovakia

Post by etko »

16 to 32 bit translation seems interesting but it is possible? Why not all 16 bit programs are not translated to 32 bit that way today? How are you going to translate segment:ofsset far call pairs and segment:offset far data access into linear adress space? Are you going to convert them directly to 1MB adress? And what about program functions which accept only segment as parameter, I think that it's impossible to catch that...

Posts: 3
Joined: Fri May 20, 2005 4:35 am

Post by SANiK »

You are misunderstanding something. Translating 16bit to 32bit is not done once, but after every JMP instruction.

Think of it as an emulator that reads in instructions, converts them, and then executes them when a jmp instruction has been reached or when a ret instruction has been reached. Then it starts all over again.

Post Reply

Who is online

Users browsing this forum: Baidu [Spider], Bing [Bot], Google [Bot], Semrush [Bot] and 4 guests