delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1994/05/19/04:44:32

From: kunst AT prl DOT philips DOT nl
Subject: Borland finally 'discovers' DOS extender
To: djgpp AT sun DOT soe DOT clarkson DOT edu (DJGPP users list)
Date: Thu, 19 May 1994 10:08:32 +0100 (METDST)

I thought this message would be of interest to DJGPP users.
It looks like Borland finally has 'discovered' the DOS extender.

The original files can be found at: 
  ftp.borland.com:/pub/libs/c/bi/gen/pwrpak.zip

Pieter Kunst (kunst AT prl DOT philips DOT nl)

===============================================================================

Borland PowerPack for DOS
Version 1.0
Evaluator's Guide

PART 1
Introduction

About this guide
Welcome to the Borland PowerPack for DOS evaluator's guide.  The Borland
PowerPack for DOS is a complete suite of DOS development tools and libraries
designed to work with Borland C+ 4.0.  The purpose of this guide is to provide
an understanding of the features and benefits found in this powerful new
product.  

Part 2, Introducing Borland PowerPack for DOS, provides a capsule summary of the
features and benefits of the product.

Part 3, Borland PowerPack for DOS In Depth, provides greater detail about
product features and components. 

Part 4 provides information on hardware and software requirements, as well as
installation and storage requirements.


PART 2
Introducing Borland PowerPack for DOS

The Borland PowerPack for DOS provides several important features for DOS
developers:
	
+	royalty free 16 and 32-bit DOS Extenders
+	more application memory
+	faster application performance
+	code reuse through DOS DLLs
+	16- and 32-bit Borland Graphics Interface libraries
+	support for the newest super vga video cards
+	16- and 32-bit Turbo Vision libraries
+	data validation classes
+	outline viewer object

In addition to developing for graphical environments such as Windows and OS/2,
most programmers continue to develop and maintain DOS applications as well.  The
reason is simple.  DOS has by far the largest installed base of any operating
system, and will continue to sell well into the foreseeable future.  In fact,
recent surveys have indicated that one out of every five personal computers sold
this year will be installed with DOS only.  Clearly, DOS will continue to
represent a substantial market opportunity for some time to come.

Despite its tremendous success, DOS has some serious limitations.  Most notable
is the fact that DOS relies on the 16-bit segmented memory architecture used by
the Intel 8086 microprocessor.  Newer microprocessors such as the 80386 and
80486 must emulate this architecture to run DOS.  The 8086 architecture limits
the range of addressable memory to 1MB.  Even worse, by default DOS applications
can access only the first 640K bytes of this memory.  The remaining 384K is used
by the system for video memory, the BIOS, and as ROM for expansion cards.
Although the majority of personal computers sold today contain four or more
megabytes of RAM memory, this additional memory is unable to be addressed
without substantial effort.  As DOS applications increase in complexity,
developers are finding the memory limitations of DOS to be unacceptable.

The best solution to this problem is a DOS Extender.  A DOS Extender utilizes
the advanced features of 80286 and newer microprocessors to allow transparent
access to all machine memory.  An application that manipulates a pointer to
memory need not worry whether this memory was allocated above the 1MB limit or
below it.  Further, a DOS Extender still allows access to DOS and BIOS calls,
interrupt handlers, and other low-level techniques common in today's software.

