Solved

Newbie question about memory models

Posted on 2000-04-04
2
175 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preface I don't like visual development tools that are supposed to write a program for me. Even if it is Xcode and I can use Interface Builder. Yes, it is a perfect tool and has helped me a lot, mainly, in the beginning, when my programs were small…
Windows programmers of the C/C++ variety, how many of you realise that since Window 9x Microsoft has been lying to you about what constitutes Unicode (http://en.wikipedia.org/wiki/Unicode)? They will have you believe that Unicode requires you to use…
The goal of this video is to provide viewers with basic examples to understand opening and writing to files in the C programming language.
The goal of this video is to provide viewers with basic examples to understand recursion in the C programming language.
Suggested Courses

628 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