comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitriy Anisimkov" <ts@quadrat.omsk.su>
Subject: Re: Help ADA and Assembly !!! :-(
Date: 1998/01/05
Date: 1998-01-05T00:00:00+00:00	[thread overview]
Message-ID: <01bd19f6$18026020$LocalHost@----> (raw)
In-Reply-To: 68omkm$orf$1@news2.isdnet.net


Hello.

> Exemple is a test of pragma import that must be works with calcul.obj but
> doesn't. It says udefinied reference to "calcul" ???
 
Gnat don't understand the *.obj files, but you can write in GNU assembler.
GCC compile assembler files *.s and make *.o files. Also you can get
assembler source from ADA source by -S compiler option.

gcc -S -O2 essaicalc.adb

try
-O1 without optimization
-O2 optimization
-O3 strong optimization

from 
---------essaicalc.ads
package essaicalc is
Procedure essaicalcul (n1,n2:integer; r1,r2 : out integer);
end essaicalc;

---------essaicalc.adb
package body essaicalc is
Procedure essaicalcul (n1,n2:integer; r1,r2 : out integer) is
begin
r1 := n1+n2;
r2 := n1*n2;
end;
end essaicalc;

I have get assembler code, this is a main fragment :

_essaicalc__essaicalcul:
.stabn 68,0,2,LM1-_essaicalc__essaicalcul
LM1:
LBB2:
LBE2:
	pushl %ebp
	movl %esp,%ebp
	pushl %ebx
	movl 8(%ebp),%ebx
	movl 12(%ebp),%eax
	movl 16(%ebp),%edx
.stabn 68,0,5,LM2-_essaicalc__essaicalcul
LM2:
	movl %eax,%ecx
	addl %edx,%eax
	imull %edx,%ecx
	movl %eax,(%ebx)
	movl %ecx,4(%ebx)
	movl %ebx,%eax
	movl -4(%ebp),%ebx
	movl %ebp,%esp
	popl %ebp
	ret $4

I'm using Gnat 3.10 for Win32. I think you can get same results in GNAT for
MSDOS.
IMHO Gnat for MSDOS is 32bit compiler, not 16 :

>	MOV	AX,[BP+6]
>	ADD	AX,[BP+8]

Best regards,

Dimitri Anisimkov.





       reply	other threads:[~1998-01-05  0:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <68omkm$orf$1@news2.isdnet.net>
1998-01-05  0:00 ` Dmitriy Anisimkov [this message]
1998-01-05  0:00   ` Help ADA and Assembly !!! :-( Samuel Tardieu
1998-01-05  0:00     ` Robert Dewar
1998-01-05  0:00 ` Martin C. Carlisle
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox