[comp.sys.intel] 80286 protected mode programming

sunshine@necbsd.NEC.COM (Roger Sunshine) (03/20/89)

  Does anyone have some sample code to switch the 80286 into protected mode
and set up the segment descriptor tables?  I am attempting to write a memory
test program and would like to be able to test the memory above the 1MB real
mode limit (since that is where my current memory problem appears to be)  A
reference to a good book on programming the '286 (or '386 if it covers 286
protected mode in some detail) in protected mode would also be appreciated.

Thanks for the help

-- 
Roger Sunshine                 | ...!cs!necssd!sunshine
NECAM SSD Dallas               | ...!necntc!necssd!sunshine
%INCLUDE ODISCLAIM             | sunshine@necssd.NEC.com  (with a prayer)

dmt@mtunb.ATT.COM (Dave Tutelman) (03/28/89)

In article <86@necbsd.NEC.COM> sunshine@necbsd.NEC.COM (Roger Sunshine) writes:
>
>  Does anyone have some sample code to switch the 80286 into protected mode
>and set up the segment descriptor tables?  ...
> A reference to a good book on programming the '286 (or '386 if it covers 286
>protected mode in some detail) in protected mode would also be appreciated.

I have in front of me a book from Intel,
	80286 Operating Systems Writer's Guide
	1986
	Order no. 121960-002

It explains everything you need to know, and includes a 10-page chunk
of code to initialize the system (what you're looking for).

+---------------------------------------------------------------+
|    Dave Tutelman						|
|    Physical - AT&T Bell Labs  -  Lincroft, NJ			|
|    Logical -  ...att!mtunb!dmt				|
|    Audible -  (201) 576 2442					|
+---------------------------------------------------------------+

cs3b3aj@maccs.McMaster.CA (Stephen M. Dunn) (03/28/89)

In BYTE's IBM-PC special issue, 1986 (I think it was 86), there's an article
about using the 286 in protected mode.  It includes a simple demo program.
I'm sure it would have references, too.  (The question is, is it still
available as a back issue?  :-)

Regards,

-- 
======================================================================
! Stephen M. Dunn, cs3b3aj@maccs.McMaster.CA ! DISCLAIMER:           !
! I always wanted to be a lumberjack! - M.P. ! I'm only an undergrad !
======================================================================

margulis@mipos3.intel.com (Neal Margulis) (03/28/89)

The original posting does not specify what environment the code will be
developed in.

The reference that you cite provides a good reference,  and
assumes a non-DOS system.  An example that is written for the 
a DOS system can be found in "80386 Protected Mode Initialization" which
appeared in Dr. Dobbs Journal in October 1988.

Check the local library.  

Neal

gefuchs@wotan.uucp (Gill E. Fuchs) (03/28/89)

>In article <86@necbsd.NEC.COM> sunshine@necbsd.NEC.COM (Roger Sunshine) writes:
>Does anyone have some sample code to switch the 80286 into protected mode
>and set up the segment descriptor tables?  ...

If you are using an AT type computer, you can enter into protected mode by
issuing BIOS interrupt 15, function 89 (both in hex).  You can also switch
back into real mode by issuing a command sequence to the CMOS clock and
keyboard controller (I think).  For more information on all BIOS interrupts,
a complete list is available in:
         IBM ROM BIOS, by Ray Duncan, published by MicroSoft Press,  $6.00.
Information on switching from protected into real mode, refer to:
         Switching Modes, PC Tech Journal, August 1985, p 163
Remember, this works only on IBM AT type machines.  If you want actual code,
it is available in Intel's 80286 Programmer's Reference Manual, though this
may be different than the code in the BIOS.

Gill Fuchs