Results 1 to 5 of 5

Thread: Dynamic Allocation?

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2003
    Posts
    1,004

    Dynamic Allocation?

    Is there a way to dynamically allocate memory in the data segment? If so, how?

  2. #2
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    Which data segment? The segment referenced by ds or the .data segment in your exe?

    Dynamic allocation is OS-dependent. In Windows, you must call one of LocalAlloc, GlobalAlloc, HeapAlloc or VirtualAlloc (with the first two being deprecated). In Linux there's some system call too. In DOS, you need to implement a memory manager (I think).

    And of course you can't dynamically allocate space within your exe.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2003
    Posts
    1,004
    Well this is all implemented for as a 16-bit DOS .exe (after linking of course.) I could use either DS or ES (maybe FS or GS if need be)

    This is all in assembler. Not one bit of it is in a higher level PL. (A very sick learning activity that I assigned myself so to learn the second of the five PLs that I need to know.)

    I might be able to implement a memory manager if need be and give an overflow if there is a problem. If you have any sources to accomplish this, please share.

  4. #4
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    I have this:
    http://cboard.cprogramming.com/

    They have a DOS board, and as I never have programmed for DOS (too young back then) I don't know that much about it.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2003
    Posts
    1,004
    Basically, this is for a MS-DOS window that does not use the protected features of the processor.

    Thx for the source though.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width