[comp.sys.atari.st] Kludge for GEMFAST users

to_stdnet@stag.UUCP (03/11/89)

From: thelake!steve@stag.UUCP (Steve Yelvington)


Andrew Gray (agray@eriskay.axion.bt.co.uk) discovered a bug in the
form_alert() function of GEMFAST. The following can be used as a
replacement until Ian Lepore releases a fixed version. Compile to
fixform.o, then link it before the GEMFAST libraries. Your program will be
bigger than it needs to be, but it will work properly.


/*
 * fixform.c
 * kludge to replace bad form_alert() function in GEMFAST 1.0 & 1.1
 * link fixform.o before aesfast.a to bind in this version 
 * instead of the GEMFAST function that returns the wrong values.
 */


unsigned int control[4], global[15], int_in[16], int_out[7];
unsigned int *addr_in[2], *addr_out[1];
extern unsigned char ctrl_cnts[115][3];	/* in crystal.o module of dlibs */

unsigned int *_aespb[6] =	/* data to tell AES where to find its mail */
	{
	control,
	global,
	int_in,
	int_out,
	(unsigned int *)addr_in,
	(unsigned int *)addr_out
	};

/*
 * function _aesop(opcode)
 * sets the control arrays, kicks AES into action,
 * and returns int_out[0]
 */ 

unsigned int _aesop(opcode)
	register unsigned int opcode;		/* R7/d7 */
	{
	control[0] = opcode;
	control[1] = (int) ctrl_cnts[(opcode-10)][0];
	control[2] = (int) ctrl_cnts[(opcode-10)][1];
	control[3] = (int) ctrl_cnts[(opcode-10)][2];
	asm("	move.l	#__aespb,d1	");
	asm("	move.w	#200,d0		");
	asm("	trap	#2		");
	return int_out[0];
	}

int form_alert(button, string) 
	int button; char *string;
	{
	int_in[0] = button;
	addr_in[0] = (unsigned int *)string;
	return _aesop(52);
	}



/*
 * UUCP: {uunet!rosevax,amdahl!bungia,chinet,killer}!orbit!thelake!steve
 * ARPA: crash!orbit!thelake!steve@nosc.mil
 * #member <STdNET> The ST Developers Network
 */