SI> Ok. I need to allocate some memory in a program which is in 100%
SI> assembler, so I thought I'd use Int 21h function 48h/49h to get/free
SI> some memory. I used these functions in a Turbo Pascal program to
SI> allocate some memory, and they worked fine, after I change TP's heap
SI> requirements (with $M etc). Now I'm coding in A86 and TASM, and need
SI> to allocate memory, but whenever I try it gives me the error code for
SI> 'not enough memory'. Is it something to do with my programs being .COM
SI> files? Do they need to be .EXEs? I tried compiling to .EXE with TASM,
SI> but it still didn't work. What am I doing wrong?
I had the same problem. I've lost df's reply but the general idea of
it was:
.COM files don't have the info about their memory requirements
stored in a header, so DOS gives them everything between the code and the
video memory. Because everything is already taken, there is 'not enough
memory' for other things.
Well behaved programs will resize themselves (INT 21h, Function 4A -
Modify Allocated Memory Block (SETBLOCK)) to the size needed for CODE +
STACK + DATA.
I guess that with .EXE's there is some kind of compiler directive
or it auto calculates the size, but i don't exactly know.
Chris.
... RAM = Rarely Adequate Memory
--- FMail/386 1.20+
---------------
* Origin: Comms Barrier BBS +61.3.9585.1112, +61.3.9583.6119 (3:632/533)
|