[comp.sys.mac.programmer] MAC ASSEMBLY HELP NEEDED

johnston@dalcsug.UUCP (Bruce Johnston) (04/07/89)

Hello,

I would like some help with Assembly. I am trying to write a DA
in MDS and have no idea how to create variable space for the DA.
I need some variables to reference my resources.

Can any one help me. I need it quick like.

Some Code would really be appreciated.

Thanx in advance
Bruce Johnston
------------------------------------------------------------------------

-- 
Bruce Johnston       
Dalhousie University Halifax, Nova Scotia, CAnada.

Disclaimer: I'm always right... and submarines have screen doors!

bob@accuvax.nwu.edu (Bob Hablutzel) (04/07/89)

> I would like some help with Assembly. I am trying to write a DA
> in MDS and have no idea how to create variable space for the DA.
> I need some variables to reference my resources.

You should be able to declare storage you need (NOT at the start of the
code) with DC operators. For example, let's say that you need a longword
to store a handle in. You would do the following:

Label:	dc.l	1


To access this variable, you have two choices, which are really a question of
if you can spare an A-register throughout the call; you can either point an 
A-register (A4, for example) to the start of the declared variables and 
access appropriate offsets from it; or you can lea each variable as needed
to access. Note that you only need to reference via an A register for writing
into memory, not reading from, due to quirks in the 68000 instruction set.

Any further questions, feel free to write directly.


Bob Hablutzel	Wildwood Software	BOB@NUACC.ACNS.NWU.EDU

austing@Apple.COM (Glenn L. Austin) (04/08/89)

In article <384@dalcsug.UUCP> johnston@dalcsug.UUCP (Bruce Johnston) writes:
>I would like some help with Assembly. I am trying to write a DA
>in MDS and have no idea how to create variable space for the DA.
>I need some variables to reference my resources.

If you use LINK A6,neg#, you can then reference your local variables off of
A6.  Just remember to UNLINK A6 when you are all done.


-----------------------------------------------------------------------------
| Glenn L. Austin             | The nice thing about standards is that      | 
| Apple Computer, Inc.        | there are so many of them to choose from.   | 
| Internet: austing@apple.com |       -Andrew S. Tanenbaum                  |
-----------------------------------------------------------------------------
| All opinions stated above are mine -- who else would want them?           |
-----------------------------------------------------------------------------