hi,
Chuck McKinght says:
>I'm porting Paul Dale's ship generator to MSDOS and wondered if
>anyone else has been successful doing so. I've compiled it both as a
>real mode program and as a protected mode program and damned if
>building the table still doesn't run out of memory (I've got 3 Meg of
>extended memory enabled and though that should handle it). Any ideas?
I've just checked the program and assuming that shorts are 16 bit and longs
are 32 (and chars are 8 and doubles are 64). The database is 1751 lines long
(excluding both blank lines and comments) and each line will expand to
166/168 bytes (depending upon alignment problems). This is something 'round
about 300k which should easily fit into your available memory. The only
other problems that might arise are due to the wonderful segmentation present
on certain intel processors. Have you declared the table pointer to be of
type FAR *? Are you calling the version of malloc/realloc that gets passed
a 32 bit (man sized) integer size argument?
The table is far larger than the 64k available in a single segment so you MUST
compile using a large memory model, but sometimes that isn't enough...you might
have to have to go to a special memory model that supports objects bigger than
64k [ I don't remember what silly name is used for this model, it has been a
while since I was programming on a MSDOS machine ].
Another way to reduce the memory usage would be to change the definition of
REAL so it is float not double, this will reduce the memory used by each record
to a more manageable level of 114/116 bytes (about 200k now). Stripping the
database is also possible, all the supa-tech stuff (TL>15) could be removed as
could a lot of the 'useless' sensors and quite a lot of the weaponary related
stuff. In the comments in the database you will see a way to change the turret
allocations so that individual weapons not turrets are allocated this will save
a fair bit of space. A final way to reduce the memory usage would be to reduce
the length of the name field in the table (50 chars is a big excessive), you
could figure out the longest name and use that size or reduce the name lengths
throughout the file.
If you have any problems with any of the above, contact me and I'll try to help
out. I'd also be interested in seeing any changes you have to make to the
program to get it working on a yukky machine (not that I am biassed or
anything :-)
Pauli
Paul Dale | Internet/CSnet: [email removed]
Dept of Computer Science| Bitnet: [email removed]
Uni of Queensland | JANET: [email removed]
Australia, 4072 | EAN: [email removed]
| UUCP: [email removed]
f4e6g4Qh4++ | JUNET: [email removed]