News for hackers. Stuff that matters.
Re:PC DOS 1.0, but Not Quite by userbinator on Friday May 26, 2017 @10:20PM (#14428602)
I follow the demoscene so I'm pretty familiar with the tiny-yet-featureful productions its produced, and yet the sizes on some of those binaries still somewhat surprises me --- an entire assembler is merely 6389 bytes! A "Hello World" compiled with GCC is roughly the same size ( http://timelessname.com/elfbin/ ). The DEBUG.COM debugger is 5450B, and the shell, COMMAND.COM, which contains 7 builtin commands, is merely 2576 bytes.

More amazing is the fact that the original developers probably weren't exerting great effort in size-optimising them either, unlike demoscene productions, and yet they're still extremely tiny.

Re:PC DOS 1.0, but Not Quite by zubat on Friday May 26, 2017 @11:29PM (#14428783)
I believe the main size optimization here comes from having only teletype and batch processing interfaces. When you do that, the surface area of the UI, and hence the amount of supporting code, drops tremendously. These early tools also skimped on error messages and checks, so the user experience was generally one of confusion and catastrophic error, despite being small and simple. You really needed the documentation to have any hope of understanding an old system.

Now we have operating systems that go out of their way to automate away everything and present it in real-time with multitasking and custom graphical elements everywhere, while also supporting many more protocols and hardware interfaces - wireless networking, GPU APIs, etc. The biggest growing pains seem to be past - things went from simple and stable to complex and unstable in the 1990's and then to complex and stable but insecure now. There's a lot of room to mature all of these features, but there aren't as many novel ones.

Re:PC DOS 1.0, but Not Quite by Shorel on Friday May 26, 2017 @11:25PM (#14428771)
One reason is that .COM programs were copied to memory as they were, in a single segment, and therefore could access a max of 64 kilobytes of RAM, and they itself could be max 64 kb. They are a tiny memory dump of the program.

.EXE programs have loaders that handled the segmented memory and could access much more, up to the 1MB of memory space. That loader of course made .EXE programs larger than .COM.

Re:PC DOS 1.0, but Not Quite by WalterBright on Saturday May 27, 2017 @02:18AM (#14429133)
> could access a max of 64 kilobytes of RAM

This is incorrect. A COM program had to fit its code and static data into 64K, but it could access as much RAM as existed on the machine.

A related misconception is that the segment registers in COM programs had to have all the same value. This is incorrect as well, as the program once loaded could reset them to any value.

Re:PC DOS 1.0, but Not Quite by nils-m-holm on Saturday May 27, 2017 @02:59AM (#14429215)
Indeed! First thing the executables generated by my early DOS compilers did was to set up the es: and ds: segments in order to get more space.

Eventually I overcame laziness though, and started to study the EXE file format, which, AFAIR, does not have a "loader", (as Shorel suggested) but just a header describing the layout of the file. I think EXE files tend to be larger, just because they can be larger.

Re:PC DOS 1.0, but Not Quite by int_19h on Saturday May 27, 2017 @09:24PM (#14432701)
MZ (DOS .exe) requires a loader - smarter than just "copy this whole thing into memory and jump to start", anyway - because it has a relocation table. But, of course, the loader is not part of the executable itself, so it doesn't contribute to its size. I suspect that the reference was to the relocation tables themselves.
Re:PC DOS 1.0, but Not Quite by int_19h on Saturday May 27, 2017 @08:56PM (#14432641)
> and they itself could be max 64 kb

Minus 256 bytes at the beginning for the Program Segment Prefix (hence why every .com assembly listing usually starts with ORG 100h).