The Borland PowerPack for DOS contains a powerful set of development tools and
libraries for the DOS developer.  Included are both a 16-bit and a 32-bit DOS
Extender which allow programmers to break through the 640K barrier.  The 32-bit
extender is for use with 80386 or better microprocessors and allows access of up
to 4GB of machine memory.  The 16-bit extender is for use the 80286 or better
microprocessors and allows access of up to 16MB of machine memory.  As an added
benefit, both extenders enable dynamic link libraries (DLL's) to be shared
between DOS and Windows.  Applications written using the DOS Extenders included
in the PowerPack will work with any DPMI server that provides .9 DPMI services
or better. Also included in the product are 16 and 32-bit versions of the
popular Borland Graphics Interface (BGI) library.  This library provides a
complete set of functions for creating high performance graphics applications.
In addition, the Borland PowerPack for DOS includes 16 and 32-bit versions of
the Turbo Vision 2.0 application framework for creating event-driven text mode
interfaces for DOS applications.



Features and Benefits

The Borland PowerPack for DOS makes it easy to unlock the power of today's
microprocessors.  With both 16 and 32-bit DOS Extenders, the lightning fast BGI
graphics library, and the Turbo Vision application framework, the Borland
PowerPack for DOS provides all of the necessary tools for creating sophisticated
DOS applications.


16 and 32-bit DOS Extenders 	

More DOS memory.  Applications built using the Borland PowerPack for DOS break
through the 640K memory barrier.  The 32-bit DOS Extender not only increases the
amount of addressable memory to 4GB, but makes applications easier to develop by
providing a flat address space.  Applications written with the 32-bit DOS
Extender also show a dramatic increase in performance since they run in a native
32-bit environment. The 16-bit DOS Extender allows applications to access up to
16MB of machine memory.

Royalty free distribution.  The extenders included in the Borland PowerPack for
DOS are completely royalty free.  There are no licensing or distribution fees.
Now every developer can take advantage of DOS Extender technology.

Increased code reuse through DOS DLLs.  The DLL technology found in the Borland
PowerPack for DOS allows developers to share DLLs between DOS and Windows
without recompiling.  DLL's written using the 16-bit DOS Extender can be shared
with Windows 3.1, while DLLs written using the 32-bit DOS Extender can be shared
with Windows NT and Chicago.

Seamless integration into the Borland C++ 4.0 IDE.  The Borland PowerPack for
DOS integrates directly into the Borland C++ 4.0 environment, so there's no
switching between different tools.  Using the TargetExpert, a developer can
select from between Windows, Windows NT, DOS real mode, and DOS 16- or DOS
32-bit protected mode development with a click of the mouse. 



Borland Graphics Interface 	

16 and 32-bit libraries.   The Borland PowerPack for DOS includes 16 and 32-bit
graphics libraries.  This allows programmers to add charts, graphics, and
animation to their protected mode applications.

Extended graphics driver support.  The new 32-bit BGI library supports  more
video cards and resolutions.  Supported video cards include TSENG, PARADISE,
VIDEO7, TRIDENT, and all S3 cards.  The 32-bit BGI library can operate in
resolutions as high as 1280x1024.

High Performance.  The BGI libraries included in the Borland PowerPack for DOS
were written in assembly language to provide superior performance.  Applications
that use the 32-bit graphics libraries will typically perform twice as fast as
those that use the 16-bit graphics libraries.


Turbo Vision 2.0 Framework 	

16- and 32-bit libraries. Turbo Vision 2.0 works in real mode and both 16- and
32-bit protected mode.  This gives Turbo Vision 2.0 applications megabytes of
memory to work with.

Data validation classes.  Using the validator objects makes it easy to add data
validation to any existing or new Turbo Vision applications.  Validator objects
are connected to edit control objects to validate the information a user types
into an edit control.  For example, you can add a use a validator to create an
edit control that will only accept numeric input.

Outline viewer object.  The new outline viewer object presents data in a
hierarchical format, allowing users to incorporate sophisticated outline
displays in their applications.




PART 3
Borland PowerPack for DOS in Depth



16 and 32-bit DOS Extenders

By allowing programmers to break through the 640K barrier, DOS Extenders help
unlock the power of todays microprocessors.  And with the flat memory model
provided by Borland's 32-bit extender, DOS programming becomes easier than ever
before. No longer do programmers have to worry about near and far pointers or
segment arithmetic.  Plus, developers get the benefit of true 32-bit
performance.  


Compiling for protected mode	

Whether compiling from the command line, or using the Borland C++ 4.0 Integrated
Development Environment (IDE), creating DOS extended applications is easy.  You
can easily recompile most existing real mode applications to take advantage of
Borland's DOS Extenders.

When using the IDE, simply use the TargetExpert to select DOS 16-bit or 32-bit
DPMI targeting.  With a click of the mouse you can choose between building a DOS
extended application or a DOS DLL.

Borland's command line compilers feature new switches to target DOS extended
applications.  For BCC.EXE these switches are:

	     -WX        	DPMI16 EXE
	     -WXD      	DPMI16 DLL, all functions exported
	     -WXDE     	DPMI16 DLL, explicit functions exported

and for BCC32.EXE these switches are:

	     -WX       	DPMI32 EXE, all functions exported
	     -WXD      	DPMI32 DLL, all functions exported
	     -WXDE     	DPMI32 DLL, explicit functions exported



Breaking the 640K barrier		
	
Programmers will exerience a dramatic increase in the memory available for code
and data when using DOS Extenders.  

The following program helps illustrate the additional memory available to a DOS
Extended application:

#include <iostream.h>
#include <except.h>

const BLOCK_SIZE = 4096;

#pragma warn -aus
int main( void )
{
	long totalRam = 0;
	char* p;
	try
	{
		for( ;; )
		{
			p = new char[BLOCK_SIZE];
			totalRam += BLOCK_SIZE;
		}
	}
	catch( xalloc)
	{
	     cout << "Total memory allocated is " << totalRam <<  end;
	}
	return( 0 );
}

When compiled for real mode, the above program displays the following:

	Total memory allocated is 417792 

This occurs even though the computer contains over 12 MB of RAM memory.  When
running in real mode, applications must work within the 640K memory barrier.

When compiled for extended mode, the same program displays the following:

	Total memory allocated is 13012992

If run from a DOS box in Windows, this program would be able to make use of
virtual memory allowing access to more memory that is physically available. 



Compatibility		

Applications created using Borland's DOS Extenders are compatible with a number
of operating environments. Programs written using the 16-bit DOS Extender run
unmodified under DOS, Windows NT, Windows 3.1 DOS boxes, Windows 3.11 DOS boxes
and OS/2 2.x DOS boxes.  Programs written using the 32-bit DOS Extender in
general run under DOS, Windows NT, Windows 3.1 DOS boxes, and OS/2 2.x DOS
boxes.  Applications which use interrupts or IO instructions, or expect to have
direct access to video/DOS memory will generally fail to run under NT.

The 16- and 32-bit extenders support emulation of the non visual Windows and
Win32 APIs, respectively. An import record is provided for those APIs which are
emulated, so use of unimplemented functions will result in link time errors.  If
you need to use an API function which is not implemented by the extenders, you
can hook unresolved APIs and provide resolution for them at run time.  To do
this, you need to implement and export a hook function as follows:

FARPROC WINAPI _export 
BorlandUnresolvedEntryHook (LPCSTR modName,
				  BOOL	byOrdinal,
				  LPCSTR entry);

 The first parameter is the name of the module for the function, for  example,
"KERNEL".  The second parameter tells whether the third parameter is a string or
an ordinal value.  If it is FALSE, then the third parameter is a string naming
the unresolved entry, for example, "GETATOMNAME".  Your hook function should
determine if it is has an implementation for this entry.  If it does, it should
hand back a pointer to the function.  This will be used by the loader to resolve
the references in the image.



DOS DLLs		

The DLL technology found in the Borland PowerPack for DOS allows developers to
share DLLs between DOS and Windows without recompiling.
Developers can create DOS DLL's callable from both DOS and Windows, or can take
advantage of using Windows DLLs from DOS.  This includes many of the
commercially available Windows DLLs, such as the Borland Paradox Engine.  As
long as a Windows DLL doesn't make calls to Windows user interface or graphics
functions, it can be used from DOS.  DLL's written using the 16-bit DOS Extender
can be shared with Windows 3.x, while DLLs written using the 32-bit DOS Extender
can be shared with Windows NT and Chicago.



Borland Graphics Interface

The Borland PowerPack for DOS includes high performance 16- and 32-bit versions
of the Borland Graphics Interface (BGI) library.  The BGI library provides over
70 graphics functions, ranging from high-level calls (such as setviewport,
bar3d, and drawpoly) to bit-oriented functions (such as getimage and putimage).
The graphics library supports numerous fill and line styles, and provides
several text fonts that you can size, justify, and orient horizontally or
vertically.     

BGI DLLs	

Protected mode BGI support follows a slightly different model from
the real mode graphics library included in Borland C++ 4.0.  The 16 and 32-bit
graphics libraries included in the Borland PowerPack are implemented as DOS
DLLs.   The 16- and 32-bit BGI DLLs are called BGI16.DLL and BGI32.DLL,
respectively.  Instead of linking with GRAPHICS.LIB, you  must link with
BGI16.LIB or BGI32.LIB, the import libraries for 16bit and 32bit applications.


Performance	

The performance of the BGI libraries included in the Borland PowerPack for DOS
has been greatly enhanced.  Each of the routines is written in hand optimized
assembly language to provide fast execution.  In particular, the performance of
the 32-bit graphics library is particularly fast.

The following program demonstrates the speed of the 32-bit graphics library.
This program draws 1000 random polygons on the screen, and then displays the
number of seconds required to perform that task.  The real mode version takes 7
seconds on a 80486 66MHz machine, while the 32-bit version takes only 3 seconds
on the same machine.  While this program tests only a small portion of the
graphics support in the drivers and graphics engine, the results are indicative
of the overall speed provided by the 32-bit library.

#include <dos.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <graphics.h>
#include <_defs.h>

struct PTS {
  int x, y;
};    

int    GraphDriver;         
int    GraphMode;            
int    MaxX, MaxY;           
int    MaxColors;          
int    ErrorCode;            

void Initialize(void);
void PolyDemo(void);

//      Begin main function                             

int main()
{
  time_t t1, t2;

  Initialize();         
  t1 = time(NULL);
  PolyDemo();
  t2 = time(NULL);
  closegraph(); 
  printf( "Time is %ld seconds", t2-t1);
  return(0);
}

//      INITIALIZE: Initializes the graphics system                     

void Initialize(void)
{
 	//  GraphDriver = DETECT;           
   	GraphDriver = VGA;
    initgraph( &GraphDriver, &GraphMode, "d:\\bc4.0\\bgi" );
    ErrorCode = graphresult();           
    if( ErrorCode != grOk ) 
    {                     
       printf("Graphics Error: %s\n",grapherrormsg(ErrorCode));
       exit( 1 );
	}
  }
  MaxColors = getmaxcolor( ) + 1;
  MaxX = getmaxx();
  MaxY = getmaxy();                   
} 

