www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/03/23/16:45:40

From: "John Shonder" <shonderja AT ornl DOT gov>
Newsgroups: comp.os.msdos.djgpp
Subject: Using assembly language with DJGPP
Date: Mon, 23 Mar 1998 16:31:28 -0500
Organization: Oak Ridge National Lab, Oak Ridge, TN
Lines: 29
Message-ID: <6f6k7n$80r$1@sws1.ctd.ornl.gov>
NNTP-Posting-Host: s25pc.ed.ornl.gov
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

I wrote a Turbo Pascal program that uses assembly language subroutines to
speed up some numerical computations. I'd like to do the same thing using
DJGPP but have no idea where to begin. I'd appreciate it if someone could
help me out or point me to a source for this information.

Here's how I did it in Turbo Pascal: Say I have a function "func" which
takes two variables as arguments and returns another variable of the same
type. Turbo Pascal  pushes pointers to the arguments onto the stack from
left to right, so at the beginning of the assembly code I just popped those
pointers into the appropriate variables and made the calculations. BTW these
are structured variables so they're passed by reference not by value.

I compile the assembly routine into an .obj file, and in the Pascal program
there's a line like this:

    function func(x,y,z: MyVarType);
    {$L func.obj)

Can I do something similar with DJGPP? What is the stack going to look like
when I enter the assembly routine?

I've seen the "inline" thing in DJGPP but would prefer not to use it as
these assembly routines are very involved.

I appreciate any help you can give me. Thanks.

John Shonder


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019