• ASM + Pascal calling question

    From Jim Leonard@1:261/20.999 to All on Thu May 17 11:13:14 2012
    From: Jim Leonard <mobygamer@gmail.com>

    I'm aware that TP7/BP7 pascal programs can call external assembler
    routines. But is the opposite possible? Meaning, can assembler
    programs call routines in precompiled pascal units? C and assembly
    have this relationship (you can call C library routines from asm, and
    asm libs from C) but was curious if TP7+Tasm had this same
    relationship.

    --- Internet Rex 2.31
    * Origin: The gateway at Omicron Theta (1:261/20.999)
  • From Markus Humm@1:261/20.999 to All on Thu May 17 11:13:14 2012
    From: Markus Humm <markus.humm@freenet.de>

    Am 23.02.2011 18:08, schrieb Jim Leonard:
    I'm aware that TP7/BP7 pascal programs can call external assembler
    routines. But is the opposite possible? Meaning, can assembler
    programs call routines in precompiled pascal units? C and assembly
    have this relationship (you can call C library routines from asm, and
    asm libs from C) but was curious if TP7+Tasm had this same
    relationship.

    Normally not as the TPU format of compiled units changes from version to version. Imho it doesn't make much sense either as you'd use ASM
    normally for performance critical functionality and not for "boiler
    plate" stuff like menus etc.

    Greetings

    Markus

    --- Internet Rex 2.31
    * Origin: The gateway at Omicron Theta (1:261/20.999)
  • From Marco van de Voort@1:261/20.999 to All on Thu May 17 11:13:14 2012
    From: Marco van de Voort <marcov@turtle.stack.nl>

    On 2011-02-23, Jim Leonard <mobygamer@gmail.com> wrote:
    I'm aware that TP7/BP7 pascal programs can call external assembler
    routines. But is the opposite possible? Meaning, can assembler
    programs call routines in precompiled pascal units? C and assembly
    have this relationship (you can call C library routines from asm, and
    asm libs from C) but was curious if TP7+Tasm had this same
    relationship.

    Yes. Because of the same reason. Both C and Pascal are translated to
    assembler, so in the compiled translation assembler already calls pascal/C routines.

    --- Internet Rex 2.31
    * Origin: The gateway at Omicron Theta (1:261/20.999)
  • From Jim Leonard@1:261/20.999 to All on Thu May 17 11:13:14 2012
    From: Jim Leonard <mobygamer@gmail.com>

    On Feb 23, 1:31 pm, Marco van de Voort <mar...@turtle.stack.nl> wrote:
    On 2011-02-23, Jim Leonard <mobyga...@gmail.com> wrote:

    I'm aware that TP7/BP7 pascal programs can call external assembler routines.  But is the opposite possible?  Meaning, can assembler
    programs call routines in precompiled pascal units?  C and assembly
    have this relationship (you can call C library routines from asm, and
    asm libs from C) but was curious if TP7+Tasm had this same
    relationship.

    Yes. Because of the same reason. Both C and Pascal are translated to assembler, so in the compiled translation assembler already calls pascal/C routines.

    What I meant was: From my assembler program, can I link in routines
    from precompiled pascal units?

    I'm beginning to think not, but would like confirmation either way.

    --- Internet Rex 2.31
    * Origin: The gateway at Omicron Theta (1:261/20.999)
  • From Robert AH Prins@1:261/20.999 to All on Thu May 17 11:13:14 2012
    From: Robert AH Prins <spamtrap@prino.org>

    On 2011-02-23 21:43, Jim Leonard wrote:
    On Feb 23, 1:31 pm, Marco van de Voort<mar...@turtle.stack.nl> wrote:
    On 2011-02-23, Jim Leonard<mobyga...@gmail.com> wrote:

    I'm aware that TP7/BP7 pascal programs can call external assembler
    routines. But is the opposite possible? Meaning, can assembler
    programs call routines in precompiled pascal units? C and assembly
    have this relationship (you can call C library routines from asm, and
    asm libs from C) but was curious if TP7+Tasm had this same
    relationship.

    Yes. Because of the same reason. Both C and Pascal are translated to
    assembler, so in the compiled translation assembler already calls pascal/C >> routines.

    What I meant was: From my assembler program, can I link in routines
    from precompiled pascal units?

    I'm beginning to think not, but would like confirmation either way.

    No, as TPU's contain, in essence, unlinked .OBJ code + separate
    relocation tables. Next to that, Borland never disclosed the format of
    TPU files, and all but he simplest Pascal code uses code from system.tpu.

    Robert
    --
    Robert AH Prins
    spamtrap(a)prino(d)org

    --- Internet Rex 2.31
    * Origin: The gateway at Omicron Theta (1:261/20.999)
  • From Marco van de Voort@1:261/20.999 to All on Thu May 17 11:13:14 2012
    From: Marco van de Voort <marcov@turtle.stack.nl>

    On 2011-02-24, Robert AH Prins <spamtrap@prino.org> wrote:
    On 2011-02-23 21:43, Jim Leonard wrote:

    What I meant was: From my assembler program, can I link in routines
    from precompiled pascal units?

    I'm beginning to think not, but would like confirmation either way.

    No, as TPU's contain, in essence, unlinked .OBJ code + separate
    relocation tables. Next to that, Borland never disclosed the format of
    TPU files, and all but he simplest Pascal code uses code from system.tpu.

    Hmm, yes, linking might be a problem.

    I can vaguely remember there was a tpu2obj on simtel. Never tried that route though. Considering its date (1988) it is probably for very old TPs.

    Other then that, maybe link it to an overlay on a fixed address and try to
    load that? Still not an easy solution.

    --- Internet Rex 2.31
    * Origin: The gateway at Omicron Theta (1:261/20.999)
  • From Dr J R Stockton@1:261/20.999 to All on Thu May 17 11:13:14 2012
    From: Dr J R Stockton <reply1108@merlyn.demon.co.uk>

    In comp.lang.pascal.borland message <c6ed933a-41e3-4ee3-94b4-97427e69617 4@8g2000prt.googlegroups.com>, Wed, 23 Feb 2011 13:43:42, Jim Leonard <mobygamer@gmail.com> posted:

    On Feb 23, 1:31 pm, Marco van de Voort <mar...@turtle.stack.nl> wrote:
    On 2011-02-23, Jim Leonard <mobyga...@gmail.com> wrote:

    I'm aware that TP7/BP7 pascal programs can call external assembler
    routines.  But is the opposite possible?  Meaning, can assembler
    programs call routines in precompiled pascal units?  C and assembly
    have this relationship (you can call C library routines from asm, and
    asm libs from C) but was curious if TP7+Tasm had this same
    relationship.

    Yes. Because of the same reason. Both C and Pascal are translated to
    assembler, so in the compiled translation assembler already calls pascal/C >> routines.

    What I meant was: From my assembler program, can I link in routines
    from precompiled pascal units?

    I'm beginning to think not, but would like confirmation either way.


    Undoubtedly it is possible, but you might have to write your own linker,
    or a pre-processor for the Pascal, etc.


    What might serve more easily is to take your ASM code, and drop it into
    a Pascal program that reads essentially

    { whatever makes code in your Pascal units available }
    begin
    ASM
    { what you have in ASM, tweaked }
    END
    end.

    That ought to work, but the tweak could be large, and your asm code
    would need to understand the Pascal call interface.

    --
    (c) John Stockton, nr London, UK. ?@merlyn.demon.co.uk Turnpike v6.05 IE 8.
    Web <http://www.merlyn.demon.co.uk/> - FAQ-type topics, acronyms, and links.
    Command-prompt MiniTrue is useful for viewing/searching/altering files. Free,
    DOS/Win/UNIX now 2.0.6; see <URL:http://www.merlyn.demon.co.uk/pc-links.htm>.

    --- Internet Rex 2.31
    * Origin: The gateway at Omicron Theta (1:261/20.999)
  • From Jim Leonard@1:261/20.999 to All on Thu May 17 11:13:14 2012
    From: Jim Leonard <mobygamer@gmail.com>

    On Feb 24, 2:35 pm, Dr J R Stockton <reply1...@merlyn.demon.co.uk>
    wrote:
            { whatever makes code in your Pascal units available }
            begin
            ASM
            { what you have in ASM, tweaked }
            END
            end.

    I dislike doing that because I don't have access to some assembler
    niceties, like macros.

    No worries, I'll just continue to develop asm and link in
    external .objs, I guess.


    --- Internet Rex 2.31
    * Origin: The gateway at Omicron Theta (1:261/20.999)