I finally started armlet-pogramming ;-) and run into what probably is a 
beginners problem. The following small armlet randomly produces a Fat/Ex when 
called with PceNativeCall:

/*** ARMLET CODE ************************************/
#include <PalmOS.h>
#include <PceNativeCall.h>
#include <ByteOrderUtils.h>

// parameters for the armlet
typedef struct {
        UInt8*  buff;
        UInt32  buffSize;
        UInt8   a;
        UInt8   b;
        } myParmType;

UInt32 ARMlet_Main( const void *emulStateP, myParmType*, Call68KFuncType* );

UInt32 ARMlet_Main( const void *emulStateP, myParmType *parm, Call68KFuncType 
*call68KFuncP ) {
        UInt8   *p, *pEnd, a, b;

        p = (UInt8*) Read68KUnaligned32( &(parm->buff) );
        pEnd = p + Read68KUnaligned32( &(parm->buffSize) );
        a = parm->a;
        b = parm->b;

        <do some computation on the buffer>
        }       

        return 0;
}

******************************************************

I am pretty sure the computation on the buffer data is ok because I use the 
identical code in 68K on the simulator without any problem.

Anlignment of the parameter 'parm' doesn't matter: the docs say the parameter 
for the armlet needn't be aligned. I also checked that putting 'parm' on a 1,2 
or 3 byte boundary does not cause a crash.

Thanks in advance
Harry

-- 
For information on using the ACCESS Developer Forums, or to unsubscribe, please 
see http://www.access-company.com/developers/forums/

Reply via email to