www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/12/16/15:54:51

From: GAMMELJL AT SLU DOT EDU
Date: Tue, 16 Dec 1997 14:52:32 -0600 (CST)
Subject: access to 128mb of RAM and virtual RAM
To: djgpp AT delorie DOT com
Message-id: <01IR8UNJLKN6BL2ZQD@SLU.EDU>
Organization: SAINT LOUIS UNIVERSITY St. Louis, MO
MIME-version: 1.0

output of go32-v2:
dpmi memory available 123519 Kb
dpmi swap space available 4417 Kb

environ.lst:
TMP=c:\windows\TEMP
TEMP=C:\windows\TEMP
PROMPT=$p$g
winbootdir=C:\WINDOWS
COMSPEC=C:\WINDOWS\COMMAND.COM
INCLUDE=C:\WATCOM\H;C:\WATCOM\MFC\INCLUDE;C:\WATCOM\H\NT
WATCOM=C:\WATCOM
EDPATH=C:\WATCOM\EDDAT
DJGPP=c:\djgpp\djgpp.env
PATH=C:\DJGPP\BIN;C:\WATCOM\BINNT;C:\WINDOWS;C:\WINDOWS;   continued
C:\WINDOWS\COMMAND;C:\WATCOM\BINW                          on this line
windir=C:\WINDOWS
SNDSCAPE=C:\WINDOWS
BLASTER=A220 I5 D1 T2 
CMDLINE=edit environ.lst

autoexec.bat:
SET BLASTER=A220 I5 D1 T2
SET SNDSCAPE=C:\WINDOWS
@ECHO OFF
REM LH C:\WINDOWS\COMMAND\MSCDEX.EXE /D:MSCD000 /L:E
C:\EAPCI\APINIT.COM
PATH C:\WATCOM\BINNT;%path%;C:\WATCOM\BINW
SET INCLUDE=C:\WATCOM\H;C:\WATCOM\MFC\INCLUDE;C:\WATCOM\H\NT
SET WATCOM=C:\WATCOM
SET EDPATH=C:\WATCOM\EDDAT
set djgpp=c:\djgpp\djgpp.env
set path=c:\djgpp\bin;C:\WATCOM\BINNT;C:\WINDOWS;   continued 
C:\WINDOWS;C:\WINDOWS\COMMAND;C:\WATCOM\BINW        on this line

config.sys
DEVICE=C:\WINDOWS\HIMEM.SYS
DEVICE=C:\WINDOWS\EMM386.EXE NOEMS D=64
BUFFERS=15,0
FILES=30
DOS=UMB
FCBS=4,0
DOS=HIGH
DEVICEHIGH=C:\WINDOWS\COMMAND\TAISATAP.SYS /D:MSCD000 /N:1

C++ code:
#include <iostream.h>

int prec=20;
int zmaxsize=320;    

const int zprecpad=prec+0xa;  //next three are paddings in memory allocation
const int zmaxsizepad=zmaxsize+3;

#include "zclasss2.h"    //see below

realmatrix a_ram;unsigned int * * *a=a_ram.m;
realmatrix b_ram;unsigned int * * *b=b_ram.m;
realmatrix c_ram;unsigned int * * *c=c_ram.m;

void main()                                       {
  unsigned int i,j,k;
  for (i=1;i<zmaxsize+1;i++)
    {for (j=1;j<zmaxsize+1;j++)
      {for (k=1;k<prec+1;k++)
        {a[i][j][k]=i+j+k;
         b[i][j][k]=i+j+k;
         c[i][j][k]=i+j+k;}
      }
    }
  for (i=1;i<zmaxsize+1;i++)
    {for (j=1;j<zmaxsize+1;j++)
      {for (k=1;k<=prec;k++) c[i][j][k]=a[i][j][k]+b[i][j][k];}
    }

  i=zmaxsize/2;
  j=zmaxsize/2;
  cout<<i<<" "<<j<<'\n';
  for (k=1;k<prec+1;k++) cout<<c[i][j][k]<<" ";   }

the include file zclasss2.h:
class realmatrix                                                 {
  public:
     unsigned int * * *m;
     realmatrix();
     ~realmatrix();                                              };

realmatrix::realmatrix()                                         {
     int i,j;
     m= new unsigned int * * [zmaxsizepad];
     for (i=0;i<zmaxsizepad;i++) 
       {m[i] = new unsigned int * [zmaxsizepad];
        for (j=0;j<zmaxsizepad;j++)
          {m[i][j] = new unsigned int [zprecpad];}
       }                                                         }

realmatrix::~realmatrix()                                        {
     delete[] m;                                                 }

Question:
    djgpp runs fine. gxx runs fine. The problem is to make the parameter
zmaxsize above as large as possible. (Access to 128mb of physical RAM
plus 128mb of virtual RAM.)
    Using the Watcom C/C++ compiler and the dos extenders 4gw or pmodew
and running at a DOS prompt under Windows95, zmaxsize can be 640.
I know what to do to make the program run fast (2 seconds) without setting
any environmental variables or options in Windows95 or the extenders. This
requires writing a code which sets the variables and options as it executes.
After one execution of this code the computer is in "fast mode" until
it is shut down.
    Using the gxx compiler and running at a DOS prompt unders Windows95
and setting no environmental variables or options in Windows95 or djgpp,
zmaxsize=640 compiles but at run time I get a message  "virtual memory
exceeded in 'new'".  The gxx compiler produces executables which run
rapidly for zmaxsize=480, and do run for zmaxsize=520 but slowly with a
busy hard drive (hard disk swapping).  My code for making zmaxsize=520
run in "fast mode" works. But for zmaxsize=640 how do I proceed?
    I have read your FAQ.   The answer may lie in the references to
"the DOS applications' properties sheet" and setting some variable to
65535K. But I haven't any idea how to get at that properties sheet. Tell
me how.
    In principle I would like to use "plain" DOS (press F8 as soon as the
"starting Windows95" message appears when booting and select "6" from the
menu which appears) but I can't get past zmaxsize=280 or 320 in that case
Watcom with any extenders or djgpp's gxx.   The cause is no doubt "plain"
DOS' DPMI.  Do you think of something I could do?
    Thanks for your reflections and ideas.

- Raw text -


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