Oldskooler Ramblings

the unlikely child born of the home computer wars

Archive for August, 2018

Vintage DOS Memory Conventions Explained

Posted by Trixter on August 20, 2018

Confusing expanded (EMS) memory with extended (XMS) memory happens all the time in the vintage PC/DOS computing hobby for those new to those terms.  Which is which?  What does my hardware support?  Do I need them?  This article will attempt to explain, as succinctly as possible, what each “type” of PC memory is and how it is used.  This article is not an extensive technical dive, but is meant to be an explanation of DOS memory conventions for the novice DOS user who is new to using DOS.

Protected Mode memory (DPMI, VCPI, DOS extenders, etc.) are not mentioned in this article because they typically don’t require any user intervention to work (ie. DOOM comes with DOS4GW.EXE and it just loads and works automatically).

Terminology used in this article

PC: Any IBM PC  or compatible system from the 1980s and 1990s running DOS.
8088: Shorthand for the entire 8086 CPU class, which includes the 8086, the 8088, the NEC V20, and the NEC V30.
640KB: The typical limit of memory DOS can access.  (Exceptions for DOS to access higher than 640KB exist, but are not mentioned to keep this article understandable for the layman.)

Quick history of memory on the PC

The 8088 CPU in the first IBM PC could access up to 1MB of memory.
Later, PCs built with the 80286 CPU could access up to 16MB of memory.
Later still, PCs built with the 80386 CPU could access up to 4GB of memory.

All PCs can directly access the first 1MB of memory.  Accessing memory beyond the first 1MB requires functionality only 80286 and later CPUs have.  Memory that extends past the first 1MB is called Extended Memory.

Because 8088 CPUs can’t access Extended Memory, special memory boards were created for them that fit into their system expansion slots.  These boards contain extra memory visible somewhere in the first 1MB, where the 8088 can see it.  The memory provided by these special expansion boards is called Expanded Memory.

Memory types in detail

EMS, XMS, conventional memory, UMBs… what does it all mean?  Here are some definitions:

Conventional Memory

What is it?  The first 1MB of memory visible to all 8088 and higher CPUs.  DOS is loaded into the area from 0-640KB and manages it.  The area above that, from 640KB to 1024KB (1MB), is typically used by the system hardware and not generally available to DOS programs.
How do DOS programs use it?  DOS provides function calls for allocating, resizing, and deallocating memory blocks for program use.  (Alternately, programs can directly access any portion of the first 1MB of memory they want to, although doing so can be risky if the programmer is inexperienced.)

Extended Memory

What is it?  Memory visible beyond the first 1MB, usually physically located directly on the motherboard, but sometimes provided by adding memory cards.
How do DOS programs use it?  Via an API called the eXtended Memory Specification, also called XMS.
What provides XMS?  XMS is provided by a driver called HIMEM.SYS, loaded by CONFIG.SYS at boot time.
How does XMS work?  XMS provides function calls that DOS programs can use to copy data between conventional memory locations and extended memory locations.

Expanded Memory

What is it?  Memory provided by special expansion cards.
How do DOS programs use it?  Via an API called the Expanded Memory Specification, also called EMS.
How is EMS provided?  Via a driver provided by the expansion card manufacturer.  Each card has a different driver and you must use the correct one for your card.  The driver configures the card for use, and provides EMS function calls that DOS or programs can use to access the memory on the card.
How does EMS work?  EMS boards provide a small “window” into the memory they contain, and this window is located somewhere in the first 1MB of RAM where 8088 CPUs can access it.  To access more memory, programs issue EMS function calls that “move” the window to a different area on the card, changing what portion of the larger memory shows up in the small window.

A quick note about EMS:  If you want to run a program that uses EMS, but you don’t have an EMS board in your computer, don’t fret: You can emulate EMS on any 80386 or higher.  This is done by loading a memory manager such as EMM386 or QEMM.  One of the services provided by a memory manager is to section off a portion of Extended Memory and present it in response to EMS function calls, like a real EMS board would.

Upper Memory

What is it?  The upper portion of Conventional Memory located between 640KB and 1024KB (1MB).  There is typically no user-accessible memory in this area, but 80286 and higher systems can relocate portions of Extended Memory into this area for use by DOS programs.
What is it used for?  The total amount of upper memory available is typically very small, between 64KB to 128KB, but this amount can still be useful for loading small memory-resident programs or drivers outside of Conventional Memory.
How do DOS programs use it?
  XMS provides functions for allocating and deallocating memory in this area in units of “blocks”, called Upper Memory Blocks, or UMBs.
How are UMBs provided?  For 80386s and higher, DOS comes with HIMEM.SYS and EMM386 which, loaded together, provide UMB functionality.  For 80286s and lower, there are programs (such as QRAM or USEUMBS) that use “shadow ram” functionality provided by the 80286 system’s chipset to perform the mapping.
How does upper memory access work?  Once a program is provided an upper memory block via a UMB functional call, it can be accessed the same way conventional memory is accessed, ie. directly.

Guidelines to running DOS programs

  1. First off, simply try to run a DOS program.  Most run without needing any special memory configuration.
  2. If you have an 80286 or higher, always load HIMEM.SYS in your CONFIG.SYS file.  There’s no harm in installing it even if programs don’t use it.
  3. If you want to load a single program on a 386 or higher to manage all of this for you, install QEMM.  QEMM will manage all of your memory and provide your programs with either XMS or emulated EMS based on what each program asks for.
  4. Finally, if a program claims to support both EMS and XMS, choose EMS.  EMS is faster than XMS.

Posted in Vintage Computing | 4 Comments »

Using a Sound Blaster in a PC/XT-class system

Posted by Trixter on August 3, 2018

I’m asked this a few times every year: Can you put a Sound Blaster in an IBM PC, PC/XT, or otherwise 8088/8086-class system?  If you can, is there anything that can use it on that class of hardware?

The quick answer is yes and yes:  As long as there are no hardware conflicts, you can put any of these:

  • Sound Blaster 1.0
  • Sound Blaster 1.5
  • Sound Blaster 2.0
  • Sound Blaster Pro
  • Sound Blaster Pro 2.0
  • Pro Audio Spectrum 8
  • Pro Audio Spectrum 8+
  • Pro Audio Spectrum 16
  • Thunderboard

…into any system and it should work fine.  You’ll be able to use the onboard joystick port, and have Adlib/FM sound effects and music.

The longer answer has a caveat: There are less than a hundred sound-enhanced games that will run, and less than 20 of those will use the digital sound channel.  The Sound Blaster was commercially available to consumers in 1989, which was right as the 8088 era was coming to a close.  Only a handful of games were produced around that time period that supported the Sound Blaster and could still run on 8088-class hardware and supported the CGA graphics typical of 8088-class systems.

But, if you have a souped-up NEC V20/NEC V30 XT, you’re feeling adventurous, and you really want to hear some sampled (“digitized”) sound come out of your system, you can try running these:

Commercial games:

Legend:
1) Used the Activision OmniMusic driver. There might be more games compatible with 8088+CGA that use this driver.
2) Need the rare “16-color” version of this game which supports CGA 640×200 2-color mode

Shareware games:

Demos:

 

There might be more than the above, but this is all I can remember personally testing.

For possibly much more comprehensive information on this subject, you can do no better than to check out Great Hierophant’s Nerdly Pleasures blog, which performs deep technical dives into these and other subjects.

Posted in Demoscene, Gaming, Vintage Computing | 25 Comments »