News for hackers. Stuff that matters.
Re:The Life of MS-DOS by mrlonglong on Sunday February 13, 2022 @12:29PM (#30323515)
I've wanted to re-implement DOS in pure assembler for years to have that lean and mean that uses less memory than MS-DOS but never had the time.
Re:The Life of MS-DOS by ok123456 on Sunday February 13, 2022 @12:53PM (#30323765)
The sources for MS-DOS have been floating around the net basically forever. The original first few releases are even on Microsoft's github. It largely is already in ASM. Some of the user programs are written in C.

To me, it would be far more interesting to see what modern compilers and development tooling could do towards producing DOS programs and operating system extensions. The tooling from back in the day was very baroque. You had to rely on different mutually incomparable dos extenders to get around all the limitations. (Just try to find the documentation to Phar Lap 386 in 2022.)

Re:The Life of MS-DOS by mrlonglong on Sunday February 13, 2022 @03:50PM (#30325552)
Personally for me it would be an interesting experience to see what and why they chose to do things they did with MS-DOS. One thing to try is to see if it's possible to write a 64 bit DOS extender.
Re:The Life of MS-DOS by oso2k on Sunday February 13, 2022 @04:18PM (#30325765)
There’s a couple attempts at running 64-bit in DOS. It usually has no benefits for old code and very little new 64-bit is being written and there are no libraries for common compilers.

https://github.com/Baron-von-Riedesel/Dos64-stub

https://www.bttr-software.de/forum/board_entry.php?id=15853

Re:The Life of MS-DOS by mrlonglong on Sunday February 13, 2022 @04:24PM (#30325827)
Nice one, thanks.
Re:The Life of MS-DOS by tored on Sunday February 13, 2022 @01:42PM (#30324305)
What would writing DOS programs and extenders with modern tooling accomplish? Trying to understand the goal.
Re:The Life of MS-DOS by ok123456 on Sunday February 13, 2022 @01:46PM (#30324344)
Making easy to understand and maintain programs in C++, with compilers that can that can do aggressive optimizations and inlining that compilers of the day could not do.

The STL didn't exist until the late 90s, and before C++98 it was a wild-west.

Re:The Life of MS-DOS by deckard1 on Sunday February 13, 2022 @07:09PM (#30326989)
> with compilers that can that can do aggressive optimizations

we're still talking about real-mode DOS here. Most of those optimizations aren't going to work.

Regardless, you can target DOS just fine today. You'll need some code to bootstrap your program into protected/long mode and then your app has full freedom. You'll need to figure out the correct switches to pass to gcc to get it output a freestanding binary, and possibly a special linker script, etc.

Freedom but, let's be honest, no real utility today. You can't access the network because you'll need to write the entire network stack from scratch. You'll need to write a driver for your network hardware. Can't touch video without writing a driver for your Nvidia hardware. Or sound card.

I suspect what most people want from a "modern" DOS would be something like this: a very thin API layer that contains OpenGL (or Vulkan), audio, and networking capability. As well as drivers for common USB devices and something that can read/write FAT/exFAT. But once you add all of that you realize it's nowhere near as lightweight as old DOS was and your app now has a thousand more responsibilities that something like the Linux kernel is currently handling for you.

Re:The Life of MS-DOS by lmm on Monday February 14, 2022 @02:12AM (#30329111)
> I suspect what most people want from a "modern" DOS would be something like this: a very thin API layer that contains OpenGL (or Vulkan), audio, and networking capability. As well as drivers for common USB devices and something that can read/write FAT/exFAT. But once you add all of that you realize it's nowhere near as lightweight as old DOS was and your app now has a thousand more responsibilities that something like the Linux kernel is currently handling for you.

I think people may be looking for something like a unikernel framework. Something like Linux is a lot of overhead if all you want to do is run a single program on a machine (virtual or physical).

Re:The Life of MS-DOS by krkixohjk on Sunday February 13, 2022 @02:05PM (#30324534)
But what is the goal in having maintainable ms-dos software?

The OS is still ancient and lacks most every possible security measure.

Every program can r/w any memory and so on…

Re:The Life of MS-DOS by ok123456 on Sunday February 13, 2022 @02:16PM (#30324639)
The fact that it gets out of your way is a feature. Why does security matter on a single user, non-multitasked environment with no networking?

The netsec industrial complex has really set back computing.

Re:The Life of MS-DOS by wyldfire on Sunday February 13, 2022 @03:46PM (#30325492)
MSDOS did have MMU support since 80386, IIRC. So I think GPs claim might be inaccurate. But it wasn't a security feature, it was a productivity feature. It protected your programs from defects in other programs and vice versa. This helps programmers find defects during design and helps users for defects that escape testing.
Re:The Life of MS-DOS by spc476 on Sunday February 13, 2022 @06:11PM (#30326542)
[citation required] for the MMU support of MS-DOS.
Re:The Life of MS-DOS by lproven on Monday February 14, 2022 @06:52AM (#30330923)
DR and MS DOS 5 and later have a 386 memory manager which can put an x86-32 CPU into Virtual 86 mode, remap RAM over any unused blocks in the I/O and ROM area (between 641kB-1024kB) to make Upper Memory Blocks, and load small resident parts of the OS into those blocks in order to keep as much base memory (0kb-640kB) free.

These memory managers could also turn the extended memory (above 1024kB) into managed XMS or EMS memory. LIM EMS was accessible to DOS apps and XMS to DOS-extender apps.

These were killer features in 1990 or so, and I made good money from optimising DOS memory for clients around that time.

Re:The Life of MS-DOS by ok123456 on Sunday February 13, 2022 @06:19PM (#30326605)
Re:The Life of MS-DOS by spc476 on Sunday February 13, 2022 @07:10PM (#30326995)
Just replying with a web page showing the 80386 has having control registers doesn't imply that MS-DOS used them in any meaningful way.
Re:The Life of MS-DOS by ok123456 on Sunday February 13, 2022 @08:02PM (#30327322)
The MMU is inside the processor. Any operating system running on an 80386 or higher has set registers/tables and gets hardware provided memory management.
Re:The Life of MS-DOS by shadowofneptune on Sunday February 13, 2022 @09:14PM (#30327725)
If it uses it. Later versions of DOS did very little with the features the 386 offered, which is why there were MS-DOS extenders.

https://en.m.wikipedia.org/wiki/DOS_extender

Re:The Life of MS-DOS by ok123456 on Sunday February 13, 2022 @11:18PM (#30328323)
You can make your own minimal DOS Extender just by setting those registers. This is what some games did.
Re:The Life of MS-DOS by xunn0026 on Sunday February 13, 2022 @04:20PM (#30325794)
I agree with the sentiment but note there were still viruses being circulated through floppy disks. So, 3rd party code may still be executed on a non-networked machine.

Indeed, it would be awesome to see how much a machine can do without all the layers. Even the Intel CPU security fixes could be bypassed and gain some extra speed.

Re:The Life of MS-DOS by tored on Sunday February 13, 2022 @05:04PM (#30326116)
Stuxnet is the modern variant.

Regardless of the qualities of DOS, the user interfaces of the graphical programs was in many cases superior compared to today, everything keyboard controlled, clearly labeled shortcut keys, views that usually only did one thing, distinctive coloring.

Re:The Life of MS-DOS by livrem on Monday February 14, 2022 @08:24AM (#30331686)
I took the time a few years ago to learn a bit about how to use Autodesk Animator (it was released with a BSD license some ~10 years ago and can be downloaded legally for free these days). Was really impressed with the GUI. Just press a single key to open the menu that begins with that letter, then the first letter of the menu-item you want to use. They managed to use only words that begin with unique letters while still making a lot of sense. Plus some other single-key shortcuts. And many, to me, unusual design choices everywhere, but it all makes sense and is consistent in a way that after a few hours I was not bothered at all by the fact that nothing was like a modern GUI, and there was definitely nothing about using more modern GUI conventions I can think of that would make it more pleasant to work with.

https://github.com/AnimatorPro/Animator-Pro

Re:The Life of MS-DOS by ok123456 on Sunday February 13, 2022 @05:32PM (#30326301)
Stuxnet happened even with all of those protection mechanisms in place.
Re:The Life of MS-DOS by tored on Sunday February 13, 2022 @08:36PM (#30327508)
To my knowledge the targeted PLC lacked any form of protection when infected.
Re:The Life of MS-DOS by ok123456 on Sunday February 13, 2022 @10:56PM (#30328211)
It spread first as windows worm that exploited several 0-days. If the host didn't have the Siemens PLC device drivers with a configuration that matched the exact configuration of what they were expecting for the centrifuges, they payload was dormant and it just replicated. Only if it matched would it patch the PLC's programming upon re-connection to fake reporting that the speed was normal while it was actually spinning out of control.
Re:The Life of MS-DOS by tored on Monday February 14, 2022 @04:02AM (#30329855)
Thus the security model of DOS is still a problem even without internet connection.
Re:The Life of MS-DOS by ok123456 on Monday February 14, 2022 @02:14PM (#30336795)
Thus window's security theater did nothing.
Re:The Life of MS-DOS by tored on Monday February 14, 2022 @05:16PM (#30339149)
You made a claim that it was unnecessary to have any security features on a non-network computer.

I have not made any claims about security features on a network computer.

Re:The Life of MS-DOS by ForOldHack on Sunday February 13, 2022 @06:36PM (#30326730)
My computer was 'Stoned.' Yes. I got a boot sector virus.
Re:The Life of MS-DOS by alophawen on Monday February 14, 2022 @04:38AM (#30330089)
Why did you invent the constraint "no networking"?

I had coax network on MS-DOS even back then.

Re:The Life of MS-DOS by lproven on Monday February 14, 2022 @06:53AM (#30330929)
DR DOS 7 did have built-in peer-to-peer networking: Netware Lite.

MS DOS did not, because that was the main selling point of Windows for Workgroups.

Re:The Life of MS-DOS by alophawen on Monday February 14, 2022 @06:55AM (#30330941)
Yea, there was alot of features that one is used to in modern OS that was missing in MS-DOS. It does not mean those features didnt exist or wasnt being used.

We used 3rd party TSR drivers for it.

Examples:

- MOUSE.COM driver https://www.vogons.org/viewtopic.php?t=58777

- CDROM driver http://manmrk.net/tutorials/DOS/cdrom.htm

- Network stack https://en.wikipedia.org/wiki/IPX/SPX

- Graphics driver https://dosdriver.de/graph.php

- Sound card drivers https://dosdriver.de/sound.php

Re:The Life of MS-DOS by lproven on Monday February 14, 2022 @07:19AM (#30331105)
Some of these things were included later on.

For instance:

DR DOS 6 had Netware Lite; DR DOS 7 had Personal Netware.

https://en.wikipedia.org/wiki/Personal_NetWare

I think several versions of DOS included MSCDEX.EXE (or DR's equivalent), but not the device driver, because back then there were lots of different CD interfaces: Mitusmi, Panasonic and Sony on sound cards, some early EIDE ones, and SCSI on higher-end kit.

Mouse drivers came with your mouse. ;-)

MS did have a network stack bundled for free on the NT Server installation CD, and some versions of it support server mode for peer-to-peer operation.

DOS could do all this stuff, but you had to assemble the bits from different sources, and this was sometimes for good reasons, sometimes technical (a profusion of incompatible CD-ROM interfaces) and sometimes commercial (P2P LAN support).

Re:The Life of MS-DOS by Koshkin on Sunday February 13, 2022 @05:28PM (#30326277)
> lacks most every possible security measure

So do calculators and typewriters. (Some people use computers to, gasp, perform computations, and low or no overhead is nice.)

Re:The Life of MS-DOS by kevin_thibedeau on Sunday February 13, 2022 @05:14PM (#30326176)
DOS serves as a good bootloader for an embedded system.
Re:The Life of MS-DOS by Koshkin on Sunday February 13, 2022 @05:30PM (#30326293)
Re:The Life of MS-DOS by userbinator on Sunday February 13, 2022 @11:55PM (#30328497)
I think the parent may be thinking more of "demoscening" the DOS kernel and basically optimising it to its limits. Yes, the original was written in Asm, but it's definitely not that highly optimised.
Re:The Life of MS-DOS by hulitu on Sunday February 13, 2022 @02:21PM (#30324696)
Taken into account how the modern compilers evolved, i don't have big hopes. They seem to become more bloated with every release.
Re:The Life of MS-DOS by oso2k on Sunday February 13, 2022 @04:10PM (#30325718)
gcc-ia16 and OpenWatcom are both modern compilers that generate as good a set of code as any compiler ever did for Pentium and older processors. But using a higher level language like C means there’s more than one compiler that can compile your DOS. That’s a reason to be hopeful if you’re a DOS developer.
Re:The Life of MS-DOS by boznz on Sunday February 13, 2022 @05:50PM (#30326397)
The compilers have probably got better but the C language has definitely bloated since the 80s
Re:The Life of MS-DOS by ok123456 on Sunday February 13, 2022 @02:24PM (#30324725)
constexpr code and move semantics didn't exist until relatively recently. These are steps towards less bloat and more aggressive optimization. They also can elide gratuitous copy construction.

There are a lot of these little optimizations that are found in modern compilers that you could only dream about in 1991.

Re:The Life of MS-DOS by 13of40 on Sunday February 13, 2022 @01:04PM (#30323911)
It was written in assembly code: https://github.com/microsoft/MS-DOS/tree/master/v2.0/source

This is a very old version, but I've seen bits and pieces of the last one they shipped and things like command.com and the "kernel" were nearly the same as this, except for maybe some memory management changes. What part did you want to reimplement?

Re:The Life of MS-DOS by bitigchi on Sunday February 13, 2022 @05:57PM (#30326442)
Why not contribute to FreeDOS?
Re:The Life of MS-DOS by Koshkin on Sunday February 13, 2022 @07:13PM (#30327018)
> lean and mean