MSVC 1.5 - how do I force strings into CODE segment - Programmer

This is a discussion on MSVC 1.5 - how do I force strings into CODE segment - Programmer ; I'm not sure if this is the best group to post this, but I have a question about ancient MSVC 1.5. Right now, all strings in my code, i.e. text in quotes, are put in the _DATA segment by default. ...

+ Reply to Thread
Results 1 to 4 of 4

Thread: MSVC 1.5 - how do I force strings into CODE segment

  1. MSVC 1.5 - how do I force strings into CODE segment

    I'm not sure if this is the best group to post this, but I have a
    question about ancient MSVC 1.5.

    Right now, all strings in my code, i.e. text in quotes, are put in the
    _DATA segment by default.

    I need to tell the compiler/linker to put these in the _CODE segment
    where there is more space available.

    Is there a way to do this? I've looked through the MSVC 1.5 help files
    and can't find any compiler or linker switches that do this.

    Thanks for your help!

    Ed


  2. Re: MSVC 1.5 - how do I force strings into CODE segment

    "Ed" wrote:
    > I'm not sure if this is the best group to post this, but I have a
    > question about ancient MSVC 1.5.
    >
    > Right now, all strings in my code, i.e. text in quotes, are put in the
    > _DATA segment by default.
    >
    > I need to tell the compiler/linker to put these in the _CODE segment
    > where there is more space available.
    >
    > Is there a way to do this? I've looked through the MSVC 1.5 help files
    > and can't find any compiler or linker switches that do this.


    I doubt that's possible. What memory model are you using? There are
    a lot of different models for 16-bit x86 code, and using a "large data"
    model might be what you need.

    John




  3. Re: MSVC 1.5 - how do I force strings into CODE segment

    I'm using the huge model for the 8086, but the strings are still in the
    data segment.

    With the huge model, all pointers are 32 bits, so it should be possible
    to access strings in another segment. I just need a way to tell the
    compiler/linker to put the strings in the CODE segment.

    Ed


    John Dallman wrote:
    > "Ed" wrote:
    > > I'm not sure if this is the best group to post this, but I have a
    > > question about ancient MSVC 1.5.
    > >
    > > Right now, all strings in my code, i.e. text in quotes, are put in the
    > > _DATA segment by default.
    > >
    > > I need to tell the compiler/linker to put these in the _CODE segment
    > > where there is more space available.
    > >
    > > Is there a way to do this? I've looked through the MSVC 1.5 help files
    > > and can't find any compiler or linker switches that do this.

    >
    > I doubt that's possible. What memory model are you using? There are
    > a lot of different models for 16-bit x86 code, and using a "large data"
    > model might be what you need.
    >
    > John



  4. Re: MSVC 1.5 - how do I force strings into CODE segment

    "Ed" wrote:

    > I'm using the huge model for the 8086, but the strings are still in the
    > data segment.
    >
    > With the huge model, all pointers are 32 bits, so it should be possible
    > to access strings in another segment. I just need a way to tell the
    > compiler/linker to put the strings in the CODE segment.


    Would that it were that simple... Huge-model 16-bit code has pointers
    that are stored in 32 bits. Those consist of a value for the segment
    register and a value for the address relative to the segment. Data
    accesses are normally relative to the current value of the DS data
    segment register. To put data into the code segment, the compiler
    has to generate prefix instructions on all the data loads to say that
    they are to be executed relative to the current code segment register.

    So this would have to be done at compile time. I don't know if
    MSVC 1.5 can do that, but some of the earlier versions of the
    MS C compiler had segment-override compile options that I
    never figured out, so it might be possible.

    Given that you're using the huge model, there should be no limit
    on the data segment's size, so I don't see quite what you're hoping
    to accomplish. Or are you using Huge code (32-bit pointers to
    functions) and Small data (16-bit pointers to data)? If so, going
    to Huge data as well should lift your limits.

    John



+ Reply to Thread