home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Unsorted BBS Collection
/
thegreatunsorted.tar
/
thegreatunsorted
/
programming
/
misc_programming
/
INASM
/
READ.ME
< prev
Wrap
Text File
|
1990-11-15
|
3KB
|
61 lines
Ada / Assembly Mixed Language Interface
---------------------------------------
This note provides additional information regarding the use
of Assembly code with Ada programs. In particular, it
discusses how to use Intel's assembly language development
tools with Ada programs. Please read the Ada Compiler
User's Guide and associated Release Notes before reading this
material. Information included in the Ada Run-Time
Customization Library may also be useful in interfacing to
assembly language programs.
In order to be able to interface to assembly language
routines, the following procedures should be followed:
1. Install the appropriate assembly language development
tools. The provided assembly language test file and
batch file assumes that the Intel tools are used and
are installed in the \INTEL86 directory.
2. Compile the Ada programs and assemble the assembly language
programs.
3. Pre-link the Ada object modules with BAMP making sure to
specify the "-r" and "-i" options. Note that the "-i"
option tells BAMP to create an Intel compatible object
module file. Do not specify the "-i" option to BAMP if a
Microsoft compatible object module file is desired.
4. Link the pre-linked Ada object module and all the
assembly language object modules together using the
appropriate assembly language development tools.
When interfacing to assembly language routines, it is very
important that the Ada calling conventions are followed. These
conventions are described in the User's Guide. It can be quite
useful to compile sample Ada subprogram bodies that duplicate the
interface to the assembly language routines and then look at the
sample code (either with a machine code debugger, or by telling
the Ada compiler to produce annotated assembly code with the
ADA "-S" and "-fe" options) to see how the conventions actually
work.
Also, note that all calls are FAR calls when between object
modules and that all data pointers are 32-bit pointers. In
addition, Ada programs require that the values of the DS, SS and
BP registers be preserved across subprogram calls and that the
called subprogram is responsible for popping its own arguments
off the stack by adjusting the SP register.
Included with this release are some sample Ada and Assembly
programs which illustrate the use of pragma interface(Assembly).
These programs are called ASMTEST.ADA and ADOSTST.ASM. Simply
create the Ada library with NEWLIB and run the batch file
MAKEASM to compile, assemble and link these programs. The
resulting executable file, ASMTEST.EXE can be run under DOS.