[comp.sys.amiga.tech] Lattice 5.04 BUG

valentin@cbmvax.UUCP (Valentin Pepelea) (11/18/89)

/*
 * Another bug in the Lattice C compiler Saga. When using prototypes for
 * the Exec functions, the A6 register is not saved anymore upon entry
 * of a function which makes calls to exec. Nasty little bug if you call
 * a C function from assembler, when the assembler function itself keeps
 * something important in A6.
 *
 */

#include <exec/types.h>
#include <proto/exec.h>

APTR Cia = NULL;		/* Pointer to the allocated resource */
struct IOExtPar *PAR_request;	/* The current active IO request */

void MD_Open(struct IOExtPar *request)
{
	    Cia = (APTR) OpenResource("ciaa.resource");
}

------------------------------cut here-----------------------------------------

Valentin
-- 
The Goddess of democracy? "The tyrants     Name:    Valentin Pepelea
may distroy a statue,  but they cannot     Phone:   (215) 431-9327
kill a god."                               UseNet:  cbmvax!valentin@uunet.uu.net
             - Ancient Chinese Proverb     Claimer: I not Commodore spokesman be

armhold@steely.rutgers.edu (George Armhold) (06/11/90)

While trying to design a custom requester for a program I'm writing, I
seem to have come across a bug in Lattice 5.04.  Whenever I try to
assign a custom bitmap to a requester, the compiler fails with CXERR
22.   If I take the same exact code, and set the image data pointer to
NULL, the code compiles fine.  Has this been fixed in 5.05? (I'm still
waiting for it to arrive.)  Or am I doing something wrong here?


Here's the offending code:

struct IntuiText ok_text = 
{
		0,				/* FrontPen */
		1, 				/* BackPen */
		JAM1,			/* Draw Mode */
		4, 4,			/* LeftEdge, TopEdge of text */
		NULL,			/* default font */
		(UBYTE *)"OK",	/* text */
		NULL			/* no more IntuiText's */
};


struct Gadget ok_gadget = 
{
	NULL,				/* NextGadget */
	100, 15,			/* LeftEdge, TopEdge */
	10, 10,				/* Width, Height */
	GADGHCOMP,			/* flags */
	RELVERIFY | 
	ENDGADGET,			/* activation flags */
	REQGADGET,			/* GadgetType */
	NULL,				/* GadgetRender */
	NULL,				/* SelectRender */
	&ok_text,			/* pointer to an IntuiText */
	NULL,				/* mutual exclude */
	NULL,				/* special info */
	0,					/* GadgetId */
	NULL,				/* UserData */
};

SHORT ok_border_points[]=
{
	0,0,
	10,0,
	10,10,
	0,10,
	0,0
};


struct Border ok_gadget_border =
{
	0,0,                /* LeftEdge, TopEdge */
	0,0,				/* FrontPen, BackPen */
	JAM1,				/* DrawMode */
	5, 					/* number of points in ok_border_points */
	ok_border_points,	/* pointer to the array of points */   
	NULL,				/* NexBorder */
};
			
	
	
USHORT chip my_image_data[84]=
{
  0x00FF,0x8000, 
  0x0700,0x7000,
  0x18F0,0x0C00,
  0x27E0,0x0200,
  0x4800,0x0100,
  0x9100,0x4080,
  0x90AA,0x8080,
  0x8080,0x8080,
  0x4041,0x0100,
  0x2041,0x0200,
  0x1822,0x0C00,
  0x0622,0x3000,
  0x01FF,0xC000,
  0x0150,0x2000,
  0x0205,0x4000,
  0x0150,0x2000,
  0x0205,0x4000,
  0x0150,0x2000,
  0x0205,0x4000,
  0x01FF,0x8000,
  0x003C,0x0000,

  0x0000,0x0000, 
  0x00FF,0x8000,
  0x070F,0xF000,
  0x181F,0xFC00,
  0x37FF,0xFE00,
  0x6EFF,0xBF00,
  0x6F55,0x7F00,
  0x7F7F,0x7F00,
  0x3FBE,0xFE00,
  0x1FBE,0xFC00,
  0x07DD,0xF000,
  0x01DD,0xC000,
  0x0000,0x0000,
  0x00AF,0xC000,
  0x01FA,0x8000,
  0x00AF,0xC000,
  0x01FA,0x8000,
  0x00AF,0xC000,
  0x01FA,0x8000,
  0x0000,0x0000,
  0x0000,0x0000
};


struct Image about_image =
{
  0, 0,          /* LeftEdge, TopEdge */
  25, 21,        /* Width, Height */
  2,             /* Depth */
  my_image_data, /* ImageData */
  0x03, 0x00,    /* PlanePick, PlaneOnOff */
  NULL           /* NextImage */
};


	
struct Requester About_req =
{
	NULL,				/* OlderRequester- used by intuition */
	100,25,				/* LeftEdge, TopEdge */
	201, 40,			/* Width, Height */
	0, 0,				/* RelLeft, RelTop */
	&ok_gadget,			/* address of first gadget */
	&ok_gadget_border,	/* address of border structure */
	&ok_text, 			 /* pointer to an intuitext */
	PREDRAWN,			/* flags */
	0,					/* BackFill */
	NULL,				/* ReqLayer- used by intuition */
	NULL,				/* ReqPad1- used by intuition */
	&about_image,		/* pointer to my image data */
/* 	^^^^^^^^^^^  if we set this to NULL, the code compiles ok. */



	NULL,				/* RWindow- used by intuition */
	NULL,				/* ReqPad2- used by intuition */
};