Solved

Newbie question about memory models

Posted on 2000-04-04
2
170 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

ScreenConnect 6.0 Free Trial

Want empowering updates? You're in the right place! Discover new features in ScreenConnect 6.0, based on partner feedback, to keep you business operating smoothly and optimally (the way it should be). Explore all of the extras and enhancements for yourself!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
C language IDE – Compilers installation 14 71
Super Scope, DHCP 5 75
nested if statement in excel help 4 26
Autosar OS Multicore Share Resources confusion ? 2 35
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…
Examines three attack vectors, specifically, the different types of malware used in malicious attacks, web application attacks, and finally, network based attacks.  Concludes by examining the means of securing and protecting critical systems and inf…
The goal of this video is to provide viewers with basic examples to understand and use pointers in the C programming language.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use while-loops in the C programming language.

785 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