Expert C Programming

(Jeff_L) #1

bundled with alarmingly useless Intel boards and chips, to fulfill the letter of their contract
with Microsoft.


Don't feel too sorry for Seattle Computer Products—their QDOS was itself extensively
based on Gary Kildall's CP/M, and he'd rather be flying. Bill Gates later bought a super-fast
Porsche 959 with his cut of the profits. This car cost three-quarters of a million dollars, but
problems arose with U.S. Customs on import. The Porsche 959 cannot be driven in the
U.S.A. because it has not passed the government-mandated crash-worthiness tests. The car
lies unused in a warehouse in Oakland to this day—one Gates product that will definitely
never crash.


[1] This literally stood for "Quick and Dirty Operating System."


The 80486 is a repackaged 80386 that is a little faster because the bus lacks states that allow
coprocessors. The 486 coprocessor is either built in or disallowed, called DX and SX, respectively.
The 486 adds a few modest instructions and has an on-board cache (fast processor memory), which
accounts for most of the rest of the performance improvement. That brings us to the present day,
where, in a tremendous burst of innovation and trademark squabbling, Intel named its latest chip the
Pentium, not the 80586. It's faster, more expensive, supports all previous instructions, and introduces
some new ones. It's safe to anticipate that the 80686 is planned to be faster and more expensive, and
will provide some additional instructions. Intel's internal motto for their continual introduction of new
chips is "be fast or be dead," and they certainly live by it. As my old grandmother used to say as she
worked away at her spinning wheel, "Those who do not remember history are doomed to have serious
backward compatibility problems, especially if they change the addressing modes or wordsize of their
architecture."


The Intel 80x86 Memory Model and How It Got That Way

As we saw in the previous chapter, the term segment has at least two different meanings (there's also a
third OS memory-management-related meaning):


A segment on UNIX is a section of related stuff in a binary.


A segment in the Intel x86 memory model is the result of a design in which (for compatibility reasons)
the address space is not uniform, but is divided into 64-Kbyte ranges known as segments.


In its most basic form, a segment started out on the 8086 as a 64-Kbyte region of memory that was
pointed to by a segment register. An address is formed by taking the value in a segment register and
shifting it left four places (or equivalently, multiplying by 16). Yet a third way of looking at this is to
consider that the segment register value has been made a 20-bit quantity by appending four zeros.


Then the 16-bit offset says where the address is in that segment. If you add the contents of the
segment register to the offset, you will obtain the final address. One quirk: just as there are many
different pairs of numbers that total, for example, 24, there are many different segment + offset pairs
that point to the same address.


Handy Heuristic

Free download pdf