On , Sam Izzo wrote to All :
SI> Hey all!
SI>
SI> Ok. I need to allocate some memory in a program which is in 100%
SI> assembler, so
SI> I thought I'd use Int 21h function 48h/49h to get/free some memory. I
SI> used
SI> these functions in a Turbo Pascal program to allocate some memory, and
SI> they
SI> worked fine, after I change TP's heap requirements (with $M etc). Now
'm
SI> coding in A86 and TASM, and need to allocate memory, but whenever I try
t
SI> gives me the error code for 'not enough memory'. Is it something to do
SI> with
SI> my programs being .COM files? Do they need to be .EXEs? I tried
SI> compiling to
SI> .EXE with TASM, but it still didn't work. What am I doing wrong?
A COM program is allocated all the memory in the TPA. You must first
deallocate this memory then allocate what you desire.
Since a COM program runs in 64k it's pretty safe to deallocate all
but 0fffh pages above the PSP:0000h. However, if you want to
deallocate more, be sure to move your stack to a safe area...
In a TSR program, put your memory de/allocation code at the end
of the program as it can be overwritten when your done. Since,
you won't need it anymore. Again, be careful with the stack.
Glen...
--- ProBoard v2.16 [Reg]
---------------
* Origin: NC/NEC SEWAnet, Bucolic Fair (1:3407/25)
|