17

Given the memory referencing limits of MS-DOS for compatibility purposes, why didn't games produced for the 286+ processors eschew MS-DOS and talk directly with the BIOS or IO hardware, instead of all the optimisations necessary to maximise the conventional memory available and provision of extended memory drivers, etc.?

user3840170
  • 23,072
  • 4
  • 91
  • 150
Chorlton2080
  • 179
  • 1
  • 1
  • 4
  • 20
    "why didn't games produced for the 286+ processors eschew MS-DOS and talk directly with the BIOS or IO hardware" Some did. And a lot of games did use some direct hardware access but may have still used DOS for some features, primarily the file system. – ecm Feb 12 '24 at 00:06
  • 12
    I'd argue (but I don't know enough to produce a really good quality answer) that you had 3 categories of functions - ones where MS/PC-DOS was good enough and clearly not worth doing low level (e.g., file access), ones where everyone did do direct access (e.g., video) and things where there were just too many variations to reliably mass-produce a program doing direct access (extended memory) so that some reliance on MS/PC-DOS/drivers/etc. to at least get things started was needed. – manassehkatz-Moving 2 Codidact Feb 12 '24 at 00:12
  • 39
    This seems to reduce to "why do operating systems exist?". – dave Feb 12 '24 at 00:26
  • 1
    AFAIR dos4gw extension solved most of the mentioned issues (it allowed to access memory higher than 640kb in a standard way), so instead of re-implementing many of OS stuff, programs just used dos4gw that was free. this was available only 386+ CPUs though... – morgwai Feb 12 '24 at 18:13
  • 4
    BIOS has no notion of named files, only sectors on a media. You generally want that. – Thorbjørn Ravn Andersen Feb 13 '24 at 16:22

6 Answers6

47

You need to run the game somehow.

There were some early booter games, but as soon as you had a hard drive, users typically want to store programs, including games, on the hard drive, as files.

When your game is on a hard drive with DOS, the DOS must be started and running in order to run the game executable program file.

Which meant that your game needs to start running in an environment where DOS, any XMS and EMS drivers are already loaded, or other peripheral drivers like mouse driver or keyboard driver for using a specific keyboard layout for your language, in order to load the game and let it use the possibly hardware-specific memory drivers and hardware-specific mouse driver.

