flat assembler
Message board for the users of flat assembler.

Index > DOS > The function 48h fails when I want to allocate some memory

Author
Thread Post new topic Reply to topic
Vortex



Joined: 17 Jun 2003
Posts: 335
Vortex
The function 48h fails when I want to allocate some memory:


Code:
format MZ

   push    cs
  pop     ds

        mov     ah,048h
        mov     bx,10   ;Allocate 10*16 bytes
        int     21h
        jnb     @f      ;Allocation successfull
        mov     dx,errmsg
        mov     ah,9
   int     21h
@@:
      mov     ax,4C00h
    int     21h

errmsg  db 'Error',24h
    


Setting the carry flag whick means failure...
What can be the reason? Are there different methods to allocate
memory under DOS?

_________________
Code it... That's all...
Post 17 Jun 2003, 11:17
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 7413
Location: Kraków, Poland
Tomasz Grysztar
From the fasm documentation (section 2.4.1):
Quote:
"heap" directive should be followed by a 16-bit value defining maximum size
of additional heap in paragraphs (this is heap in addition to stack and
undefined data). Use "heap 0" to always allocate only memory program really
needs. Default size of heap is 65535.

With default heap size all conventional memory gets allocated when your program is loaded and thus you can't allocate more. Setting heap to zero should help.
Post 17 Jun 2003, 11:22
View user's profile Send private message Visit poster's website Reply with quote
Vortex



Joined: 17 Jun 2003
Posts: 335
Vortex
Thanks Privalov,it works now. Smile
I have an other question,is there an eqivalent instruction to adjust
the heapsize for other assemblers such as tasm and masm?

_________________
Code it... That's all...
Post 17 Jun 2003, 11:43
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 7413
Location: Kraków, Poland
Tomasz Grysztar
Yes, this is usually one of the switches for the linker.
Post 17 Jun 2003, 12:27
View user's profile Send private message Visit poster's website Reply with quote
Vortex



Joined: 17 Jun 2003
Posts: 335
Vortex
Thanks Privalov.Everything works fine.

_________________
Code it... That's all...
Post 18 Jun 2003, 10:08
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2019, Tomasz Grysztar.

Powered by rwasa.