News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

64-bit programming in DOS

Started by MasmNew, November 07, 2007, 09:35:19 AM

Previous topic - Next topic

MasmNew

Dear All,
how to assembly 64bit program in DOS?
just using fasm?

Thanks a lot!

Mark Jones

I am curious about this also, will probably need to download the AMD processor spec and start reading. Just guessing, but I suppose the CPU has to be in some form of protected mode to access the 64-bit features.

An x64 system was recently built and the memory timings need to be optimized. I was wondering if it would be easier to build a tiny DOS app which reported a relative memory throughput, which could be compared quickly as the BIOS is adjusted, rather than booting a massive OS repeatedly and running a slow benchmarking suite. Anyone with an x64 knows that the BIOS settings are a little more complex than they used to be. :wink
"To deny our impulses... foolish; to revel in them, chaos." MCJ 2003.08

MazeGen

You can use new x64 features only in 64-bit mode, which requires 64-bit operating system. MS-DOS runs in real-address mode.

blackgen

Oh ! i am finding it also. and when will it be published?

Mark Jones

Well of course MS-DOS is real mode, but isn't it possible to place the processor in protected mode? I understand a project such as this is not an easy task. :wink
"To deny our impulses... foolish; to revel in them, chaos." MCJ 2003.08

MazeGen

You would need a 64-bit DOS extender. I don't know if there are any available.

bobsobol

I can't believe you are actually discussing this.

It would take some serious trickery to get an x64 extender for DOS. Something akin to the trick Microsoft played restarting the CPU momentarily on the early 286s to get Windows 2 (OS/2 converted to run under DOS after the Microsoft, IBM split) to work in enhanced mode even though it had already booted in DOS (real mode).

The x64 processor dumps down to x86 as soon as it reads x86 instructions, you can't bring it back up to x64 from that.

What you would need to do, is rewrite DOS as an x64 OS with full ELF64/PE64 style executables and include an x86 virtual mode to run legacy DOS software. The simple solution to this is VMWare, VirtualBox, or VirtualPC running DOS on Linux, BSD or Windows x64 version...

But if you guys want to work on a real 64-bit DOS, the freeDOS sources are openly available. Just remember, the compatibility of i386 native DOS has almost nill compatibility with existing DOS programs. The best solution so far is to compile Bochs or DOSBox for extender stripped DPMI DOS or 32bit PE (depending on your executives preference) and run DOS apps inside them... again, the question has to be... why bother, when a custom DSL (Damn Small Linux) would give you so much more for less space and effort?

I'm not flaming, just pointing out some of the practicalities. And because sometimes it's not about the end project, but the knowledge gained by undertaking the attempt; here are some of my suggestions for places to start looking:-

HX DOS is a free DOS extender which gives DOS PE compatibility, allowing console Win32 programs DLLs etc to work under DOS environment, and also extends OpenGL and SDL to work... this means even some Windows ports of Linux games and demos work. Good as a source of reference if you are going to build executive recognizers for 16bit, 32bit and 64bit executables.
http://www.japheth.de/HX.html

FreeDOS32 is a complete from the ground up 32-bit DOS. This is what you need to do if you want to work like DOS but on a different platform to the 8086 / Z800 DOS was released for.
http://freedos-32.sourceforge.net/

You could also look at RxDOS. It's a very very small implementation of a DOS like OS with some reasonable compatibility, designed for embedded systems.
http://rxdos.sourceforge.net/

Mark Jones

Personally I'm not talking about building a custom-made, 64-bit "DOS" application... since you are right, a 64-bit DOS would have to be completely rewritten. I'm talking about booting the PC from a floppy into 64-bit mode, and running a simple memory benchmark. No need for a complete DOS. :-)

This (open source) package is tiny, bootable, identifies my processor as 64-bit, and accesses ram (although I don't see where it does so in 64-bit mode, but this is being investigated.)

http://www.memtest.org/

"To deny our impulses... foolish; to revel in them, chaos." MCJ 2003.08