[comp.sys.mac.programmer] Question on MPW 3.1 assembly

domenikos@emass.enet.dec.com (George Domenikos) (01/08/91)

-Message-Text-Follows-

Hi there,

What is the syntax for exporting an MPW 3.1 assembly routine to MPW C modules.

I am having something like this
; myassembly.a

myassembly_routine 	PROC EXPORT
	MOVEM.l A2-A4/D3-D7,-(SP)
	.........                 ;more code here
        MOVEM.l (SP)+,A2-A4/D3-D7
        RTS
	ENDP

My C module looks like
/* myCfile.c */
#include <stdio.h>
#include "myinclude.h"
extern void myassembly_routine()


main()
{
}
Everything compiles fine and I link everything with myassembly.a.o but
the linker still gives me undefine entry myassembly_routine referenced from
myfile.c.o    I really do not understand why.

Question #2
How can I make a global variable defined say in myinclude.h 
as follows :

extern char GLOBAL_TABLE[50];

visible to
myassembly routine and change its contents in the assembly routine?
Do I have to use IMPORT in the assembly for that. 


Question #3
Does any body know if a device driver written in Think C can be accessed
by an application written in MPW Pascal. Personally I am having problems.
It seems that they are using different addressing conventions. For instance
an address to some storage data returned by the driver translates to
an address containig garbage from MPW pascals perspective. Am I right?



Thanks to all of you in advance
george

beard@ux5.lbl.gov (Patrick C Beard) (01/08/91)

In article <1991Jan8.062852.4007@engage.enet.dec.com> domenikos@emass.enet.dec.com (George Domenikos) writes:

#What is the syntax for exporting an MPW 3.1 assembly routine to MPW C modules.
#
#I am having something like this
#; myassembly.a
#
#myassembly_routine 	PROC EXPORT
#	.........                 ;more code here
#	ENDP
#

Your link problem is due to the fact that MPW C (and most C compilers) is
case sensitive, and by default MPW Assembly is not.  Use the "CASE ON"
directive before your assembly code and things will link.  i.e., add the line:

	CASE ON		; so C can link to us.

#Question #2
#How can I make a global variable defined say in myinclude.h 
#as follows :
#
#extern char GLOBAL_TABLE[50];
#
#visible to
#myassembly routine and change its contents in the assembly routine?
#Do I have to use IMPORT in the assembly for that.

Yes, plus see above.

#Question #3
#Does any body know if a device driver written in Think C can be accessed
#by an application written in MPW Pascal. Personally I am having problems.
#It seems that they are using different addressing conventions. For instance
#an address to some storage data returned by the driver translates to
#an address containig garbage from MPW pascals perspective. Am I right?

This shouldn't be a problem.  However, you have to be careful how you return
this data, as driver call glue can mess things up.  You should, if possible,
always use PBControl/PBStatus, etc. calls so you can pass the actual param
block and control what the driver sees.  Glue will often mess you up.

Hope this helps.

--
-------------------------------------------------------------------------------
-  Patrick Beard, Macintosh Programmer                        (beard@lbl.gov) -
-  Berkeley Systems, Inc.  ".......<dead air>.......Good day!" - Paul Harvey  -
-------------------------------------------------------------------------------