Solved

Newbie question about memory models

Posted on 2000-04-04
2
168 Views
Last Modified: 2010-04-15


I am using a third party product  to create apps  for mobile computers, ( Penright) ,  anyway  in getting  peripherals to work under DOS   I have  had to ask the manufacturers to send me the proper libraries and header files to make the barcode scanners   work on their particular unit ( each one is different )  enclosed with the email from the company is this  "There is a bar code example under the barscan directory. It links
with libraries touch_s and periphs for small memory model. You would
probably only need to link with periphl for large model to integrate it into
your Penright application."  As  I said  I am a complete newbie  at this,  can someone explain  what these  memory  model  terms  mean?  In laymans  terms  also  if  possible.  

Thanks

DaveMon
0
Comment
Question by:DaveMon
2 Comments
 
LVL 32

Accepted Solution

by:
jhance earned 50 total points
ID: 2685552
MSDOS runs on Intel 8086 family based computers only.  The 8086 was designed using a screwy register setup where each of it's 16-bit registers could access it's 20-bit (1MB) memory space by adding the 16-bit base register value to the 16-bit segment register with the segment register shifted left by 4 bits.  There were 4 of these segment registers, CS, DS, SS, and ES for CODE segment, DATA segment, STACK segment, and EXTRA segment.  With each value in a segment register the base registers could access 64KB of memory.

Since messing with these segment registers is not only a hassle but also a performance hog, programming libraries developed around memory "models" of how these segments were managed.  The most common of these are:

TINY : CS = DS = SS.  All code, data, stack, and other stuff must fit in 1 64KB memory block.  In DOS, this is a COM program.

SMALL : CS = DS != SS.  Here the stack is in it's own 64K segment but CODE and DATA still must fit in 64K.

LARGE : CS != DS != SS.  Code, Data, and stack are all in their own segments and generally the library causes all jumps and calls to be FAR.  This means that the CODE size can be > 64K but there is additional overhead in loading the CS for each jump or call.  Same with data references, all data references load the DS.

There are other variations in this but this gives the general idea.

Under the 32-bit model in 80386 and higher, there is still a segment scheme but the segments are now 32-bits long.  Hence the "32-bit flat" memory model used by Win32, linux, and other 32-bit x86 operating systems.


Bottom line for your application is that you must use a library that is compatible with the memory model you are using.
0
 
LVL 2

Author Comment

by:DaveMon
ID: 2691314
That   was  informative
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

An Outlet in Cocoa is a persistent reference to a GUI control; it connects a property (a variable) to a control.  For example, it is common to create an Outlet for the text field GUI control and change the text that appears in this field via that Ou…
This tutorial is posted by Aaron Wojnowski, administrator at SDKExpert.net.  To view more iPhone tutorials, visit www.sdkexpert.net. This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…
The goal of this video is to provide viewers with basic examples to understand recursion in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use switch statements in the C programming language.

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now