The magazine of the Melbourne PC User Group

A Wander Down Memory Lane
Tom Coleman

I recently became introspective about the way that I was running the Managing your Memory courses. After looking at my lesson plan I decided that it was really pretty dreadful and I tossed it out. Now the way to get better at something is to pick everyone else's brains and plagiarise like mad. After all that's why we joined Melb PC wasn't it? We wanted to find someone to tell us how it is done. Beats the hell out of having to research it yourself.

With this in mind I set out to see how the other half lives. Let me tell you I am most discouraged. I was unable to find any good reading or source material on memory management. Don't misunderstand me, there is buckets written on the subject but it is largely incomprehensible. It assumes that you know at least half of what they are talking about and is choked with jargon .... Dreadful. Trying to pick out the important bits and organize them into a lesson was a harrowing experience. Having recently delivered that lesson plan I am now in the process of redoing it.

Like so many others who have tackled memory management I had allowed myself to get distracted by the details. It is all that minutiae that causes the brain to overheat. That is what inspired this article.

What follows is a broad outline. If you want the detail then go read the manual but don't come to me for sympathy. Another thing, Peter Smith would have to dedicate a whole issue of PC Update to this topic if I were to waffle on about everything. You can rest easy knowing that there is more to come. This time I will just define terms. Next time I will give you the basics of actually using this knowledge.

By memory I mean RAM. Not hard disk capacity or Virtual Memory or any other kind. Just good old fashioned Random Access Memory. Memory, is, for arcane reasons that are lost in the swirling mists of time, divided up into 64 kB blocks. It comes in three flavours; Expanded, Extended and Conventional. Conventional is subdivided into Base Memory and Upper Memory Blocks and the whole of conventional memory consists of the first sixteen blocks of memory in your computer.

For the number-numb readers, 16 blocks x 64 kB = 1 MB. (That's 1024 kB altogether.)

To help keep track of these sixteen blocks they are numbered. The first one is zero. The next few are numbered up to nine (that's ten so far). After that the voodoo priesthood of memory have given them letters, A to F (obviously).

Just as an aside, this method of counting is called Hex for short. If your computer has a Hex on it you should drive a wooden stake through its heart or shoot it with a silver bullet. It will then stop working.

I suppose they figured that the peasants would rebel against anything that smacks of new-fangled methods of counting so they gave the first ten (the ones with sensible numbers) to the users. That's where the 640 kB DOS limit comes in. This first 640 kB is called Base Memory or Lower Memory. Note the use of the words Base and Low. The implication is that the first 640 kB is in some way inferior and lacking culture. This is pure elitism by the designers of DOS.

Doubtlessly in an attempt to keep the great unwashed out of their inner circles they (the High Priests-Bill Gates looks good in a Mitre) kept the last six blocks, the ones numbered A " F, for themselves, and it is there that DOS stores the tools, and drivers and so on that it uses to do its housekeeping. They called this the Upper Memory Area or the Upper Memory Blocks. They used the word Upper to imply that this memory is in some way superior to that used by mere users. Again this is completely misleading and is a reflection on the attitudes of the dwellers of the inner sanctum.

However they did not really have very much to put into this remaining 384 kB (6 blocks of 64 kB each), the result being that there were, and still are, large chunks, even whole blocks of Upper Memory with nothing in them. Mind you they still set aside a bit in case you want to plug in a cassette recorder to store data. Not as a tape backup but as a substitute for a floppy drive. It was current technology-15 years ago.

It did not take users long to use all of their allotted 640 kB and they began to cast about for more. As it turned out, three principal sources of "more memory" came to light.

The first one was to add more memory on a separate card. This effectively became a parallel bank of memory. It was not part of the main memory system and could only shuffle small slices of data, 16 kB at a time, across to the main memory. It was restricted to passing these 16 kB pages over only into Upper Memory (blocks A to F). From there it was passed on to the program. There are a lot of restrictions on the use of Expanded Memory which is what it is called. You can't run programs in Expanded Memory. A program like Lotus 1-2-3 knows how to use it and its performance improves for having it.

If the program does not know how to use Expanded Memory (or Extended Memory for that matter) then there is no advantage in having it. The program must be written to use it.

The next method of getting more memory was genuine voodoo. Must have scared the wits out of the enclave of Bishops. Let me explain.

You can define a block of memory by simply defining its start as the first sixteen bytes of the block. Blocks do not have a fixed boundary. Just define the sixteen byte address and the next 64 kB is a block.

All these magicians did was to define the address of the last sixteen bytes of Conventional Memory. That's the last of the last block, Block F. Ta ra ra. A block of addressable memory appears above the top of Conventional Memory.

The man (it might have been a woman) who discovered this called it the High Memory Area. High, of course, suggests ascendancy over Upper. (He was burned at the stake and his ashes tossed in a cess pit). Initially access to the High Memory Area was only possible due to a bug in the 286 chip. This went on to become a significant feature.

The third kind of "more memory" involve heresy, blasphemy and outright sacrilege. You steal it from the Upper Memory Blocks. It is quite justifiable. This face-of-the-poor, grinding, worker-exploiting, bloated, capitalistic, prodigal operating system was not using all of its resources. It was only right that the use should partake in its wealth. The traditional justification of the have-nots. They wanted it.

The Marx of computing must be the 286 chip, but the one who made it work, the Lenin of computing, was the 386. It free the Upper Memory Blocks.

You need at least a 286 chip but really you should have a 386. If you only have an 8088 or an 80186 you are condemned to the outer darkness for ever. No fancy memory tricks for you.

By the time the 386 chip came along the know-how and the technology had progressed to a point where they could access memory that extended above the first megabyte. (They had to start counting again so they started at 10. 10 is hex for 16. (Don't blame me. I am only the messenger.) Not just that phantom kB High Memory Area but the infinity memory going on for ever, (well several Gigabytes anyway). This is the Nirvana of programmers - the Extended Memory

You can run programs in it. You can eve tell the operating system that it is expanded memory just to keep Lotus 1-2-3 smiling. It had many uses. It is'nt much good for peeling potatoes but will help you stop smoking if used properly.

It is beautiful. And so are you.

Reprinted from the March 1994 issue of PC Update, the magazine of Melbourne PC User Group, Australia

[About Melbourne PC User Group]