However, the video card and sound card were generally used directly by a 286 DOS game, as they rarely had any drivers that you needed to load under DOS (exceptions exist of course, such as 386-era sound cards like PNP Sound Blasters to enable usage of card, and for Gravis UltraSound to emulate a Sound Blaster or Roland MT-32 for games that don't support GUS directly).

And that is exactly what happened with 386+ CPUs. You had a game executable, which was really a DOS extender that set up a 32-bit protected environment for a payload which was the 32-bit game binary image.

Justme
  • 31,506
  • 1
  • 73
  • 145
  • All the examples you list (except, maybe, the keyboard) neither had any support in DOS that you could possibly "by-pass" nor in BIOS that you could possibly "by-pass to" - so seem to be particularily bad examples to answer the OP questions. – tofro Feb 12 '24 at 09:27
  • 6
    @tofro For example the mouse is a very good example. You had different interfaces, you had bus mice, serial mice, PS/2 mice, and USB legacy support in BIOS to support USB mice as legacy PS/2 mice. Each interface was different (bus mice could exist in different IO area and show movement differently, serial mice could be connected to different COM ports at different base addresses and interrupts and you had different serial protocols like Microsoft and MouseSystems that need the bytes interpreted differently). PS/2 had scroll wheels too. You only had a DOS driver program with your mouse. – Justme Feb 12 '24 at 09:40
  • Support for mouse never was in the IBM PC BIOS, and it never was in MS-DOS, so I don't get how this would be an example. Only very late BIOSes actually had rudimentary support for mice to introduce mouse control to their setup screens. – tofro Feb 12 '24 at 09:47
  • 2
    @tofro How do you get DOS programs to support mouse? By providing a DOS program as the mouse driver for the specific mouse, and DOS programs can use a common driver API and does not need to know what kind of mouse there is on what kind of bus. It would be unlikely that a game would add support for different mice. Or different CD-ROM drives. – Justme Feb 12 '24 at 10:03
  • That would work out to a loadable driver, not to DOS - My understanding is the OP asks for "DOS" in a sense to what you could find on your MS/PC-DOS disks. If at all, I would maybe refer PC mouse drivers as "loadable BIOS extension" and never as a "DOS component". Mouse drivers typically don't use or require any DOS function at all. – tofro Feb 12 '24 at 10:11
  • 2
    @tofro My point exactly! The mouse driver is also a file on DOS disk, and needs DOS to be able to load it. If you were making a game that can run without being loaded from DOS, you have no mouse driver and your game would need to support each and every mouse interface and protocol by itself. And also difficult to run the game from a file on disk, if there is no DOS, or even if started from DOS, you can't access files if you throw away the layer of DOS which provides you a file system. If you had a single hardware, like gaming console, you could run anything on bare metal without DOS/BIOS. – Justme Feb 12 '24 at 10:30
  • 2
    Int 33h is a standardised DOS mouse interface. Whether it is "part of DOS" or not, or "part of BIOS", is semantics, but most DOS applications would use int 33h to talk to hardware-specific drivers, not implement the mouse drivers themselves. Sound and video are better examples of things largely done by direct hardware access. – ecm Feb 12 '24 at 11:12
  • Out of curiosity since I'm not a computer scientist nor programmer, before the 386 and protected memory (and I suppose rings), was it possible to simply push all DOS off the stack to get full access to all memory and robbing the user from any "Exit to DOS" but rather Exit=reboot? – winny Feb 12 '24 at 12:50
  • 2
    @winny You could do anything you wanted and nothing would stop you. Except for things like disk caches which might have pending writes, so shutting down DOS and throwing it out was not an expected or supported operation. And in 386 days, you could boot into DOS and load Linux kernel and start it so it was actually done too. Booter games were also converted to COM files and they did not expect DOS present. – Justme Feb 12 '24 at 12:58
  • @tofro The mouse driver is a standard DOS driver, installed like any other. It offering an INT based interface doesn't change that - same as with EMS and others doing so. – Raffzahn Feb 12 '24 at 13:21
  • 1
    @winny Since there was no memory protection one could of course replace DOS at all,using it only as some boot service. If not booting from BIOS directly into the game code. Still, if the game needed file it would need to bring it's own DOS likeservices for devices and file systems, so not much to save here. More important, the whole point of DOS was to unify disk access, no matter what configuration, Floppy or hard disk, SCSI vs. IDE, vs whatsoever. Same going for various file systems. From today's view DOS isn't much more than a a glorified loader anyway .) – Raffzahn Feb 12 '24 at 13:26
  • @Raffzahn In a "system that is providing DISK services and not much else"? ;) – tofro Feb 12 '24 at 13:33
  • @Raffzahn Yes, I understand the drawbacks. For a word processor or similar it would be a bad idea but for a game developer who needed the last bit of RAM available and no need for disk access once started, I was curious if it was an option. Perhaps coming from the Amiga scene and porting a game over to PC. – winny Feb 12 '24 at 13:40
  • @Raffzahn Mouse drivers generally were not DOS .SYS device drivers loaded from CONFIG.SYS but simply TSRs. EMS drivers were loaded from CONFIG.SYS. – Justme Feb 12 '24 at 13:47
  • @Justme Err... then why was it called mouse.sys ans installed with CONFIG? Yes,I know, after Version8 it was also available as TSR - to support loading only when needed. – Raffzahn Feb 12 '24 at 15:01
  • 1
    @Raffzahn I dunno; my mouse drivers were never SYS driver files. We obviously had different mice then. – Justme Feb 12 '24 at 15:12
  • @Justme Well, I started with Microsoft's Bus-Mouse, than serial then PS/2. The SYS driver was the original one,the COM version was introduced around the late 1980s, ca. when Win 3.0 was a thing. The Reason Microsoft added this was that Windows brought it's own mouse driver, so not loading it by default (CONFIG.SYS) but optional freed base RAM for use by Windows. – Raffzahn Feb 12 '24 at 15:41
25

