This isn't anything to do with the "Component Object Model" a.k.a. "COM", nor has it anything to do with top-level domains. It's an obsolete (and good riddance) executable file format used by DOS (the file loader posing as an operating system, not the 31337 haxor d00d "Denial of Service" thing).

Is there a node for Acronym Namespace Depletion, or AND for short? (Not to be confused with the logical operator, nor with the Advanced Noumenal Dynamics Corporation of Sausalito California and points west.)

(I'm going to be speaking kinda vaguely here, but the precise details are irrelevant and I'm no guru anyhow.)

No, "com files" are the invertebrate morons of executables (also known as programs, roughly speaking). Most executables have a header at the beginning explaining what the thing is about, and giving locations in the file of code segment(s) and data segment(s), etc. The header is not in any "language" that makes sense to you. It's there for the operating system. When an operating system runs a program, it loads up the executable and reads the header. If the header is inconsistent or nonsensical, the operating system throws up its hands and refuses to run the program.

Assuming that all goes well, then the operating system grabs some space in memory, and according to what it finds in the header, it puts different parts of the executable file in various places within that space in memory. Finally, it "executes" the thing. What it "executes" is a very long series of very small, primitive instructions called "machine instructions" which tell the processor to perform idiotic and seemingly pointless tasks like moving a number from one place to another, comparing two numbers and copying the larger to a third location, or adding two numbers just for the hell of it and then discarding the result. That's all a computer can really do, but with enough of those little instructions in the right order, it can do damn near anything; as a matter of fact, you're soaking in it.

So. What is a com file? It doesn't have a header, is what it is. It's just plain raw instructions. When you "run" a com file in DOS or Windows, the operating system just picks up what's there, assumes blindly that the first byte in the file is an instruction, and starts executing. If the file is whacked, it will crash. If it's a 16-bit version of Windows or DOS, the whole damn computer may well crash. With Windows 95 or Windows 98, you've got a fighting chance at least. NT and Windows 2000 will almost invariably survive.

Try this at home: Make a little text file. Put some text in it, like for example your mother's maiden name. Change the "file extension" to ".com". Save any files you may be working on in other programs! Double-click your fake "com file" and watch what happens: Windows will try to run your "program", which will crash instantly. It won't be terribly exciting, but it's more fun than being poked in the eye with a sharp stick.


For the geekier among us: This was back in the 16-bit days, and a com file is necessarily just a plain image (no relocation, remember). So they're limited to one 64k segment for code, data, everything. All that memory model crap was for later formats. For reasons not entirely clear to me (nor entirely relevant at this point in time), so-called "Terminate and Stay Resident" programs or TSR's had to be com files. I know a guy who as a sort of party trick sometimes writes short com files with the DOS debug utility, just typing in op codes and whatnot directly into the file . . . He's scary.

Log in or register to write something here or to contact authors.