//   POLYDEMO: Display a random pattern of polygons on the screen    

#define MaxPts          6              

void PolyDemo(void)
{
    struct PTS poly[ MaxPts ];           
    int color;                           
    int i, nTimes;

    for(nTimes = 0; nTimes < 1000; nTimes++)
    {
       color = 1 + random( MaxColors-1 );
       setfillstyle( random(10), color ); 
       setcolor( color );                
       for( i=0 ; i<(MaxPts-1) ; i++ ){    
          poly[i].x = random( MaxX );      
          poly[i].y = random( MaxY );      
       }
       poly[i].x = poly[0].x;           
       poly[i].y = poly[1].y;
       fillpoly( MaxPts, (int FAR *)poly );   
    } 
}



Turbo Vision 2.0

Turbo Vision is Borland's application framework for DOS.  It encapsulates the
behavior of a text-mode application that conforms to the IBM Common User Access
(CUA) user interface specification.  With Turbo Vision, you can inherit an
application that has pull-down menus, overlapping windows, dialog boxes, and
mouse support.  Turbo Vision gives the DOS developer a head start in creating
great looking text-mode applications.

Turbo Vision includes a class hierarchy that supports event handling, user
interface management, and data management.  Turbo Vision includes over 100
classes, including classes that allow developers to easily incorporate objects
such as calculators, calendars, edit windows, file open and directory navigation
dialog boxes, and a clock in their applications.