We need to look into this in a bit more detail. There were indeed a limited amount of "direct boot" games that completely by-passed DOS and implemented their own low-level hardware support. (As you have limited your question to 286+ systems, these games, however, don't really fit into that scheme. They were mostly obsolete when 286 systems were common).

By-passing DOS, at least for storage, proved to be hampering support for specific hard disks, storing game state anywhere else but on floppy disks and really didn't save that much memory (DOS used to be, at least in the beginning, indeed, a very slim operating system). I would assume the reason for those self-booters was actually more copy-protection than anything else. Note most of these games date from the early 1980s, that is, when you basically could assume you didn't have to support more than a CGA card, maybe the joystick interface, the keyboard and the PC speaker - all hardware that had somewhat "standard" interfaces and hardware locations in the PC architecture, so it was relatively safe to directly access the bare metal. So, these games were indeed, for the most part, not only circumventing DOS (apart from storage), but also the PC BIOS.

Over the whole DOS era, there were a lot of (I would even claim, nearly all) games that by-passed DOS and went to BIOS (or, rather, directly to the hardware) for video (I would guess only very simple games like text adventures were actually using DOS screen I/O functions). But most of these didn't even use the BIOS as well but instead went directly to the hardware - the functions that the video BIOS offers to a game developer, are indeed, apart from detection and mode setup functions, really limited.

In the early times, the choice of possibly supported hardware was often limited to CGA video - That was easy to implement and didn't exactly require rocket science to produce something faster and more game-oriented than what the PC BIOS offered. This changed a bit with upcoming EGA, VGA and more obscure (Tandy, Amstrad PC, Plantronics,...) video standards that caused game developers to produce specific versions that might or might not have been delivered as specific packages or various versions in one package. During this time, you really had to read the fine print on any game you bought.

Most games took the easy way and used DOS to store game state or generally, DOS functions for access to storage media. This ensured you could save your games to specific media that required loadable DOS drivers.

For mouse support, most games used the "standard" driver that came with your system (I would consider these "loadable BIOS extensions", as there really wasn't ever anything DOS-specific in those drivers). Sound was a bit of a problem until AdLib/Sound Blaster were basically the card to have. These cards were typically accessed on bare-metal level by the games, by-passing both DOS and BIOS (neither had any support for sound anyways).

Towards the end of the DOS era, when games outgrew the memory supported by DOS*, they tended to come with DOS extenders like DOS/4G and DJGPP (and many more) that created a 32-bit environment on top of DOS, replacing most of the DOS functions with own code. Even if these still used DOS and BIOS for some functions - mainly for bootstrapping, they had to in fact by-pass a lot of it once they had entered protected mode, because neither DOS nor BIOS have support for protected mode applications.


*One of the milestone games that made everyone struggle with their DOS setup for conventional memory (and EMS/XMS as well) was the Wing Commander series. This really forced everyone to install memory managers for expanded and extended memory, optimize their driver load order and UMB/HMA usage to free up conventional memory, sometimes even causing people to implement specific "Wing Commander boot configurations", in short, was a bit of a nightmare to get running, clearly showed the "plain" DOS architecture was at its end to support large games and it was about time to - if you wanted to continue to make DOS games - jump on the DOS extender wagon (The games, however, were still extremely popular, even if they were a nuisance to get running).

tofro
  • 34,832
  • 4
  • 89
  • 170
  • Most games used BIOS to configure the display mode they needed, but then accessed hardware directly after that. All common display card configurations that displayed fewer than 256 colors would allow operations to be performed on groups of four or eight pixels in about the same amount of time (or in some cases less time) than operations on individual pixels, but the only BIOS function to draw graphics was limited to plotting a single pixel. Drawing an entire screen would take over a minute on CGA; EGA and VGA were generally even slower. – supercat Feb 12 '24 at 18:13
  • @supercat Of course. Before the advent of VGA and SuperVGA cards, the BIOS HW detect functions and mode initialization were useful to detect and initialize what you had. Most people started to write their own detect functions after that because the BIOS often simply didn't reveal much detail and didn't support all possible VGA modes. And yes, I did write "...video BIOS offers to a game developer, are indeed really limited." exactly for that reason. – tofro Feb 12 '24 at 20:25
  • I don't think the BIOS function to draw pixels was very well known; if speed/slowness weren't an issue, the BIOS would have been sufficient to accomplish most of the graphics games wanted to display before the advent of Super-VGA resolutions, but there were few tasks for which BIOS-level slowness wouldn't have been an issue. – supercat Feb 12 '24 at 20:44
  • The PutPixel interrupt was way too slow. What was usable were the text output functions in graphics mode - They were handy to simply put some text onto the graphics screen when you didn't want to go through the hassle of providing your own routines and character set. – tofro Feb 12 '24 at 20:52
  • Another important category of DOS drivers, back in the day, were network drivers, and particular Novell's filesystems. – Davislor Feb 12 '24 at 20:59
  • @davislor The question is about games, remember? – tofro Feb 12 '24 at 21:58
  • @tofro Which I sometimes played over NFS as an undergrad, and therefore needed to be able to read and save files over the network file system. Although multiplayer games would’ve been played over a modem or null modem cable, which might either use the hardware directly or a DOS device like COM1. – Davislor Feb 12 '24 at 22:03
  • Yes, I remember deleting everything (Windows etc.) from my 30 MB hard disk, going through 20 floppies and massaging the autoexec.bat for days to get WC: Privateer to run. It needed 638 kb of free conventional memory, so you had to load all your drivers to extended memory ... – Georg Patscheider Feb 14 '24 at 12:33
  • tiny correction: DJGPP was not an extender but a unix-ish distro & compiler expecting an extender. Specifically, DJGPP v2 worked with the CWSDPMI extender. – Beni Cherniavsky-Paskin Feb 14 '24 at 16:35
9

You mean beside the fact that this would make it impossible, or at least quite complex, to install Games on hard disk - which was standard in AT times and later. Likewise for returning to DOS after the game.

Also, it's always important to keep in mind that DOS is in no way like OS that we know today. From today's PoV DOS isn't much more than a glorified boot loader that stays resident. GRUB got more complex features than DOS. Didn't provide much services beside abstract disk access (hiding hardware and file system). The same goes for drivers like mouse or EMS. All extreme bare bone and not much to save there - if that service is needed.

And that's what having different configurations were about slimming down all the overhead one loved to have for regular work (from extended keyboard handler and printer buffers all the way to sidekick and all the other TSR). One had a one for regular work and one optimized for gaming, selected during boot.

Given the memory referencing limits of MS-DOS for compatibility purposes, why didn't games produced for the 286+ processors eschew MS-DOS and talk directly with the BIOS or IO hardware,

Keep in mind that DOS was a rather slim. DOS 2.0 needs only about 24 KiB and even 3.3 is still less than 48 KiB. Eliminating DOS would not save much as the games would need to somehow provide the same services.

instead of all the optimisations necessary to maximise the conventional memory available and provision of extended memory drivers, etc.?

With games made for 286 and later and using_ 286+ features, those optimizations weren't really a thing, as those games used the memory above 1 MiB. All that CONFIG.SYS wrangling was only to help real mode games, those not using an extender, to work properly.

In fact, all those squeezings were way more common when it was about real mode applications than games. Get a few more pages into your word processor without swapping or lines in a spreadsheet.

Also, why should any game developer spend money to recreate disk services if they are already there - in a compatible way, supporting whatever configuration the user had?

Raffzahn
  • 222,541
  • 22
  • 631
  • 918
  • 4
    I'm afraid you seem to be ignoring that games actually did exactly what the OP asks for for video, regularily and commonly. – tofro Feb 12 '24 at 09:15
  • 1
    @tofro Erm, keep your cool, take a step back, and notice that there is no 'eschewing DOS' for video, as DOS doesn't offer any video services past a very basic terminal emulation. DOS is providing DISK services not much else. And using BIOS (as asked) for video is not really an alternative - even many text based business applications bypassed BIOS with direct screen access. – Raffzahn Feb 12 '24 at 12:31
  • 1
    I'm as cool as can be ;) But the basic gist of your answer ("never happened, because didn't make sense") is just misleading. (And, to be fair, what's not "video" with "basic terminal emulation") ;). I do agree the video BIOS was rarely used to push anything to the screen, but BIOS detect and init functions were quite handy before VGA and SVGA. – tofro Feb 12 '24 at 12:36
  • 1
    @tofro Say, how many commercial games were written for DOS (not BIOS) text mode? I'm sure there were some beside Gates' Donkey.BAS, but not really in a meaningful number and relation. Point is that DOS is about disk services, not much else. – Raffzahn Feb 12 '24 at 13:08
  • Don’t forget ZZT ;-). – Stephen Kitt Feb 14 '24 at 22:36
6

Short answer: Because no one wanted to implement an OS in a game...

Long answer: Most games that required filesystem access used DOS (or later, on 386+ a DOS extender). Since version 2.0, DOS provided good UNIX-like handle-based file system support, and BIOS INT 13h services abstracted disk I/O, so the applications wouldn't need to support different disk controllers and disk types (MFM, IDE, SCSI from tens of vendors, floppy disks, network drives, and so on). While it is possible to implement your own disk I/O driver and a filesystem, it wasn't very practical, as it would mean writing drivers for multiple disk controllers and potentially leaving some controllers unsupported.

BTW, most games didn't use MS-DOS or BIOS when it comes to graphics, sound, and user input devices (perhaps except of mice). The API provided by MS-DOS didn't include any graphics support, and BIOS graphics support was slow (it might have been used to setup a graphics mode, but not to draw the picture). Sound support in BIOS and DOS wasn't a thing either.

2

Being now an old dinosaurus allows me to remember those days. Not only games were using BIOS, but a lot of common programs also did.

There were 3 main reasons for that:

  • there was few MS/DOS level abstractions for sound for example besides sending a beep
  • handling graphics at MS/DOS level was far from being as efficient as handling them directly as hardware level, and computers were not as performant as current ones are... This was specifically required for games to provide an acceptable user experience
  • MS/DOS enforced no protection at all, so user level programs had direct hardware access

For example, I can remember writing a software getting values from meteorological stations through half duplex modems. Has MS/DOS had no provision for modem handling, my code directly dealt with the 8251 addresses...

On the other hand, I seldom used anything other than DOS for disk access... except for a tiny program able to rewrite the boot sector of floppy disks because of a virus that used to install itself there.

1

Hewing strictly to the question, the bottom line is that the BIOS was no more "extended-memory safe" than was DOS.

As others have said, much- arguably most- software on IBM PCs or strict compatibles went directly to the hardware for much functionality. The BIOS was used relatively little, except for- for example- putting a video card into a specific mode.

Mark Morgan Lloyd
  • 2,428
  • 6
  • 22