Allocating large memories

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • manu1001
    New Member
    • Jul 2007
    • 14

    #1

    Allocating large memories

    I need to allocate memory of a few 100's of KB, using DOS on an Intel x86 processor. There is a way around using TurboC compiler specific features(messy) . But can it be done with ANSI C?
    (The problem arises with Intel's segmented memory and DOS's incapability of handling 32-bit addresses)
    I've found very little resources on the internet regarding these topics. Will be glad if you could point to one.
  • JosAH
    Recognized Expert MVP
    • Mar 2007
    • 11453

    #2
    Originally posted by manu1001
    I need to allocate memory of a few 100's of KB, using DOS on an Intel x86 processor. There is a way around using TurboC compiler specific features(messy) . But can it be done with ANSI C?
    (The problem arises with Intel's segmented memory and DOS's incapability of handling 32-bit addresses)
    I've found very little resources on the internet regarding these topics. Will be glad if you could point to one.
    If I remember well those DOS C compilers had flags for that purpose: 'large
    memory model' used segment:offset pointers for both code addresses as well
    as data addresses. Check your compiler's flags.

    kind regards,

    Jos

    Comment

    • manu1001
      New Member
      • Jul 2007
      • 14

      #3
      Yes, I've seen that, but it requires the usage of far pointers which is not part of the standard C. It would probably require a lot of modification to port it elsewhere.
      Isn't there an alternative?

      Comment

      • weaknessforcats
        Recognized Expert Expert
        • Mar 2007
        • 9214

        #4
        The data segment has a limit and you have to use near/far pointers plus compile for the memory model (TINY, LARGE, HUGE, etc... If I remember, DOS does all the swapping using a disc swapfile. Your task is to keep things within a segment to avoid a swap.

        Unfortunately, it has been 12 years since I used DOS and I hace discarded all of my reference books and DOS software.

        None of this has anything to do with C. These are just limits imposed on you by DOS.

        Comment

        Working...