Solved

Memory handling

Posted on 1998-10-12
11
232 Views
Last Modified: 2010-04-16
Does anybody know how to handle large amounts of memory
(maybe almost all) in DOS program under WINdows?
Send me some unit or give some link to related site.
Thanx
0
Comment
Question by:jack_p50
[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
11 Comments
 
LVL 2

Expert Comment

by:omsec
ID: 1215769
can you be a bit more clear ?
what exactly should your program do ? fe. load huge files, or need big arrays ? and what compiler do you use ?

i think, anyway programming with pointers will be good...
0
 
LVL 4

Author Comment

by:jack_p50
ID: 1215770
I use BP 7.0 and Lower-memory is to small - i'm writing Graphics editor, and it need big
swap space - more than 1.5 Mb. So i need some stuff to use not only lower memory,
I tryed flat mode but it doesn't work under Windows, and i want to run my program
only under windows(i'll write a game with same format and i don't want people to run it
under dos-emulation). You can contact me by ICQ: 17635851.
0
 
LVL 4

Author Comment

by:jack_p50
ID: 1215771
btw, thanx for drives routings
0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 2

Expert Comment

by:omsec
ID: 1215772
Well, the perfect Way to do so, is to use a "real" 32bit protected Mode Compiler, such as FPK-Pascal which is Freeware, where you have the Possibility to use a Dos-Extender and to set maximum SWAP-Memory for your Application easily, directly using a Compiler Switch. (Just for Example, the default Value there is 4MB).

Aince, Borland PAscal 7 is a 16bit Compiler, (even in protected Mode) you might have to use your own Technique and Way to manage your SWAP-Files. I don't know that much about the internal Informations of your Program, but I would move large Objects using BLockWrite/BlockRead Procedures and dynamic Pointers to the Hard Disk and load them when needed.

For Example, this is how i would manage the SWAP-File of the current Configuration :
(Flags, Settings, Program Variables)

Type
  PConfig = ^TConfig;
  TConfig = Record
                    ID : String[9]; // Swap-File
                    EditorFiles : Array [1..10] of String[50];
                    SaveChangesAuto : Byte;
                    { This Record defines Information you "need" in this Example to save the
                      Configuration Data, such as File Names, Flags like "UseThisFunction :                       Byte" 0 = no, 1 = yes etc.}
                  End;

Var
  ConfigFileTempFile : File;
  ConfigHeader : PConfig;

Begin
  New(ConfigHeader);
  ... {Assign/Open/Create the File here}
  BlockRead(ConfigTempFile, ConfigHeader^, SizeOf(ConfigHeader^));
  ... {Use/Change the Data}
  BlockWrite...{Swap the Data to Disk, Params as above}
  Dispose(ConfigHeader); {givew this MEmory free for other stuff
End.

Hoping you understand my general SWAP-Manage-Idea :)

greets, Roger

btw: for more info bout FPK-Padscal or anything else you may find my addresses on my User Profile, just lick on 'omsec' link...
0
 

Expert Comment

by:flobecker
ID: 1215773
Hello jack_p50,

what about using XMS-Memory? I wrote some short progs in ASM accessing the XMS. It should be possible in PAS, too! Tell me, when you're interested, so I can give you more information.
Just to give you an idea of XMS and how it works (maybe you don't want do use such a thing): A XMS-driver like HIMEM.SYS has to be installed. Then you reserve a part (or all) of the available XMS (can't remember what's the maximum, 1GByte or so!). You may copy data-blocks between conventional memory (640k)and XMS or back and even between XMS and XMS, just using the XMS-driver's API (no protected mode, it's easy!). Ok, maybe a few lines of ASM have to be included, but i think that's easy!

FloBecker

0
 
LVL 4

Author Comment

by:jack_p50
ID: 1215774
 I already tried XMS-driver, but it doesn't work - it causes windows memory protection
fault - and program termination, so i don't know why?
  Hi, Omsec, i'm d/loading FPK now, so wait a little to me to see what's it.
0
 
LVL 2

Expert Comment

by:omsec
ID: 1215775
does the XMS-Solution also not work, if you do any changes in the PIF-File of the shortcut ?
0
 
LVL 4

Author Comment

by:jack_p50
ID: 1215776
XMS don't work under windows some cause, but i have some mod-player that uses it
and works good. Any ideas?(i have the unit similar to that in mod-player)
Sorry, but it seems i can't use FPK coz it have some different syntax, so many
of the units i use can't be compiled(FPK's ASM isn't the same, and there're some more
differences, but it seems that FPK is in general better than BP).
So maybe you'll try to help me with XMS???
Thanx.
0
 
LVL 2

Expert Comment

by:omsec
ID: 1215777
FPK uses Unix (AT&A) Assembler-Style, use the -rIntel Switch to compile Intel Style ASM
0
 
LVL 4

Author Comment

by:jack_p50
ID: 1215778
Thanx, Omsec, i'll do it if anyone willn't find problem wtih XMS int 2-3 days, if not
post your answer again.
0
 

Accepted Solution

by:
Raid earned 10 total points
ID: 1215779
Hey Jack_p50, this is Raid:
if you are looking to use EMS memory in Turbo Pascal 6.0,
here it is:

uses
 crt, objects;

var
 a: byte;
 emsmem: temsstream;

begin
 emsmem.init(500, 500); { Init memory to 500 bytes, can be                           anything }
 emsmem.seek(0); { seek the top of the ems }
 emsmem.write(a, 1); { write variable to ems }
 emsmem.seek(0); { seek the top of the ems again }
 emsmem.read(a, 1); { read variable from ems }
 writeln(a); { write it to screen }
 emsmem.done; { De-Initialize }
 repeat until keypressed;
end.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

The conference as a whole was very interesting, although if one has to make a choice between this one and some others, you may want to check out the others.  This conference is aimed mainly at government agencies.  So it addresses the various compli…
In this blog we highlight approaches to managed security as a service.  We also look into ConnectWise’s value in aiding MSPs’ security management and indicate why critical alerting is a necessary integration.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

696 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