Solved

Memory handling

Posted on 1998-10-12
11
227 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
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
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Google always has something new and amazing up its sleeve, and the most current thing that they have been working on is another step in the evolution of Google Search, from machine learning to its brilliant successor, deep learning.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

803 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