flat assembler
Message board for the users of flat assembler.

Index > DOS > Dynamic memory allocation in Assembly

Author
Thread Post new topic Reply to topic
estrang



Joined: 02 Nov 2005
Posts: 38
estrang
How do you dynamically allocate memory in assembly?

I mean when i use buffers in assembly i have to do
Code:
db 0Fh dup( 00h )    

, which consumes a lot of the apps size.

How do you dynamically allocate memory and use it on runtime??
Post 12 Nov 2005, 11:40
View user's profile Send private message Reply with quote
vbVeryBeginner



Joined: 15 Aug 2004
Posts: 884
Location: \\world\asia\malaysia
vbVeryBeginner
Code:
rb 0xF
    
Post 12 Nov 2005, 12:24
View user's profile Send private message Visit poster's website Reply with quote
Eoin



Joined: 16 Jun 2003
Posts: 68
Location: Ireland
Eoin
For Dynamic allocation, i.e when the size can only be determined at runtime and not compile time there are a number of functions available depending on OS.

If your linking with a C library you can use malloc. If not you can use HeapAlloc when in windows, I'm not sure about the Linux/*BSD functions.
Post 12 Nov 2005, 15:54
View user's profile Send private message Reply with quote
ccrayne



Joined: 17 May 2005
Posts: 12
ccrayne
In DOS, use INT 21h with AH = 48h and BX = number of paragraphs requested.
Post 12 Nov 2005, 20:25
View user's profile Send private message 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-2020, Tomasz Grysztar.

Powered by rwasa.