Turbo Vision 2.0 now includes classes for data validation, a multi-state
checkbox, and an outline viewer that presents a hierarchical view of data.


Extensible Architecture	

Turbo Vision classes define a CUA application as a set of abstract classes that
provide a general structure for implementing an interface.  The result is a
large body of ready-to-use, high-quality code that can be inherited directly by
your application.

Windowing  User Interface	

Turbo Vision provides support for windows and mouse operations, in an
event-driven environment.  The user is relieved of the task of writing code to
define window behavior, manage windowing objects such as menus and dialog boxes,
and read user input.

High-level Objects	

Objects such as an editor, a calendar, a calculator, a clock, as well as
standard dialog boxes for opening files and browsing directories, and a color
palette are included in Turbo Vision.  This allows users to incorporate these
features easily in application programs.

Hypertext-help	

Programmers can build applications with context-sensitive, hypertext-based
help.




PART 4
Appendix

Hardware/software requirements
A complete installation of the current version of Borland PowerPack for DOS
requires 5 Mb of hard disk space.   The Borland PowerPack for DOS requires a
minimal installation of Borland C++ 4.0.

Installation
Borland PowerPack for DOS installs automatically.  Insert the first disk of the
install set in your A: drive and type install.




PART 5
Conclusion

The Borland PowerPack for DOS solidifies Borland's leadership in C++ and
demonstrates Borland's commitment to bringing the best development tools to a
wide range of environments and operating systems.  This product provides a
series of features important to the DOS developer, such as:
	
+	royalty free 16 and 32-bit DOS Extenders
+	more application memory
+	faster application performance
+	code reuse through DOS DLLs
+	16 and 32-bit Borland Graphics Interface libraries
+	support for the newest super vga video cards
+	16 and 32-bit Turbo Vision libraries
+	data validation classes
+	outline viewer object

We are confident you will share our enthusiasm for this new suite of tools for
the Borland C++ 4.0 compiler. 





BORLAND INTERNATIONAL, INC.   1 BORLAND WAY
P.O. BOX 660001, SCOTTS VALLEY, CA 95067-0001
Copyright 1994 by Borland International, Inc.  All rights reserved.  All Borland
products are trademarks or registered trademarks of Borland International, Inc.
Other brand and product names are trademarks or registered trademarks of their
respective holders.
April 1994

===============================================================================

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019