[comp.sys.amiga.programmer] arp programing problem

fwp@unccvax.uncc.edu (Rick Pasotto) (03/31/91)

Posting for a friend without net access:
 
TO:         All
FROM:       Jim Boyd
SUBJECT:    ARP programming
DATE:       March 29, 1991
 
I recently wrote a program in assembly that uses the ARP library.   My
problem is this:
 
I'm using the fr_Function() to do several things, including resize
the window, add a gadget, and determine the type of file (file or
subdirectory) that is being read.

The ARP programmer's documentation states that a copy of the mask that
identifies what the fr_Function() is returned in D0, and a pointer to a
structure that varies with the mask value will return in A0.  My program
gets the mask value OK in D0, but the pointer value in A0 is wrong.  For
example, if the mask is telling me that the function is supposed to
return a pointer to a FileInfoBlock structure, I have to add #20 to the
pointer value so that everything 'lines up'.  When the function is supposed
to return a pointer to a NewWindow structure, I have to subtract #4 from the
pointer for alignment.   However, the AddGadFunc returns the correct
pointer value.

Being a novice assembly language programmer, I figured that I was somehow
doing something wrong, so I rewrote the program in C and exactly the same
thing happened.   Structure offsets were the same.

I'm using V39.1 of the arp.library, the Metacompost assembler, and some
ancient version of BLINK.   The C version was programmed in MANX 3.6a.
The finished program runs on several different Amigas with no problems,
but I hate to release something that has these kludges.  Any ideas?
 
Thanks,
 
Jim Boyd