How can i make a program get into real mode DOS, then return to Win...

I have a few projects that could use this. First, i

want to make a program that will write directly to

video memory, and secondly, i need to make a

number-crunching function for a C program in assembly

that will run as fast as i can make it, and it is my

understanding that programs run faster in real mode

because they are not sharing resources with the OS.


Comments

  • Running a program in real mode DOS is not much faster than running it in Windows. Command.com runs all DOS programs at 90mhz, even ASM programs. (Another words, your program is run like it's on a 90mhz computer) When you go into real mode DOS, it uses command.com. It will go at the same speed either way.


    Also, to return to Windows from DOS, you'd just run c:windowswin.com. (Use interrupts, or tell user to type it at the DOS prompt)

    In most cases, it will start up Windows. Sometimes it may say it can't find a certain file such as himem.sys. Don't panic. That's where you must press CTRL+ALT+DELETE and restart back to Windows.


    Writing to video memory is like writing to regular memory, except you have to write to segment A000h

    You can only access 64K of video memory at a time. (Also known as a video bank)

    To switch to another bank, you'd do this:

    mov ax, 4F05h

    mov bx, 0

    mov dx, (bank number)

    int 10h

    DX is the bank number to switch to.


  • You're compiling it in 32 bit mode. You have to compile it with an old school 16 bit compiler.


    How do you think Wolfenstein and other things run under windows? V86 mode. You don't have to shutdown windows in order to run in "real" mode (it's an emulated V86 mode).


    Real mode is most definately NOT faster than protected mode, because many of the advanced techniques of pipelining, branch prediction, and caching can't be made use of by the processor.


    A gravity simulator I wrote is a full 10 times faster when I compile it in 32 bit protected mode than when I compile it in 16 bit real mode.


  • :Command.com runs all DOS programs at 90mhz, even ASM programs. (Another words, your program is run like it's on a 90mhz computer) When you go into real mode DOS, it uses command.com. It will go at the same speed either way.


    * takes off sunglasses, and pops out eyeballs*... SAY WHAT???? AFAIK that is the biggest load of crap I heared for years! Who told you this? It is simply not true. Command.com has nothing much to do with the way realmode is handled, and it certainly couldn't interfere with the SPEED your programs are running! The V in V86 stands for Virtual, not for step-by-step-interpretor-simulator.


    As a little extra, I will supply a counter-example: Your statement would imply that a dos program would barely run any faster on a p300 than on a p150 (assuming we write a piece of non-pairing code, which is actually quite easy ;-p) under windows. Well it does. It runs faster. About twice as fast, to be precise. Not very surprising, eh?


    The Watcher^TUHB


Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories