Announcement

Collapse
No announcement yet.

$LINK assembly lang module

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • $LINK assembly lang module

    I have written a simple assembly language module which has local data in the default data segment.
    The module will be shared by C and PB programs.
    I have written it for assembled it using the LARGE model.
    The problem is any reference to DGROUP causes PB to generate a "ERROR 507 Invalid link file" when it compiles the $LINK statement.
    I am simply trying to load ds with the local data segment.
    mov ax, DGROUP ; causes error
    mov ds, ax

    What is the solution to creating and using a data segment so that PB will $LINK correctly.

    Thank you.

    ------------------

  • #2
    I believe PB/DOS is expecting MEDIUM-model code. You may find it helpful to review Chapter 15, "Assembly language and PowerBASIC", in the PowerBASIC User's Guide.


    ------------------
    Tom Hanlin
    PowerBASIC Staff

    Comment


    • #3
      Also check out the CTOPB.FAQ file that was installed with PB/DOS...


      ------------------
      Lance
      PowerBASIC Support
      mailto:[email protected][email protected]</A>
      Lance
      mailto:[email protected]

      Comment


      • #4
        thank you for your reply.
        I have read Ch 15, and reviewed it again before replying.
        All calls in PB are far. Data passed by ref is passed using far pointers, strings also get their own segments, this implies far data (large model). But the model is not important, since both med and large use far code.
        PB apparently does maintain its own local data in the default data segment. This is usually specified as DGROUP.
        The problem only occurs (regardless of model) when I try to reference DGROUP. I have tried using both the simplified segment directives (preferred method) and the old style of "DATA SEGMENT PARA PUBLIC 'DATA'" followed by a "DGROUP GROUP DATA". Neither one works.
        It implies that PB will not share the default data segment with an object file (again suggesting large model).
        However, because the object file will be used by a variety of programmers using C, C++, PASCAL, and PB, in all memory models (except for PB) we would like to only supply and maintain 1 source file/object file. The code in the original thread referencing DGROUP works fine in all of these other languages, just not PB. PB is forcing me to not reference DGROUP, which is required for the small model versions where DS and SS must remain equal.

        What is the issue loading DGROUP?

        Again, thanks in advance.

        ------------------

        Comment


        • #5
          PS the FAQ that Lance references also says use LARGE model.
          That may be where I got the idea originally, but again the model is not germaine to the problem at hand, which is referencing DGROUP.

          Thanks again.

          ------------------

          Comment


          • #6
            DS will be set to PowerBASIC's one data segment by default. There is
            no need to reference DGROUP in a PB program. No, I'm not sure why it
            isn't supported; presumably, some conflict with the PB group handling.

            ------------------
            Tom Hanlin
            PowerBASIC Staff

            Comment


            • #7
              Linking assembly into PB

              Doesn't PB have/use an $ALIAS metastatement that should correct this?

              Comment

              Working...
              X