🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.ibm.pc.programmer
Article #363

Re: Memory models/Protected mode

#363
From: Jay B. Harlow
Date: Wed, 02 May 1990 18:45
58 lines
2881 bytes
In article <`43#%'=@rpi.edu> fargo@iear.arts.rpi.edu (Irwin M. Fargo) writes:
>Can anyone point me to any information (or perhaps an explanation) con-
>cerning the memory models a program can be compiled under?  I've heard little
>pieces here and there, but nothing that really explains it.
>
Memory Models for the x86 family are:
	TINY	- combined code & data, COM files
	SMALL	- 64K Code, 64K data,		near code ptrs, near data ptrs
	MEDIUM	- gtr 64K Code, 64K data,	far code ptrs, near data ptrs
	COMPACT	- 64K Code, gtr 64K data,	near code ptrs, far data ptrs
	LARGE	- gtr 64K Code, gtr 64K data,	far ptrs
	HUGE	- gtr 64K Code, gtr 64K data,	huge ptrs

near ptr	- 16 bit value offset into DGROUP or _TEXT(code seg)
far ptr		- segment:offset ptr, restricted to 64K item
huge		- segment:offset ptr, may be gtr 64K, 'special' support

the 386 in 32-bit protected mode is a 'special' case, normally it is
either a 32-bit TINY or a 32-bit SMALL mostly dos-extenders or Unix types
use this anyway....

Microsoft has a 'book' with there compiler kits (MASM 5.1,
an appendix in QC 2.0) on 'Mixed Language Programming Guide' that is Very
helpful in explaining the memory models & calling different 'Microsoft' 
languages & use of 'mixed' model programs ie: small model with far ptrs ;-)

>Also, can anyone point me to information on programming the protected mode
>of the 80286 and 80386?  I've heard that this information is very hard to
>find, so any well commented source code (if such exists) would be helpful.
>

two books I find invaluable on protected mode are:

	"Programming the 80386", Sybex
	Crawford & Gelsinger

	"Inside the 80286", Brady Books, Prentice Hall Press
	The Waite Group

the first book is the 'better' in that they include C-like code for 
every (mostall ;-)) instructions on the chip. so its what does a
LDT do, em, gee thats it... also other stuff like call through a 
CALL GATE, only has VERY little on the 286....

FLAME ON:   ;-)

also: TAB books (i mention this under protest ;-) has a book on the 
386 (don't remember the title, i find 'tab' books to be 'cheap'), that
included rather nicely commented assembler source for a Virtual-86 
'monitor' on a 386... shows whats need to be set up....

FLAME OFF:
			Jay
-- 
		Jay B. Harlow	<harlow@plains.nodak.edu>
	uunet!plains!harlow (UUCP)	harlow@plains (Bitnet)

Of course the above is personal opinion, And has no bearing on reality...
Technical Details
Message-ID: <4464@plains.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!ogicse!plains!harlow
References: <`43#%'=@rpi.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!ogicse!plains!harlow
From: harlow@plains.UUCP (Jay B. Harlow)
Newsgroups: comp.sys.ibm.pc.programmer
Subject: Re: Memory models/Protected mode
Message-ID: <4464@plains.UUCP>
Date: 2 May 90 18:45:32 GMT
References: <`43#%'=@rpi.edu>
Reply-To: harlow@plains.UUCP (Jay B. Harlow)
Organization: The Site From Hell, NDSU Fargo ND
Lines: 58