Board index » delphi » protected and real mode ?

protected and real mode ?

What is protected mode and real mode and the difference between them ?

Send e-mail  to                                
Thank you .


Re:protected and real mode ?

On 7 Mar 1997 19:00:10 GMT, "Siew Kit" <> wrote:

>What is protected mode and real mode and the difference between them ?

Real mode works within the < 1MB envelope ... generally thought of as
DOS space.  Protected mode can come in various flavors, depending on
whose implementation  you are using (e.g. Phar Lap), but generally
refers to "DOS Protected Mode Interface" programming (DPMI) as defined
by Microsoft and is dependent on DPMI drivers being in place. (note :
Borland provided the RTM.EXE & DPMI16BI.OVL files if DPMI services
need to be added. A DOS box under enhanced mode Windows already has
DPMI services.)

This approach allows access to memory above 1 MB ... extended memory
(NOT expanded memory .. an XT vintage holdover), up to 16 MB on 80286
& 4 GB on 80386 (or better) This is not a flat memory map access and
strict controls are placed on memory access.  (example, in DPMI
programming, you can't read an explicit memory address directly ,  but
need to reference the Segment indirectly through a selector  ... which
is an index into a memory address table) .


Re:protected and real mode ?

In article <01bc7058$f7f82900$>,

Siew Kit <> wrote:
>What is protected mode and real mode and the difference between them ?

Intel introduced its 8086 CPU in 1978. Back then 1MB was unimaginable
amount of memory in PCs. (Back then computers had a few kilobytes of
memory). They wanted to make the cpu compatible (at source code
level) with their 8080 cpu. That was 8-bit cpu with 64K address space.
To achieve this they created segmented memory. Each 64K segment
corresponded to entire address space of the 8080. To access all of the
64K one needed segment registers. One for code, one for data one for
stack and an extra segment for various purposes. The segments were
constructed so that to get an address one multiplied the segment value
with 16 and added the offset.

The above method worked well up to 1MB but it offered no room for
expansion. Sure one could change the 16 to 32, 64 or even 1024 but that
would complicate memory allocation and in anyway old programs would not
work. Also it was seen that the future is with multi tasking so for
80286 (introduced in 1982) Intel designed so called protected mode. In
it same 16-bit segment registers were used (though they were called
selectors) and same 16 bit offsets were also used. Now, however, the
address was not calculated directly form the value of the selector.
Instead the selector was used as an index to table where the base
address of the segment (along with other data as the size of the
segment, the access rights etc.) were found. Each time the value of the
segment register changes the processor loads these values to its
internal cache. (Creating the table is a task for the operating system
(like DPMI). The programmer does not have to worry about things like

Differences? Well well behaved programs will work with little or no
change no matter whether it is Pascal or assembler. If one does
calculations with addresses one may have to do much change. For example
if one wants to access a particular part of base memory one needs to use
the selector not the segment address. BP provides selectors for segments
$40, $A000, $B000 and $B800. Others may be obtained form the DPMI with
its function calls (int 31h). Absolute variables are banned in BP when
one uses protected mode. In some cases the protected mode is slower than
real mode. Especially pointers and far calls (that is things that
require changing values in segment registers). A protected mode program
also starts somewhat slower. On a 386 one can clearly notice this.

The most important
difference is the amount of memory. Protected mode can use all memory
(at least up to 16MB). Also the memory management is better: The program
just doe not grab all available memory (or force you to limit it at
compile time). It allocates memory dynamically and when one uses exec()
one gets as much free base memory as possible. In real mode one has to
write specific code to release unused heap and/or swap the program to
xms/hard disk.

In 80386 (1985) 32-bit protected mode was introduced but it is not
supported by BP.


Other Threads